diff --git a/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java new file mode 100644 index 0000000000..310e75dce0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java @@ -0,0 +1,59 @@ +package com.fr.common.detect; + +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.DesignerEnvManager; +import com.fr.log.FineLoggerFactory; +import com.fr.module.ModuleContext; +import com.fr.web.WebSocketConfig; + +import java.net.Socket; +import java.util.concurrent.ExecutorService; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/10 + */ +public class CommonPortDetector { + + private static final CommonPortDetector INSTANCE = new CommonPortDetector(); + private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector")); + + public static CommonPortDetector getInstance() { + return INSTANCE; + } + + public void execute() { + service.submit(new Runnable() { + @Override + public void run() { + detectTomcatPort(); + detectWebSocketPort(); + } + }); + } + + private void detectTomcatPort() { + int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); + if (checkPort(port)) { + FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port); + } + } + + private void detectWebSocketPort() { + Integer[] ports = WebSocketConfig.getInstance().getPort(); + for (int port : ports) { + if (checkPort(port)) { + FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port); + } + } + } + + private boolean checkPort(int port) { + try (Socket socket = new Socket("localhost", port)) { + return true; + } catch (Exception e) { + return false; + } + } +} diff --git a/designer-base/src/main/java/com/fr/common/report/ReportState.java b/designer-base/src/main/java/com/fr/common/report/ReportState.java new file mode 100644 index 0000000000..cc32e439cf --- /dev/null +++ b/designer-base/src/main/java/com/fr/common/report/ReportState.java @@ -0,0 +1,21 @@ +package com.fr.common.report; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/27 + */ +public enum ReportState { + + STOP("stop"), ACTIVE("active"); + + private String value; + + ReportState(String value) { + this.value = value; + } + + public String getValue() { + return this.value; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index 6ebd349cbb..77c779ce3e 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -8,17 +8,21 @@ import com.fr.base.Utils; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.dialog.ErrorDialog; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.utils.DesignUtils; +import com.fr.design.utils.DesignerPort; +import com.fr.exit.DesignerExiter; import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; @@ -81,6 +85,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private static final String VERSION_80 = "80"; private static final int CACHINGTEMPLATE_LIMIT = 5; private static final String WEB_NAME = "webapps"; + /** + * 指定默认工作空间 + */ + public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default"; private static DesignerEnvManager designerEnvManager; // gui. private String activationKey = null; @@ -194,6 +202,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + XmlHandler.Self.handle(e); } // james:如果没有env定义,要设置一个默认的 @@ -340,6 +349,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + XmlHandler.Self.handle(e); } finally { if (null != fileWriter) { try { @@ -554,6 +564,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private String getDefaultenvPath(String installHome) { + String defaultWorkspacePath = System.getProperty(DEFAULT_WORKSPACE_PATH); + if (defaultWorkspacePath != null) { + return defaultWorkspacePath; + } //这里需要转成反斜杠和生成默认路径一致 return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath(); } @@ -1396,6 +1410,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * 对国际化进行校验 * 非简繁英日韩的默认环境 设计器全部默认为英文版本 + * * @param locale * @return */ @@ -1545,6 +1560,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { readDesignerPushUpdateAttr(reader); } else if (name.equals(vcsConfigManager.XML_TAG)) { readVcsAttr(reader); + } else if (DesignerPort.XML_TAG.equals(name)) { + readDesignerPort(reader); } else { readLayout(reader, name); } @@ -1736,6 +1753,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { reader.readXMLObject(vcsConfigManager); } + public void readDesignerPort(XMLableReader reader) { + reader.readXMLObject(DesignerPort.getInstance()); + } + /** * Write XML.
* The method will be invoked when save data to XML file.
@@ -1761,6 +1782,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writeOpenDebug(writer); writeDesignerPushUpdateAttr(writer); writeVcsAttr(writer); + writeDesignerPort(writer); writer.end(); } @@ -2010,6 +2032,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.vcsConfigManager.writeXML(writer); } + private void writeDesignerPort(XMLPrintWriter writer) { + DesignerPort.getInstance().writeXML(writer); + } + public VcsConfigManager getVcsConfigManager() { return vcsConfigManager; @@ -2018,4 +2044,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { public void setVcsConfigManager(VcsConfigManager vcsConfigManager) { this.vcsConfigManager = vcsConfigManager; } + + enum XmlHandler { + Self; + public void handle(Throwable throwable) { + ErrorDialog dialog = new ErrorDialog(null, + Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"), + Toolkit.i18nText("Fine-Design_Error_Start_Report"), + throwable.getMessage()) { + @Override + protected void okEvent() { + dispose(); + DesignerExiter.getInstance().execute(); + } + + @Override + protected void restartEvent() { + dispose(); + RestartHelper.restart(); + } + }; + dialog.setVisible(true); + DesignerExiter.getInstance().execute(); + } + }; } diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 1dd438e2d4..81e62239b4 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -1,5 +1,6 @@ package com.fr.design; +import com.fr.common.report.ReportState; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -7,32 +8,55 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; +import com.fr.design.env.RemoteWorkspace; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.DesignUtils; +import com.fr.env.CheckServiceDialog; import com.fr.env.EnvListPane; +import com.fr.exit.DesignerExiter; import com.fr.general.GeneralContext; +import com.fr.general.GeneralUtils; +import com.fr.invoke.Reflect; +import com.fr.json.JSONArray; import com.fr.license.exception.RegistEditionException; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.rpc.Result; import com.fr.stable.AssistUtils; import com.fr.stable.EnvChangedListener; +import com.fr.stable.StringUtils; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; +import com.fr.workspace.base.WorkspaceAPI; import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.base.FineObjectPool; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.exception.WorkspaceAuthException; +import com.fr.workspace.engine.exception.WorkspaceConnectionException; +import com.fr.workspace.engine.rpc.WorkspaceProxyPool; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import java.lang.reflect.Method; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Set; +import java.util.HashSet; import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.QUESTION_MESSAGE; @@ -84,6 +108,7 @@ public class EnvChangeEntrance { private boolean switch2Env(final String envName, PopTipStrategy strategy) { DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); + WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); @@ -98,12 +123,7 @@ public class EnvChangeEntrance { }); return false; } - // 如果版本不一致,且确认 不继续 连接,这里返回 false. - if (!versionCheckAndConfirm(selectedEnv)) { - return false; - } - WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { @@ -116,12 +136,17 @@ public class EnvChangeEntrance { } } }); + // REPORT-25688如果是war包部署的服务器,给与提示 + if (WorkContext.getCurrent().isWarDeploy()) { + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_War_Deploy_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); + } //REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录 JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (template != null) { template.refreshToolArea(); } - + showServiceDialog(selectedEnv); } catch (WorkspaceAuthException | RegistEditionException e) { // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); @@ -154,6 +179,7 @@ public class EnvChangeEntrance { } /** + * 这个功能留着,可能会加回来,先做注释处理 * 切换远程环境之前,进行版本检测,当版本不一致的时候,提示。 * 当用户确认选择 ok 时,才继续。 * @@ -197,6 +223,148 @@ public class EnvChangeEntrance { return true; } + /** + * 对选择的环境做服务检测 + * @param selectedEnv 选择的工作环境 + */ + public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception { + //是否需要做服务校验 + if(needCheckBranch(selectedEnv)) { + String localBranch; + String remoteBranch; + WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection(); + localBranch = GeneralUtils.readFullBuildNO(); + try { + remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); + } catch (WorkspaceConnectionException e) { + remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch); + } + //通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本) + if (localBranch.contains("#") && localBranch.equals(remoteBranch)) { + //说明版本一致,仅做日志记录 + FineLoggerFactory.getLogger().info("Remote Designer version consistency"); + } else { + localBranch = formatBranch(localBranch); + remoteBranch = formatBranch(remoteBranch); + Set noExistServiceSet = getNoExistServiceSet(connectionInfo); + StringBuilder textBuilder = new StringBuilder(); + for (Class clazz : noExistServiceSet) { + WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class); + if(workspaceAPI == null){ + FineLoggerFactory.getLogger().info("workspace service {} get annotation failed", clazz); + continue; + } + if(workspaceAPI.ignore()){ + continue; + } + String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description()); + textBuilder.append(descriptionOfCN).append("\n"); + } + String areaText = textBuilder.toString(); + if(StringUtils.isEmpty(areaText)){ + return; + } + CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch); + dialog.setVisible(true); + } + } + } + + /** + * 判断是否需要做版本验证,判断依据为 + * 1、选择的环境为远程环境 + * 2、一个月内不弹出是否勾选 + * @param selectedEnv 选择的环境 + * @return + */ + private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){ + if(selectedEnv.getType() == DesignerWorkspaceType.Remote){ + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + if(StringUtils.isEmpty(selectedEnv.getRemindTime())){ + return true; + } + //获取记录的时间 + Date remindTime = format.parse(selectedEnv.getRemindTime()); + calendar.setTime(remindTime); + //获取一个月后的时间 + calendar.add(Calendar.MONTH,1); + //与当前时间作对比,然后判断是否提示 + if(new Date().after(calendar.getTime())){ + return true; + } + } catch (ParseException e) { + return true; + } + } + return false; + } + + /** + * 获取不存在的服务列表 + * @param info 环境连接信息 + * @return 以Set形式返回不存在的服务 + */ + public Set getNoExistServiceSet(WorkspaceConnectionInfo info){ + Set noExistServiceSet = new HashSet(); + Set remoteServiceSet = new HashSet(); + Set localServiceSet = FineObjectPool.getInstance().getServerPool().keySet(); + + try { + JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList(); + for(int i = 0; i < serviceArray.size(); i++){ + try{ + Class clazz = Class.forName((String) serviceArray.get(i)); + remoteServiceSet.add(clazz); + } catch (Exception e){ + continue; + } + } + noExistServiceSet.addAll(localServiceSet); + noExistServiceSet.removeAll(remoteServiceSet); + return noExistServiceSet; + } catch (WorkspaceConnectionException e) { + FineLoggerFactory.getLogger().info(e.getMessage()); + //根据本地的服务列表做逐一检测 + for(Class clazz : localServiceSet) { + Method testMethod = Reflect.on(Method.class).create(clazz, "connectTest", new Class[0], String.class, new Class[0], 1025, 8, null, null, null, null).get(); + WorkspaceProxyPool proxyPool = (WorkspaceProxyPool) (((RemoteWorkspace) WorkContext.getCurrent()).getClient()).getPool(); + Result result = proxyPool.testInvoker(testMethod); + Exception invokeException = (Exception) result.getException(); + if(invokeException != null){ + Exception cause = (Exception) invokeException.getCause(); + //获取被包装最底层的异常 + while (cause != null) { + invokeException = cause; + cause = (Exception) invokeException.getCause(); + } + //该异常表示服务不存在 + if(invokeException instanceof ClassNotFoundException){ + noExistServiceSet.add(clazz); + } + } + } + return noExistServiceSet; + } catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(),e); + return noExistServiceSet; + } + } + + /** + * 格式化分支版本号 + * @param branch 初始的分支版本号 + * @return 格式化后的版本号 + */ + private String formatBranch(String branch){ + if(branch.contains("#")){ + return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13); + } + return branch; + } + + /** * 编辑items * @@ -243,14 +411,18 @@ public class EnvChangeEntrance { @Override public void doOk() { + ProcessEventPipe pipe = FineProcessContext.getParentPipe(); + if (FineProcessContext.getParentPipe() != null) { + pipe.fire(new CarryMessageEvent(ReportState.ACTIVE.getValue())); + } if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { - System.exit(0); + DesignerExiter.getInstance().execute(); } } @Override public void doCancel() { - System.exit(0); + DesignerExiter.getInstance().execute(); } }); envListDialog.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/RestartHelper.java b/designer-base/src/main/java/com/fr/design/RestartHelper.java index cdb4fc532e..64fdda7baa 100644 --- a/designer-base/src/main/java/com/fr/design/RestartHelper.java +++ b/designer-base/src/main/java/com/fr/design/RestartHelper.java @@ -2,6 +2,7 @@ package com.fr.design; import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.RestartAction; +import com.fr.exit.DesignerExiter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; @@ -152,7 +153,14 @@ public class RestartHelper { } finally { WorkContext.getCurrent().close(); frame.dispose(); - System.exit(0); + try { + // 更新升级过渡用 供当前测试 后面可删除 + Class.forName("com.fr.exit.DesignerExiter"); + DesignerExiter.getInstance().execute(); + } catch (Exception ignore) { + } finally { + System.exit(0); + } } } @@ -194,7 +202,11 @@ public class RestartHelper { } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - DesignerContext.getDesignerFrame().exit(); + if (DesignerContext.getDesignerFrame() != null) { + DesignerContext.getDesignerFrame().exit(); + } else { + DesignerExiter.getInstance().execute(); + } } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java index 83aeaefe3d..574195470b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java +++ b/designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java @@ -260,6 +260,13 @@ public class ActionFactory { } } + public static void referCellInsertActionClass(Class[] cls) { + if (cls != null) { + actionClasses.clear(); + Collections.addAll(actionClasses, cls); + } + } + /** * 生成单元格插入相关的Action * 表单中报表块编辑需要屏蔽掉"插入子报表" @@ -318,6 +325,13 @@ public class ActionFactory { } } + public static void referFloatInsertActionClass(Class[] cls) { + if (cls != null) { + floatActionClasses.clear(); + Collections.addAll(floatActionClasses, cls); + } + } + /** * 生成悬浮元素插入相关的Action * diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 55ccfce636..3fc03f438f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -38,6 +38,7 @@ import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; +import com.fr.stable.os.OperatingSystem; import com.fr.third.apache.log4j.Level; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; @@ -218,22 +219,23 @@ public class PreferencePane extends BasicPane { oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oraclePane.add(oracleSpace); - JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager")); - useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); - upmSelectorPane.add(useOptimizedUPMCheckbox); - advancePane.add(upmSelectorPane); + if (!OperatingSystem.isLinux()) { + JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager")); + useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); + upmSelectorPane.add(useOptimizedUPMCheckbox); + advancePane.add(upmSelectorPane); + } - //REPORT-23578 先屏蔽掉 - //JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager")); - //useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); - //dbmSelectorPane.add(useUniverseDBMCheckbox); - //advancePane.add(dbmSelectorPane); + JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager")); + useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); + dbmSelectorPane.add(useUniverseDBMCheckbox); + advancePane.add(dbmSelectorPane); JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); improvePane.add(joinProductImproveCheckBox); - if(SupportOSImpl.AUTOPUSHUPDATE.support()){ + if (SupportOSImpl.AUTOPUSHUPDATE.support()) { autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); improvePane.add(autoPushUpdateCheckBox); } @@ -511,23 +513,8 @@ public class PreferencePane extends BasicPane { JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting")); logPane.add(logLevelPane); logLevelComboBox = new UIComboBox(LOG); + logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal()); logLevelPane.add(logLevelComboBox); - logLevelComboBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - Configurations.update(new Worker() { - @Override - public void run() { - Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem()); - } - - @Override - public Class[] targets() { - return new Class[]{Log4jConfig.class}; - } - }); - } - }); } private void createLanPane(JPanel generalPane) { @@ -555,8 +542,8 @@ public class PreferencePane extends BasicPane { }); UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效 double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, p, p}; + double[] rowSize = {p}; + double[] columnSize = {p, p, p}; Component[][] components = { {languageLabel, languageComboBox, noticeLabel}, }; @@ -596,7 +583,7 @@ public class PreferencePane extends BasicPane { private void createLengthPane(JPanel advancePane) { double p = TableLayout.PREFERRED; - double rowSize[] = {p}; + double[] rowSize = {p}; // 长度单位选择 JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units")); @@ -618,8 +605,8 @@ public class PreferencePane extends BasicPane { private void createServerPane(JPanel advancePane) { double p = TableLayout.PREFERRED; - double rowSize[] = {p}; - double columnSize[] = {p, p, p}; + double[] rowSize = {p}; + double[] columnSize = {p, p, p}; JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting")); advancePane.add(serverPortPane); @@ -658,7 +645,7 @@ public class PreferencePane extends BasicPane { /** * The method of populate. * - * @param designerEnvManager + * @param designerEnvManager 设计器环境管理器 */ public void populate(DesignerEnvManager designerEnvManager) { if (designerEnvManager == null) { @@ -687,7 +674,7 @@ public class PreferencePane extends BasicPane { defaultStringToFormulaBox.setSelected(false); } VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); - if (WorkContext.getCurrent().isCluster()) { + if (WorkContext.getCurrent().isCluster()){ vcsEnableCheckBox.setEnabled(false); gcEnableCheckBox.setEnabled(false); } @@ -727,9 +714,11 @@ public class PreferencePane extends BasicPane { this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); - useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); + if (useOptimizedUPMCheckbox != null) { + useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); + } - //useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); + useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); @@ -826,23 +815,32 @@ public class PreferencePane extends BasicPane { designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); } - Configurations.update(new Worker() { - @Override - public void run() { - Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem())); - } + if (WorkContext.getCurrent().isLocal()) { + Configurations.update(new Worker() { + @Override + public void run() { + Level level = (Level) logLevelComboBox.getSelectedItem(); + if (level != null) { + Log4jConfig.getInstance().setRootLevel(level); + } + } - @Override - public Class[] targets() { - return new Class[]{Log4jConfig.class}; - } - }); + @Override + public Class[] targets() { + @SuppressWarnings("unchecked") + Class[] classes = new Class[]{Log4jConfig.class}; + return classes; + } + }); + } Configurations.update(new Worker() { @Override public void run() { - ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected()); - //ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected()); + if (useOptimizedUPMCheckbox != null) { + ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected()); + } + ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected()); } @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java b/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java index 4b09de8562..0839c14767 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java @@ -51,7 +51,7 @@ public class FineUIAction extends UpdateAction { BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { - + // Do nothing } }); dialog.setVisible(true); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java index fe894437d7..e2d7b63c9f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java @@ -31,7 +31,7 @@ public class RemindDialog extends UIDialog { @Override public void checkValid() throws Exception { - + // Do nothing } public RemindPane getRemindPane() { diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java index 7591c2af3d..1d8d99266e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java @@ -114,6 +114,7 @@ public class RemindPane extends JPanel { @Override public void removeLayoutComponent(Component comp) { + // Do nothing } @Override @@ -139,6 +140,7 @@ public class RemindPane extends JPanel { @Override public void addLayoutComponent(String name, Component comp) { + // Do nothing } }; } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 15c6cb705c..50ecd0ea6d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -57,49 +57,6 @@ public class ConnectionListAction extends UpdateAction { osBasedAction.execute(); } - /* private void openDesignDatabaseManager() { - DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); - final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { - public void complete() { - ConnectionConfig connectionConfig = datasourceManager.mirror(); - populate(connectionConfig); - } - - protected void renameConnection(String oldName, String newName) { - datasourceManager.renameConnection(oldName, newName); - } - }; - final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); - databaseListDialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - if (!databaseManagerPane.isNamePermitted()) { - databaseListDialog.setDoOKSucceed(false); - return; - } - Configurations.modify(new WorkerFacade(ConnectionConfig.class) { - @Override - public void run() { - databaseManagerPane.update(datasourceManager); - } - }.addCallBack(new CallBackAdaptor() { - @Override - public boolean beforeCommit() { - //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 - return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog); - } - - @Override - public void afterCommit() { - DesignerContext.getDesignerBean("databasename").refreshBeanElement(); - } - })); - } - }); - databaseListDialog.setVisible(true); - } -*/ - /** * 更新datasourceManager * diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index 7b41f6fd81..d000dbbbb0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -16,7 +16,6 @@ import java.awt.event.ActionEvent; * @since 8.0 */ public class PluginManagerAction extends UpdateAction { - private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; public PluginManagerAction() { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); diff --git a/designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java b/designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java index 69d3a51aa8..8e83255cf3 100644 --- a/designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java +++ b/designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java @@ -16,8 +16,6 @@ import com.fr.design.utils.gui.GUICoreUtils; * 一个层次连续节点. */ public class ContinuousTreeSelectionModel extends DefaultTreeSelectionModel { - public ContinuousTreeSelectionModel() { - } public void addSelectionPaths(TreePath[] paths) { if (paths == null || paths.length == 0) { diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 1e119d27ed..15a7c87c08 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -145,7 +145,6 @@ public interface UIConstants { public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3); - public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png"); public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png"); public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png"); @@ -196,6 +195,7 @@ public interface UIConstants { public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png"); public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png"); public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"); + public static final Icon AUTO_FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/autoForeground.png"); public static final Icon HISTORY_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/history.png"); public static final Icon DELETE_ICON = IOUtils.readIcon("com/fr/design/images/m_file/close.png"); public static final Icon EDIT_ICON = IOUtils.readIcon("com/fr/design/images/m_file/edit.png"); diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 313ca0e2f7..45b3ac6a2a 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -272,10 +272,12 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp */ @Override public void editingCanceled(ChangeEvent e) { + // Do nothing } @Override public void editingStopped(ChangeEvent e) { + // Do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index a84e1337b7..dc7002fa85 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -248,6 +248,15 @@ public abstract class DesignTableDataManager { } } + public static String[] getDsColumnNames(String dsName) { + TableDataSource dataSource = getEditingTableDataSource(); + Map map = columnCache.get(dataSource); + if (map == null) { + return new String[0]; + } + return map.get(dsName); + } + /** * august:返回当前正在编辑的具有报表数据源的模板(基本报表、聚合报表) 包括 : 图表模板 * diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index b734968b36..eda6414671 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -104,10 +104,12 @@ public class ChoosePane extends BasicBeanPane implements Refresha @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + // Do nothing } @Override public void popupMenuCanceled(PopupMenuEvent e) { + // Do nothing } }; @@ -115,10 +117,12 @@ public class ChoosePane extends BasicBeanPane implements Refresha private PopupMenuListener listener = new PopupMenuListener() { @Override public void popupMenuCanceled(PopupMenuEvent e) { + // Do nothing } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + // Do nothing } @Override @@ -200,6 +204,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha } protected void addFocusListener() { + // Do nothing } @SuppressWarnings("unchecked") @@ -493,6 +498,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha } protected void failedToFindTable() { + // Do nothing } protected String getTableName() { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java index 0ca42c0f92..14d0431e25 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java @@ -75,6 +75,7 @@ public class ChoosePaneSupportFormula extends ChoosePane { } protected void addFocusListener() { + // Do nothing } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index c3fd5065df..d2fdc32291 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -69,7 +69,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData } if (nameableList.getSelectedValue() instanceof ListModelElement) { Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper; - if (!ComparatorUtils.equals(tempName, selected.getName())) { + if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) { rename(selected.getName(), tempName); } @@ -256,6 +256,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData } protected void checkRepeatedDSName(List exsitTableDataNameList) { + // Do nothing } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index f6f258285d..4b4d668666 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -98,7 +98,7 @@ public class ConnectionTableProcedurePane extends BasicPane { } protected void addKeyMonitor() { - + //do nothing } protected JPanel createCheckBoxgroupPane() { @@ -137,7 +137,7 @@ public class ConnectionTableProcedurePane extends BasicPane { /** * 给 itemComboBox 加上 itemListener - * + * * @param itemListener */ public void addItemListener(ItemListener itemListener) { @@ -214,7 +214,7 @@ public class ConnectionTableProcedurePane extends BasicPane { public static interface DoubleClickSelectedNodeOnTreeListener { /** * 处理双击事件 - * + * * @param target */ public void actionPerformed(TableProcedure target); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java index 6be5657bbd..575ba43f5b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java @@ -140,8 +140,6 @@ public class PreviewTableModel extends AbstractTableModel { * 就是由于预览的JTable在不停的getRowCount来显示数据. */ private static class ErrorResultSet extends AbstractDataModel { - public ErrorResultSet() { - } public int getRowCount() { return 0; @@ -160,6 +158,7 @@ public class PreviewTableModel extends AbstractTableModel { } public void release() throws Exception { + // Do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java index a3248ba1d8..3336596591 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java @@ -38,6 +38,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel { this.setDefaultEditor(ParameterTableModel.ParameterEditor.class, new ParameterTableModel().new ParameterEditor()); this.setDefaultRenderer(StoreProcedureParameterValueEditor.class, new ProcedureParameterValueRenderer()); } + @Override public boolean isCellEditable(int row, int col) { if (ComparatorUtils.equals(getValueAt(row, col -1), "OUT")) { return false; @@ -48,6 +49,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel { return false; } + @Override public boolean shouldResponseDoubleClickAction () { return false; } @@ -60,7 +62,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel { editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); editor.getMenu().addPopupMenuListener(new PopupMenuListener() { public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - + // Do nothing } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { @@ -77,15 +79,16 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel { }, 100); } + @Override public void popupMenuCanceled(PopupMenuEvent e) { - + //do nothing } }); this.addCellEditorListener(new CellEditorListener() { @Override public void editingCanceled(ChangeEvent e) { - + //do nothing } @Override @@ -147,6 +150,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel { editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { editor.setCurrentEditor(0); editor.populate(value); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java index 7cd8dec3e8..b454ddd89f 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java @@ -57,8 +57,10 @@ public class ClassTableDataPane extends AbstractTableDataPane { (Dialog) SwingUtilities.getWindowAncestor(ClassTableDataPane.this), new DialogActionAdapter() { public void doOk() { - classNameTextField.setText(bPane.getClassPath()); - } + String classPath = bPane.getClassPath(); + ClassTableData tableData = new ClassTableData(classPath); + populateBean(tableData); + } }); dlg.setVisible(true); } @@ -124,6 +126,7 @@ public class ClassTableDataPane extends AbstractTableDataPane { this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); } + @Override public void actionPerformed(ActionEvent e) { java.util.List oldParas = editorPane.update(); oldParas.add(new Parameter()); @@ -132,6 +135,7 @@ public class ClassTableDataPane extends AbstractTableDataPane { @Override public void checkEnabled() { + //do nothing } } private class RemoveParaAction extends UITableEditAction { @@ -149,6 +153,7 @@ public class ClassTableDataPane extends AbstractTableDataPane { @Override public void checkEnabled() { + //do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java index fdf44df23e..3d9fbad2ad 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java @@ -1,22 +1,21 @@ package com.fr.design.data.tabledata.tabledatapane; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; +import com.fr.design.gui.itableeditorpane.ActionStyle; +import com.fr.design.gui.itableeditorpane.UIArrayTableModel; +import com.fr.design.gui.itableeditorpane.UITableEditAction; +import com.fr.design.gui.itableeditorpane.UITableModelAdapter; +import com.fr.design.gui.itextfield.UITextField; import javax.swing.AbstractCellEditor; import javax.swing.JTable; import javax.swing.event.CellEditorListener; import javax.swing.event.ChangeEvent; import javax.swing.table.TableCellEditor; - -import com.fr.design.gui.itableeditorpane.ActionStyle; -import com.fr.design.gui.itableeditorpane.UIArrayTableModel; -import com.fr.design.gui.itableeditorpane.UITableEditAction; -import com.fr.design.gui.itableeditorpane.UITableModelAdapter; -import com.fr.design.gui.itextfield.UITextField; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; public class CustomDictModel extends UITableModelAdapter implements ActionStyle { /** @@ -34,11 +33,13 @@ public class CustomDictModel extends UITableModelAdapter implements Ac this.setDefaultEditor(ParameterEditor.class, new ParameterEditor()); } + @Override public Object getValueAt(int row, int column) { Object[] os = this.getList().get(row); return os[column]; } + @Override public void setValueAt(Object value, int row, int column) { Object[] os = this.getList().get(row); os[column] = value; @@ -104,7 +105,7 @@ public class CustomDictModel extends UITableModelAdapter implements Ac @Override public void editingCanceled(ChangeEvent e) { - + //do nothing } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 44b87cad60..8b5a4e77f9 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -101,10 +101,10 @@ public class DBTableDataPane extends AbstractTableDataPane { @Override protected void addKeyMonitor() { searchField.addKeyListener(new KeyListener() { - + @Override public void keyTyped(KeyEvent e) { - + //do nothing } @Override @@ -117,7 +117,7 @@ public class DBTableDataPane extends AbstractTableDataPane { @Override public void keyReleased(KeyEvent e) { - + //do nothing } }); } @@ -240,7 +240,7 @@ public class DBTableDataPane extends AbstractTableDataPane { maxPanel.setBorder(null); JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); wrapMaxPanel.add(maxPanel); - wrapMaxPanel.setPreferredSize(new Dimension(250, 20)); + wrapMaxPanel.setPreferredSize(new Dimension(350, 20)); UIToolbar editToolBar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(editToolBar); editToolBar.add(isShareCheckBox); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index 5a8e292220..6eb802619f 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -522,6 +522,7 @@ public class FileTableDataPane extends AbstractTableDataPane { @Override public void checkEnabled() { + //do nothing } } @@ -833,7 +834,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } private class XMLNodeTree extends JTree { - private DefaultTreeModel treeModel; + private DefaultTreeModel xmlTreeModel; private DefaultTreeModel waitTreeModel = null; @@ -855,7 +856,7 @@ public class FileTableDataPane extends AbstractTableDataPane { private MouseListener treeMouseListener = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { - if (XMLNodeTree.this.getModel() != treeModel) { + if (XMLNodeTree.this.getModel() != xmlTreeModel) { return; } int selRow = XMLNodeTree.this.getRowForLocation(e.getX(), e.getY()); @@ -892,7 +893,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } public DefaultTreeModel getTreeModel() { - return treeModel; + return xmlTreeModel; } //防止界面卡死。 @@ -909,7 +910,7 @@ public class FileTableDataPane extends AbstractTableDataPane { //wikky:为满足706设计时对不合法的xml文件(有多个根节点)的处理,把拿到的InputStream强制在最外层添加作为唯一根节点而将文件转换为合法的xml。 private void initData() { params = getEditorPaneParameter(); // 生成tree结构放哪儿呢?放这里感觉不对撒 - treeModel = null; + xmlTreeModel = null; selectedNode = null; xmlColumnsList.clear(); DataSource dataSource = null; @@ -950,17 +951,17 @@ public class FileTableDataPane extends AbstractTableDataPane { FineLoggerFactory.getLogger().error(e.getMessage(), e); loadedTreeModel(); } - if (treeModel == null) { + if (xmlTreeModel == null) { FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader."); return; } - if (treeModel.getChildCount(treeModel.getRoot()) == 1) { - treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(), 0)); + if (xmlTreeModel.getChildCount(xmlTreeModel.getRoot()) == 1) { + xmlTreeModel = new DefaultTreeModel((ExpandMutableTreeNode) xmlTreeModel.getChild(xmlTreeModel.getRoot(), 0)); } else { - ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); + ExpandMutableTreeNode root = (ExpandMutableTreeNode) xmlTreeModel.getRoot(); root.setUserObject(StringUtils.EMPTY); } - this.setModel(treeModel); + this.setModel(xmlTreeModel); } private void loadedTreeModel() { @@ -1012,7 +1013,7 @@ public class FileTableDataPane extends AbstractTableDataPane { } currentNode = new ExpandMutableTreeNode(nodeName); if (layer == 0) { - treeModel = new DefaultTreeModel(currentNode); + xmlTreeModel = new DefaultTreeModel(currentNode); } else { boolean conflict = false; for (int i = 0; i < parentNode.getChildCount(); i++) { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java index 4a5b33033a..2cf170c55e 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java @@ -144,12 +144,14 @@ public class MultiTDTableDataPane extends AbstractTableDataPane imp } populateWorker = new SwingWorker() { + @Override protected Void doInBackground() throws Exception { try { storeProcedureContext.setText(StringUtils.EMPTY); @@ -205,6 +206,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp return null; } + @Override public void done() { editorPane.populate(storeprocedure.getParameters()); } @@ -219,6 +221,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp * * @param listener 监听器 */ + @Override public void addStoreProcedureWorkerListener(StoreProcedureWorkerListener listener) { this.storeProcedureWorkerListener = listener; @@ -228,6 +231,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp /** * 去除存储过程监听器 */ + @Override public void removeStoreProcedureWorkerListener() { this.storeProcedureWorkerListener = null; @@ -265,6 +269,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } updateWorker = new SwingWorker() { + @Override protected Void doInBackground() throws Exception { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); sp.setCalculating(true); @@ -272,6 +277,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp return null; } + @Override public void done() { DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); sp.setCalculating(false); @@ -329,6 +335,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp /** * 响应数据集改变 */ + @Override public void fireDSChanged() { fireDSChanged(new HashMap()); } @@ -338,6 +345,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp * * @param map 改变的map */ + @Override public void fireDSChanged(Map map) { DesignTableDataManager.fireDSChanged(map); } @@ -349,6 +357,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); } + @Override public void actionPerformed(ActionEvent evt) { StoreProcedure sp = updateBeanWithOutExecute(); StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText()); @@ -362,12 +371,14 @@ public class ProcedureDataPane extends AbstractTableDataPane imp this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); } + @Override public void actionPerformed(ActionEvent e) { refresh(); } @Override public void checkEnabled() { + //do nothing } } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java index 7c484c7b29..c55e5871ee 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java @@ -33,9 +33,16 @@ public class TableDataManagerPane extends LoadingBasicPane { ); } tableDataPane = pane == null ? new TableDataPaneListPane() { - public void rename(String oldName, String newName) { + @Override + public void rename(final String oldName, final String newName) { super.rename(oldName, newName); - renameConnection(oldName, newName); + new SwingWorker() { + @Override + protected Void doInBackground() { + renameConnection(oldName, newName); + return null; + } + }.execute(); } } : pane; container.add(tableDataPane.getPanel(), BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java index 812eb25af3..82022bea60 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java @@ -50,10 +50,11 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); TableDataSource tds = adapter == null ? null : adapter.getBook(); String[] colNames = tabledata.getColumnNames(tds); + String[] colNamesInCache = DesignTableDataManager.getDsColumnNames(name); if(ArrayUtils.isNotEmpty(colNames)){ - columnNameList = new ArrayList(); - columnNameList.addAll(Arrays.asList(colNames)); - return columnNameList; + return toColumnNameList(colNames); + } else if (ArrayUtils.isNotEmpty(colNamesInCache)) { + return toColumnNameList(colNamesInCache); } EmbeddedTableData embeddedTableData = null; @@ -69,6 +70,12 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { return columnNameList; } + private List toColumnNameList(String[] colNames) { + columnNameList = new ArrayList<>(); + columnNameList.addAll(Arrays.asList(colNames)); + return columnNameList; + } + /** * 生成子节点 * diff --git a/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java index 1a01a8641b..f035d7e418 100644 --- a/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java +++ b/designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java @@ -27,6 +27,6 @@ public class UniversalDatabaseDialog extends UIDialog { @Override public void checkValid() throws Exception { - + //do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/designer/EditingState.java b/designer-base/src/main/java/com/fr/design/designer/EditingState.java index 3f4fdf6f05..8bd46d4bdb 100644 --- a/designer-base/src/main/java/com/fr/design/designer/EditingState.java +++ b/designer-base/src/main/java/com/fr/design/designer/EditingState.java @@ -7,6 +7,7 @@ public interface EditingState { @Override public void revert() { + //do nothing } }; diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java index d67b05d268..0255748979 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java @@ -121,12 +121,12 @@ public abstract class BasicScrollPane extends BasicBeanPane{ @Override public void addLayoutComponent(String name, Component comp) { - + //do nothing } @Override public void removeLayoutComponent(Component comp) { - + //do nothing } @Override diff --git a/designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java b/designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java new file mode 100644 index 0000000000..21042a57a9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java @@ -0,0 +1,94 @@ +package com.fr.design.dialog; + +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.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; + +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/1/8 + */ +public abstract class ErrorDialog extends JDialog implements ActionListener { + + private UIButton okButton; + private UIButton restartButton; + + + public ErrorDialog(Frame parent, String message, String title, String detail) { + super(parent, true); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + UILabel boldFontLabel = new UILabel(message); + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us")); + Font font = FRFont.getInstance("Dialog", Font.BOLD, 20); + boldFontLabel.setFont(font); + messagePane.add(boldFontLabel); + messagePane.add(label); + northPane.add(messagePane); + + JTextArea area = new JTextArea(detail); + area.setPreferredSize(new Dimension(400, 100)); + area.setEnabled(true); + area.setEditable(false); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message")); + centerPane.add(detailLabel, BorderLayout.NORTH); + centerPane.add(area, BorderLayout.CENTER); + + JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); + okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Ok")); + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + okEvent(); + } + }); + buttonPane.add(okButton); + restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Restart")); + restartButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + restartEvent(); + } + }); + buttonPane.add(restartButton); + controlPane.add(buttonPane, BorderLayout.EAST); + southPane.add(controlPane); + + this.setTitle(title); + this.setResizable(false); + this.add(northPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + this.add(southPane, BorderLayout.SOUTH); + this.setSize(new Dimension(600, 500)); + GUICoreUtils.centerWindow(this); + + } + + @Override + public void actionPerformed(ActionEvent e) { + dispose(); + } + + protected abstract void okEvent(); + + protected abstract void restartEvent(); + +} diff --git a/designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java b/designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java index 95894bd014..891e1bf757 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java @@ -363,5 +363,6 @@ public class JWizardDialog extends BasicDialog { @Override public void checkValid() throws Exception { + //do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java index ce3a2f9da6..c4762f2557 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java +++ b/designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java @@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane { public void addNotify() { if (firstNotify) { Font font = stepTitleLabel.getFont(); - font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F); + font = font.deriveFont(Font.BOLD, (float) (font.getSize() * 14 / 10.0D)); stepTitleLabel.setFont(font); firstNotify = false; } diff --git a/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java b/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java new file mode 100644 index 0000000000..35f9c3c0fb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/TipDialog.java @@ -0,0 +1,98 @@ +package com.fr.design.dialog; + +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.utils.gui.GUICoreUtils; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/1/8 + */ +public abstract class TipDialog extends JDialog implements ActionListener { + + private UIButton endButton; + private UIButton cancelButton; + + public TipDialog(Frame parent, String type, String tip, String endText, String cancelText) { + super(parent, true); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel iconPane = new JPanel(); + UILabel iconLabel = new UILabel(); + iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error2.png")); + iconPane.add(iconLabel); + iconPane.setPreferredSize(new Dimension(50, 50)); + JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + UILabel tipLabel = new UILabel(tip); + tipPane.add(tipLabel); + northPane.add(iconPane, BorderLayout.WEST); + northPane.add(tipPane, BorderLayout.CENTER); + + JTextPane area = new JTextPane(); + UILabel typeLabel = new UILabel(type); + area.insertComponent(typeLabel); + if (StringUtils.isNotEmpty(type)) { + UILabel logoIconLabel = new UILabel(); + logoIconLabel.setIcon(IOUtils.readIcon("com/fr/base/images/oem/logo.png")); + area.insertComponent(logoIconLabel); + } + area.setPreferredSize(new Dimension(400, 100)); + area.setEnabled(true); + area.setEditable(false); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + centerPane.add(area); + + JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0)); + endButton = new UIButton(endText); + endButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + endEvent(); + } + }); + buttonPane.add(endButton); + cancelButton = new UIButton(cancelText); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cancelEvent(); + } + }); + buttonPane.add(cancelButton); + controlPane.add(buttonPane, BorderLayout.EAST); + southPane.add(controlPane); + + this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Error_Tittle")); + this.setResizable(false); + this.add(northPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + this.add(southPane, BorderLayout.SOUTH); + this.setSize(new Dimension(600, 500)); + GUICoreUtils.centerWindow(this); + + } + + protected abstract void endEvent(); + + protected abstract void cancelEvent(); + + @Override + public void actionPerformed(ActionEvent e) { + dispose(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java index 9258ce589c..80c545e922 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java @@ -1,18 +1,17 @@ package com.fr.design.editor.editor; -import java.awt.BorderLayout; -import java.awt.Component; - -import javax.swing.JList; -import javax.swing.event.PopupMenuEvent; -import javax.swing.event.PopupMenuListener; - import com.fr.design.DesignModelAdapter; -import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.FilterComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.js.WidgetName; +import javax.swing.JList; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import java.awt.BorderLayout; +import java.awt.Component; + /** * the editor to edit WidgetName * @@ -43,12 +42,12 @@ public class WidgetNameEditor extends Editor { @Override public void popupMenuCanceled(PopupMenuEvent e) { - + //do nothing } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - + //do nothing } @Override diff --git a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java index 1174a8a73b..288f6baa30 100644 --- a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java +++ b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java @@ -1,15 +1,40 @@ package com.fr.design.env; +import com.fr.common.report.ReportState; +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.EnvChangeEntrance; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector; +import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.process.ProcessEventPipe; +import com.fr.process.engine.core.CarryMessageEvent; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceClient; +import javax.swing.*; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + /** * 根据配置生成运行环境 */ public class DesignerWorkspaceGenerator { - public static Workspace generate(DesignerWorkspaceInfo config) throws Exception { + private static final int WAIT_FREQ = 60; + private static ExecutorService service = Executors.newCachedThreadPool( + new NamedThreadFactory("DesignerWorkspaceGenerator")); + + public static Workspace generate(final DesignerWorkspaceInfo config) throws Exception { if (config == null || config.getType() == null) { return null; @@ -22,7 +47,19 @@ public class DesignerWorkspaceGenerator { break; } case Remote: { - WorkspaceClient client = WorkContext.getConnector().connect(config.getConnection()); + Future future = service.submit(new Callable() { + @Override + public WorkspaceClient call() throws Exception { + return WorkContext.getConnector().connect(config.getConnection()); + } + }); + WorkspaceClient client = null; + try { + client = future.get(WAIT_FREQ, TimeUnit.SECONDS); + } catch (TimeoutException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + RemoteHandler.handle(config); + } if (client != null) { workspace = new RemoteWorkspace(client, config.getConnection()); } @@ -31,4 +68,36 @@ public class DesignerWorkspaceGenerator { } return workspace; } + + enum RemoteHandler { + SELF; + public static void handle(DesignerWorkspaceInfo config) { + ProcessEventPipe eventPipe = FineProcessContext.getParentPipe(); + if (eventPipe != null) { + eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); + } + StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getId(), + DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getMessage(), + StringUtils.EMPTY); + int result = FineJOptionPane.showOptionDialog(null, + Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Tip"), + Toolkit.i18nText("Fine-Design_Basic_Error_Tittle"), + JOptionPane.YES_NO_OPTION, + JOptionPane.ERROR_MESSAGE, + IOUtils.readIcon("com/fr/design/images/error/error2.png"), + new Object[] {Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Wait"), Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Switch")}, + null); + if (result == JOptionPane.YES_OPTION) { + try { + generate(config); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + } + + public static void stop() { + service.shutdown(); + } } diff --git a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java index 2e5cc9f8c0..ccc98bfe37 100644 --- a/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java @@ -10,6 +10,9 @@ public interface DesignerWorkspaceInfo extends XMLable { String getPath(); + //获取提醒时间,用于判断是否做服务检测 + String getRemindTime(); + WorkspaceConnectionInfo getConnection(); boolean checkValid(); diff --git a/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java index efba8a2dfa..ef1f420d62 100644 --- a/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java @@ -43,6 +43,11 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo { return path; } + @Override + public String getRemindTime() { + return null; + } + @Override public WorkspaceConnectionInfo getConnection() { return null; @@ -64,7 +69,9 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo { writer.attr("path", path); } + @Override + @SuppressWarnings("squid:S2975") public Object clone() throws CloneNotSupportedException { LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone(); diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java index cf7f3f9405..af0b8a01c0 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java @@ -13,6 +13,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { private String name; + private String remindTime; + private WorkspaceConnectionInfo connection; public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) { @@ -45,11 +47,21 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { return connection; } + public void setRemindTime(String remindTime){ + this.remindTime = remindTime; + } + + @Override + public String getRemindTime(){ + return remindTime; + } + @Override public void readXML(XMLableReader reader) { if (reader.isAttr()) { this.name = reader.getAttrAsString("name", StringUtils.EMPTY); + this.remindTime = reader.getAttrAsString("remindTime", StringUtils.EMPTY); } if (reader.isChildNode()) { String tagName = reader.getTagName(); @@ -69,6 +81,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { public void writeXML(XMLPrintWriter writer) { writer.attr("name", name); + writer.attr("remindTime", remindTime); if (this.connection != null) { writer.startTAG("Connection"); writer.attr("url", connection.getUrl()); @@ -81,6 +94,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo { } @Override + @SuppressWarnings("squid:S2975") public Object clone() throws CloneNotSupportedException { RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone(); diff --git a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java index c0319f9357..3d96ea1efc 100644 --- a/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java @@ -1,7 +1,10 @@ package com.fr.design.env; -import com.fr.cluster.engine.base.FineClusterConfig; +import com.fr.cluster.engine.remote.ClusterOperator; import com.fr.design.i18n.Toolkit; +import com.fr.base.operator.common.CommonOperator; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; @@ -9,6 +12,8 @@ import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.server.authority.decision.DecisionOperator; +import com.fr.workspace.engine.rpc.WorkspaceProxyPool; +import com.fr.workspace.pool.WorkObjectPool; /** * Created by juhaoyu on 2018/6/14. @@ -45,8 +50,12 @@ public class RemoteWorkspace implements Workspace { @Override public boolean isWarDeploy() { - - return false; + return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler() { + @Override + public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { + return false; + } + }).isWarDeploy(); } @Override @@ -70,7 +79,12 @@ public class RemoteWorkspace implements Workspace { @Override public boolean isCluster() { - return FineClusterConfig.getInstance().isCluster(); + return WorkContext.getCurrent().get(ClusterOperator.class, new ExceptionHandler() { + @Override + public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) { + return false; + } + }).isCluster(); } @Override @@ -84,6 +98,19 @@ public class RemoteWorkspace implements Workspace { return client.getPool().get(type); } + + @Override + public T get(Class type, ExceptionHandler exceptionHandler){ + if(exceptionHandler != null) { + WorkObjectPool objectPool = client.getPool(); + if (objectPool instanceof WorkspaceProxyPool) { + return ((WorkspaceProxyPool) objectPool).get(type, exceptionHandler); + }else { + return client.getPool().get(type); + } + } + return client.getPool().get(type); + } @Override public void close() { @@ -102,4 +129,8 @@ public class RemoteWorkspace implements Workspace { return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection); } + + public WorkspaceClient getClient(){ + return client; + } } diff --git a/designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java b/designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java index ba8950ec2b..5599c75535 100644 --- a/designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java +++ b/designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java @@ -10,10 +10,10 @@ package com.fr.design.extra; public class AppStoreBuilder { public void checkStoreJavaSciptVersion() { - + //do nothing } public void updateStoreJavaScript() { - + //do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginDialog.java b/designer-base/src/main/java/com/fr/design/extra/LoginDialog.java index 33983baf21..42791ad522 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginDialog.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginDialog.java @@ -4,12 +4,8 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StableUtils; -import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.Frame; +import javax.swing.*; +import java.awt.*; /** * Created by vito on 2017/5/5. @@ -41,5 +37,6 @@ public class LoginDialog extends UIDialog { @Override public void checkValid() throws Exception { + // do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java index 50add423f4..471e25109a 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java @@ -14,10 +14,8 @@ import javafx.concurrent.Task; import javafx.scene.web.WebEngine; import netscape.javascript.JSObject; -import javax.swing.JDialog; -import javax.swing.SwingUtilities; -import java.awt.Color; -import java.awt.Desktop; +import javax.swing.*; +import java.awt.*; import java.net.URI; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -221,5 +219,6 @@ public class LoginWebBridge { } public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { + // do nothing } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java index 0eb1144665..3f06ffb9cf 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; - import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; @@ -88,7 +87,7 @@ public abstract class PluginAbstractLoadingViewPane extends PluginAbstract @Override public void pressInstallButton() { - + // do nothing } @Override diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java index e5b4feba28..312d833471 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.ilist.UIList; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.IOUtils; - import com.fr.plugin.context.PluginMarker; import com.fr.plugin.license.Licensed; import com.fr.plugin.manage.PluginManager; @@ -23,7 +22,7 @@ import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; -import java.util.*; +import java.util.ArrayList; import java.util.List; /** @@ -155,7 +154,7 @@ public class PluginControlPane extends BasicPane { PluginManager.getController().uninstall(PluginMarker.create(id, version), true, new PluginTaskCallback() { @Override public void done(PluginTaskResult result) { - + // do nothing } }); } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java b/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java index f3dcec231d..5f76dbafca 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java @@ -14,11 +14,7 @@ import com.fr.plugin.manage.control.ProgressCallback; import com.fr.plugin.view.PluginView; import com.fr.stable.StringUtils; -import javax.swing.JComponent; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.SwingConstants; +import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.io.File; import java.util.List; @@ -99,7 +95,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane config; private WebEngine webEngine; @@ -94,10 +94,10 @@ public class PluginWebBridge { * @return 配置信息 */ public String getRunConfig() { - if (action != null) { + if (actions != null) { JSONObject jsonObject = new JSONObject(); try { - jsonObject.put(ACTION, action.getContext()); + jsonObject.put(ACTION, actions.getContext()); Set keySet = config.keySet(); for (String key : keySet) { jsonObject.put(key, config.get(key).toString()); @@ -117,7 +117,7 @@ public class PluginWebBridge { * @param config 参数 */ public void setRunConfig(ACTIONS action, Map config) { - this.action = action; + this.actions = action; this.config = config; } @@ -125,7 +125,7 @@ public class PluginWebBridge { * 清楚打开动作 */ public void clearRunConfig() { - this.action = null; + this.actions = null; this.config = null; } diff --git a/designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java b/designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java index 4773aff689..3ba60054f2 100644 --- a/designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java +++ b/designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java @@ -3,7 +3,6 @@ package com.fr.design.extra; import com.fr.design.dialog.UIDialog; import com.fr.design.utils.gui.GUICoreUtils; - import javax.swing.*; import java.awt.*; @@ -27,6 +26,7 @@ public class QQLoginDialog extends UIDialog { @Override public void checkValid() throws Exception { + // do nothing } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java b/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java index e2fb97b627..72fa6149b6 100644 --- a/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java +++ b/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java @@ -29,5 +29,6 @@ public class ShopDialog extends UIDialog { @Override public void checkValid() throws Exception { + // do nothing } } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 6568f458d7..f8b089fe6a 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -407,8 +407,7 @@ public class HistoryTemplateListCache implements CallbackEvent { JTemplate jt = getCurrentEditingTemplate(); boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); if (access) { - closeSelectedReport(jt); - DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE()); + jt.refreshResource(); } } diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index f132cec344..e4ab990337 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -22,26 +22,9 @@ import com.fr.third.javax.annotation.Nonnull; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; -import javax.swing.BorderFactory; -import javax.swing.ButtonModel; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSeparator; +import javax.swing.*; import javax.swing.plaf.basic.BasicMenuItemUI; -import java.awt.AWTEvent; -import java.awt.AlphaComposite; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GradientPaint; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; +import java.awt.*; import java.awt.event.AWTEventListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -399,8 +382,8 @@ public class MutilTempalteTabPane extends JComponent { //画下面的那条线 if (templateStartX < maxWidth) { GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); - generalPath.moveTo((float) templateStartX, getHeight() - 1.0F); - generalPath.lineTo((float) maxWidth, getHeight() - 1.0F); + generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D)); + generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D)); g2d.fill(generalPath); //TODO hzzz delete // g2d.setPaint(UIConstants.LINE_COLOR); @@ -410,7 +393,7 @@ public class MutilTempalteTabPane extends JComponent { private void paintDefaultBackground(Graphics2D g2d) { //画默认背景 - g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND)); g2d.fillRect(0, 0, getWidth(), getHeight()); } @@ -536,7 +519,7 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB)); //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 double specialLocation1 = 2.5; double specialLocation2 = 4.330127; @@ -591,9 +574,9 @@ public class MutilTempalteTabPane extends JComponent { double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE)); } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY)); + g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY)); } @@ -855,7 +838,7 @@ public class MutilTempalteTabPane extends JComponent { */ @Override public void mouseEntered(MouseEvent e) { - + // do nothing } /** @@ -878,6 +861,7 @@ public class MutilTempalteTabPane extends JComponent { */ @Override public void mouseReleased(MouseEvent e) { + // do nothing } /** @@ -887,6 +871,7 @@ public class MutilTempalteTabPane extends JComponent { */ @Override public void mouseClicked(MouseEvent e) { + // do nothing } /** @@ -958,6 +943,7 @@ public class MutilTempalteTabPane extends JComponent { */ @Override public void mouseDragged(MouseEvent e) { + // do nothing } /** diff --git a/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java b/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java index a1082b62f9..c3b8d3e4d5 100644 --- a/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java +++ b/designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java @@ -135,7 +135,7 @@ public class NodeAuthProcessor { * @param fileNode file nodes * @return 带权限信息的文件节点 */ - public boolean fixFileNodeAuth(FileNode fileNode) { + public boolean checkFileNodeAuth(FileNode fileNode) { boolean isLocal = WorkContext.getCurrent().isLocal(); boolean isRoot = WorkContext.getCurrent().isRoot(); diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index dd8b5ab521..32e7030bb6 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -29,17 +29,7 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.script.Expression; -import javax.swing.BorderFactory; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JTree; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TreeSelectionEvent; @@ -49,10 +39,7 @@ import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreePath; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -150,10 +137,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { keyWordTextField.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { + //do nothing } @Override public void keyReleased(KeyEvent e) { + //do nothing } @Override @@ -238,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected void extendCheckBoxPane(JPanel checkBoxPane) { - + // do nothing } private void configFormulaArea() { @@ -414,6 +403,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { @Override public void keyTyped(KeyEvent e) { + // do nothing } protected void search(String keyWord, boolean findDescription) { diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java b/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java index 3d56dd925e..c40a917e39 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java @@ -142,8 +142,10 @@ public class FunctionManagerPane extends BasicPane { editorButton.setPreferredSize(new Dimension(editorButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); reportletNamePane.add(editorButton); editorButton.addActionListener(createEditorButtonActionListener()); - northPane.add(GUICoreUtils.createFlowPane(new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), - reportletNamePane}, FlowLayout.LEFT)); + JPanel classNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + classNamePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), BorderLayout.NORTH); + classNamePane.add(reportletNamePane, BorderLayout.CENTER); + northPane.add(classNamePane); DescriptionTextArea descriptionArea = new DescriptionTextArea(); descriptionArea.setWrapStyleWord(true); descriptionArea.setLineWrap(true); diff --git a/designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java b/designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java new file mode 100644 index 0000000000..d00138effb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java @@ -0,0 +1,23 @@ +package com.fr.design.fun; + +import com.fr.common.annotations.Open; +import com.fr.stable.fun.mark.Mutable; + +import java.util.List; + +/** + * Created by kerry on 2019-11-11 + */ +@Open +public interface MultiStyleUIConfigProvider extends Mutable { + String XML_TAG = "MultiStyleUIConfigProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 获取配置项list + * + * @return 配置项list + */ + List getConfigList(); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java b/designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java new file mode 100644 index 0000000000..a28d276df2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java @@ -0,0 +1,39 @@ +package com.fr.design.fun; + +import com.fr.base.Style; +import com.fr.common.annotations.Open; +import com.fr.stable.fun.mark.Mutable; + +import javax.swing.JComponent; +import javax.swing.event.ChangeListener; + +/** + * Created by kerry on 2019-11-11 + */ +@Open +public interface StyleUIConfigProvider extends Mutable { + String XML_TAG = "CustomStyleUIConfigProvider"; + + int CURRENT_LEVEL = 1; + + /** + * @return 配置名 + */ + String configName(); + + /** + * @param changeListener 需要添加的listener + * @return 对应的component + */ + JComponent uiComponent(ChangeListener changeListener); + + /** + * @return 更新后的样式 + */ + Style updateConfig(); + + /** + * @param style 待渲染的样式 + */ + void populateConfig(Style style); +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java new file mode 100644 index 0000000000..260d4099bf --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java @@ -0,0 +1,26 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.StyleUIConfigProvider; +import com.fr.design.fun.MultiStyleUIConfigProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by kerry on 2019-11-11 + */ +@API(level = MultiStyleUIConfigProvider.CURRENT_LEVEL) +public abstract class AbstractMultiStyleUIConfigProvider extends AbstractProvider implements MultiStyleUIConfigProvider { + @Override + public List getConfigList() { + return new ArrayList(); + } + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java new file mode 100644 index 0000000000..e3388feaf7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java @@ -0,0 +1,41 @@ +package com.fr.design.fun.impl; + +import com.fr.base.Style; +import com.fr.design.fun.StyleUIConfigProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import javax.swing.JComponent; +import javax.swing.event.ChangeListener; + +/** + * Created by kerry on 2019-11-11 + */ +@API(level = StyleUIConfigProvider.CURRENT_LEVEL) +public class AbstractStyleUIConfigProvider extends AbstractProvider implements StyleUIConfigProvider { + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String configName() { + return StringUtils.EMPTY; + } + + @Override + public JComponent uiComponent(ChangeListener changeListener) { + return null; + } + + @Override + public Style updateConfig() { + return null; + } + + @Override + public void populateConfig(Style style) { + + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java index 4bb286dbc0..ebe41b2bc7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java @@ -1,10 +1,13 @@ package com.fr.design.gui.controlpane; +import com.fr.design.DesignerEnvManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane; import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; +import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; @@ -99,6 +102,15 @@ class JControlUpdatePane extends JPanel { if (pane != null && pane.isVisible()) { Object bean = pane.updateBean(); + try { + if (bean instanceof RemoteDesignerWorkspaceInfo) { + DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName()); + String remindTime = info.getRemindTime(); + ((RemoteDesignerWorkspaceInfo) bean).setRemindTime(remindTime); + } + }catch (Exception e){ + FineLoggerFactory.getLogger().info("remindTime is not exist"); + } if (i < creators.length) { creators[i].saveUpdatedBean(elEditing, bean); } diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index c97b671dec..c21b740c43 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -437,18 +437,18 @@ public class UICalendarPanel extends JPanel { }; } - protected EventListenerList listenerList = new EventListenerList(); + protected EventListenerList eventlistenerList = new EventListenerList(); public void addDateChangeListener(ChangeListener l) { - listenerList.add(ChangeListener.class, l); + eventlistenerList.add(ChangeListener.class, l); } public void removeDateChangeListener(ChangeListener l) { - listenerList.remove(ChangeListener.class, l); + eventlistenerList.remove(ChangeListener.class, l); } protected void fireDateChanged(ChangeEvent e) { - Object[] listeners = listenerList.getListenerList(); + Object[] listeners = eventlistenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ChangeListener.class) { ((ChangeListener) listeners[i + 1]).stateChanged(e); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java index d95740798b..5798a864b0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java @@ -330,7 +330,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI { g.drawLine(x + 1, y + h - 2, x + w - 3, y + h - 2); // bottom } + @Override protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) { + // do nothing } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java index 798b79af08..bab3e8851c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java @@ -133,14 +133,17 @@ public abstract class UnitInputPane extends BasicPane { @Override public void keyTyped(KeyEvent arg0) { + // 敲击键盘,发生在按键按下后,按键放开前 } @Override public void keyReleased(KeyEvent arg0) { + // 松开按键时 } @Override public void keyPressed(KeyEvent arg0) { + // 按下按键时 changed = true; } }; @@ -149,23 +152,28 @@ public abstract class UnitInputPane extends BasicPane { @Override public void mouseReleased(MouseEvent arg0) { + // 鼠标按键在组件上释放时 } @Override public void mousePressed(MouseEvent arg0) { + // 鼠标按键在组件上按下时 changed = true; } @Override public void mouseExited(MouseEvent arg0) { + // 鼠标离开组件时 } @Override public void mouseEntered(MouseEvent arg0) { + // 鼠标进入到组件时 } @Override public void mouseClicked(MouseEvent arg0) { + // 鼠标按键在组件上单击时 } }; } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java index 338cbac7ef..c423ac582b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java @@ -25,6 +25,8 @@ public class SpecialUIButton extends JButton { * * @see javax.swing.AbstractButton#setUI(ButtonUI) */ + @Override public void setUI(ButtonUI ui) { + // do nothing } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java index 64db1e91da..87aae662bd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java @@ -43,6 +43,7 @@ public class UIBasicButtonUI extends MetalButtonUI { private boolean isDefault; public UIBasicButtonUI() { + // do nothing } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java index 86fc564384..28f5830619 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java @@ -24,10 +24,10 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver { - private static final int SIZE = 16; - private static final int SIZE_2 = 2; - private static final int SIZE_4 = 4; - private static final int SIZE_6 = 6; + public static final int SIZE = 16; + public static final int SIZE_2 = 2; + public static final int SIZE_4 = 4; + public static final int SIZE_6 = 6; private static final int POPUP_MENU_SHIFT = -70; private Color color = Color.BLACK; private ColorControlWindow popupWin; @@ -53,6 +53,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G iniListener(); } + public ColorControlWindow getPopupWin() { + return popupWin; + } + + public void setPopupWin(ColorControlWindow popupWin) { + this.popupWin = popupWin; + } + private void iniListener() { if (shouldResponseChangeListener()) { this.addColorChangeListener(new ChangeListener() { @@ -103,8 +111,12 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G if (ComparatorUtils.equals(this.color, color)) { return; } - + Color oldColor = this.color; this.color = color; + checkColorChange(oldColor, this.color); + } + + protected void checkColorChange(Color oldColor, Color newColor) { hidePopupMenu(); fireColorStateChanged(); } @@ -139,7 +151,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G repaint(); } - private ColorControlWindow getColorControlWindow() { + protected ColorControlWindow getColorControlWindow() { //find parant. if (this.popupWin == null) { this.popupWin = new ColorControlWindow(UIColorButton.this) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java new file mode 100644 index 0000000000..a7dcad008a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java @@ -0,0 +1,38 @@ +package com.fr.design.gui.ibutton; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.constants.UIConstants; +import com.fr.design.style.color.ColorControlWindow; +import com.fr.design.style.color.ColorControlWindowWithAuto; +import com.fr.general.ComparatorUtils; + +import java.awt.Color; + +public class UIColorButtonWithAuto extends UIColorButton { + + protected void checkColorChange(Color oldColor, Color newColor) { + if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { + setIcon(UIConstants.FONT_ICON); + } + + if (!ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { + setIcon(UIConstants.AUTO_FONT_ICON); + } + + super.checkColorChange(oldColor, newColor); + } + + protected ColorControlWindow getColorControlWindow() { + if (getPopupWin() == null) { + ColorControlWindowWithAuto colorControlWindowWithAuto = new ColorControlWindowWithAuto(UIColorButtonWithAuto.this) { + protected void colorChanged() { + UIColorButtonWithAuto.this.setColor(this.getColor()); + } + }; + + setPopupWin(colorControlWindowWithAuto); + } + + return getPopupWin(); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java index 4efd505890..4a24c8de25 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java @@ -18,11 +18,11 @@ public class UICombinationButton extends JPanel{ protected UIButton rightButton; protected void leftButtonClickEvent() { - + // 左边按钮点击事件 } protected void rightButtonClickEvent() { - + // 右边按钮点击事件 } public UICombinationButton() { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java index edbc013405..e21f4c2170 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java @@ -25,7 +25,7 @@ public class UIHeadGroup extends JPanel { protected int selectedIndex = -1; protected void tabChanged(int newSelectedIndex) { - + // do nothing } public UIHeadGroup(String[] textArray) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java index 8d26b5e875..8963119a04 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java @@ -1 +1 @@ -package com.fr.design.gui.ibutton; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import javax.swing.*; /** * Author : Shockway * Date: 13-10-21 * Time: 下午3:23 */ public class UIPasswordField extends JPasswordField implements UIObserver { public void registerChangeListener(UIObserverListener listener) { } public boolean shouldResponseChangeListener() { return false; } } \ No newline at end of file +package com.fr.design.gui.ibutton; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import javax.swing.*; /** * Author : Shockway * Date: 13-10-21 * Time: 下午3:23 */ public class UIPasswordField extends JPasswordField implements UIObserver { public void registerChangeListener(UIObserverListener listener) { // do nothing } public boolean shouldResponseChangeListener() { return false; } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java index a5f9de9b70..50bbc1440d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java @@ -1 +1 @@ -package com.fr.design.gui.ibutton; import com.fr.design.constants.UIConstants; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Author : daisy * Date: 13-8-1 * Time: 下午3:41 */ public class UIPreviewButton extends JPanel { private static final int START_X = -7; protected UIButton upButton; protected UIButton downButton; protected void upButtonClickEvent() { } protected void downButtonClickEvent() { } public UIPreviewButton() { this(new UIButton(), new UIButton()); } public UIPreviewButton(UIButton up, UIButton down) { upButton = up; downButton = down; upButton.setRoundBorder(true, Constants.CENTER); downButton.setRoundBorder(true, Constants.CENTER); upButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { downButton.getModel().setPressed(true); downButton.getModel().setSelected(true); downButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { downButton.getModel().setPressed(false); downButton.getModel().setSelected(false); downButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { upButtonClickEvent(); } }); downButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { upButton.getModel().setPressed(true); upButton.getModel().setSelected(true); upButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { upButton.getModel().setPressed(false); upButton.getModel().setSelected(false); upButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { downButtonClickEvent(); } }); this.setLayout(new FlowLayout(FlowLayout.CENTER,5,0)); this.add(upButton); this.add(downButton); } public UIPreviewButton(Icon left, Icon right) { this(); upButton.setIcon(left); downButton.setIcon(right); } public UIButton getUpButton() { return upButton; } public void setExtraPainted(boolean isExtraPainted) { if (!isExtraPainted) { upButton.setBackground(null); downButton.setBackground(null); upButton.setOpaque(false); downButton.setOpaque(false); } } public UIButton getDownButton() { return downButton; } public void set4Toolbar() { upButton.setNormalPainted(false); downButton.setNormalPainted(false); upButton.setBorderPaintedOnlyWhenPressed(true); downButton.setBorderPaintedOnlyWhenPressed(true); } protected void showPopWindow(JPopupMenu menu) { GUICoreUtils.showPopupMenu(menu, this, START_X, getY() + getHeight() - 3); } public static void main(String... args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); content.setLayout(null); UIPreviewButton bb = new UIPreviewButton(UIConstants.PAGE_BIG_ICON, UIConstants.PREVIEW_DOWN); bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); content.add(bb); GUICoreUtils.centerWindow(jf); jf.setSize(100, 100); jf.setVisible(true); } } \ No newline at end of file +package com.fr.design.gui.ibutton; import com.fr.design.constants.UIConstants; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Author : daisy * Date: 13-8-1 * Time: 下午3:41 */ public class UIPreviewButton extends JPanel { private static final int START_X = -7; protected UIButton upButton; protected UIButton downButton; protected void upButtonClickEvent() { // do nothing } protected void downButtonClickEvent() { // do nothing } public UIPreviewButton() { this(new UIButton(), new UIButton()); } public UIPreviewButton(UIButton up, UIButton down) { upButton = up; downButton = down; upButton.setRoundBorder(true, Constants.CENTER); downButton.setRoundBorder(true, Constants.CENTER); upButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { downButton.getModel().setPressed(true); downButton.getModel().setSelected(true); downButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { downButton.getModel().setPressed(false); downButton.getModel().setSelected(false); downButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { upButtonClickEvent(); } }); downButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { upButton.getModel().setPressed(true); upButton.getModel().setSelected(true); upButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { upButton.getModel().setPressed(false); upButton.getModel().setSelected(false); upButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { downButtonClickEvent(); } }); this.setLayout(new FlowLayout(FlowLayout.CENTER,5,0)); this.add(upButton); this.add(downButton); } public UIPreviewButton(Icon left, Icon right) { this(); upButton.setIcon(left); downButton.setIcon(right); } public UIButton getUpButton() { return upButton; } public void setExtraPainted(boolean isExtraPainted) { if (!isExtraPainted) { upButton.setBackground(null); downButton.setBackground(null); upButton.setOpaque(false); downButton.setOpaque(false); } } public UIButton getDownButton() { return downButton; } public void set4Toolbar() { upButton.setNormalPainted(false); downButton.setNormalPainted(false); upButton.setBorderPaintedOnlyWhenPressed(true); downButton.setBorderPaintedOnlyWhenPressed(true); } protected void showPopWindow(JPopupMenu menu) { GUICoreUtils.showPopupMenu(menu, this, START_X, getY() + getHeight() - 3); } public static void main(String... args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); content.setLayout(null); UIPreviewButton bb = new UIPreviewButton(UIConstants.PAGE_BIG_ICON, UIConstants.PREVIEW_DOWN); bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); content.add(bb); GUICoreUtils.centerWindow(jf); jf.setSize(100, 100); jf.setVisible(true); } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java index 6a92f5057b..6b406588b6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java @@ -176,11 +176,11 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1f, UIConstants.AUTHORITY_DARK_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.AUTHORITY_DARK_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); + gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1F, UIConstants.SELECT_TAB); }else{ - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); @@ -189,11 +189,11 @@ public class UISliderButtonUI extends BasicButtonUI { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { GradientPaint gp; if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { - gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); + gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.HOVER_BLUE); } else if (isPressedPainted) { - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); }else { - gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); + gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER); } fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); } @@ -225,4 +225,4 @@ public class UISliderButtonUI extends BasicButtonUI { g2d.setColor(oldColor); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java index 4e50dd9942..aa5c34f60b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java @@ -162,12 +162,12 @@ public class UITabButton extends UILabel implements UISelectedComponent { Color blue = UIConstants.LIGHT_BLUE; g2d.setColor(blue); g2d.fillRect(0, 1, w - 1, h / 2); - GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1, blue); + GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1F, blue); g2d.setPaint(gp); g2d.fillRect(0, h / 2, w - 1, h / 2); this.setForeground(UIConstants.FONT_COLOR); } else if (!isSelected() && !isRollover) { - GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1, DOWN); + GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1F, DOWN); g2d.setPaint(gp); g2d.fillRect(0, h / 2, w - 1, h / 2); this.setForeground(UIConstants.FONT_COLOR); @@ -175,7 +175,7 @@ public class UITabButton extends UILabel implements UISelectedComponent { } protected void paintOther(Graphics2D g2d, int w, int h) { - + // do nothing } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java index 45c878419e..dc380c0c94 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java @@ -187,7 +187,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ @Override protected void fireStateChanged() { - + // do nothing } @@ -220,7 +220,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ protected void paintOtherBorder(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setStroke(UIConstants.BS); - Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1F, getHeight() - 1F, UIConstants.ARC, UIConstants.ARC); g2d.setColor(UIConstants.LINE_COLOR); g2d.draw(shape); } @@ -252,4 +252,4 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ return true; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java index 31290d6b05..3a0be4a8ff 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java @@ -77,8 +77,8 @@ public class ComboCheckBox extends UIComboBox { protected ComboCheckBox comboBox; protected JScrollPane scrollPane; - protected MouseListener mouseListener; - protected MouseMotionListener mouseMotionListener; + protected MouseListener checkListMouseListener; + protected MouseMotionListener checkListMouseMotionListener; public CheckListPopup(JComboBox comboBox) { this.comboBox = (ComboCheckBox) comboBox; @@ -157,22 +157,22 @@ public class ComboCheckBox extends UIComboBox { @Override public MouseListener getMouseListener() { - if (mouseListener == null) { - mouseListener = new InvocationMouseHandler(); + if (checkListMouseListener == null) { + checkListMouseListener = new InvocationMouseHandler(); } - return mouseListener; + return checkListMouseListener; } public MouseMotionListener getMouseMotionListener() { - if (mouseMotionListener == null) { - mouseMotionListener = new MouseMotionAdapter() { + if (checkListMouseMotionListener == null) { + checkListMouseMotionListener = new MouseMotionAdapter() { }; } - return mouseMotionListener; + return checkListMouseMotionListener; } public void uninstallingUI() { - + // do nothing } protected class InvocationMouseHandler extends MouseAdapter { diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java index ae2e6b52d8..a7a9133351 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java @@ -1,22 +1,14 @@ package com.fr.design.gui.icombobox; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.IllegalComponentStateException; -import java.awt.RenderingHints; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionAdapter; -import java.awt.event.MouseMotionListener; -import java.util.Enumeration; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.ComparatorUtils; +import com.fr.general.NameObject; +import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; @@ -38,16 +30,23 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; - -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itextfield.UITextField; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.ComparatorUtils; -import com.fr.general.NameObject; -import com.fr.stable.Constants; -import com.fr.stable.StringUtils; +import java.util.Enumeration; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.IllegalComponentStateException; +import java.awt.RenderingHints; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.MouseMotionListener; public class FRTreeComboBox extends UIComboBox { @@ -79,7 +78,7 @@ public class FRTreeComboBox extends UIComboBox { boolean showRoot, boolean editable) { this.setTree(tree); this.tree.setCellRenderer(renderer); - this.setEditor(new FrTreeSearchComboBoxEditor(this)); + this.setEditor(createEditor()); if (!showRoot) { tree.expandPath(new TreePath(tree.getModel().getRoot())); tree.setRootVisible(false); @@ -101,6 +100,10 @@ public class FRTreeComboBox extends UIComboBox { return true; } + protected UIComboBoxEditor createEditor() { + return new FrTreeSearchComboBoxEditor(this); + } + public void setTree(JTree tree) { this.tree = tree; if (tree != null) { @@ -318,6 +321,7 @@ public class FRTreeComboBox extends UIComboBox { @Override public void mouseClicked(MouseEvent e) { + // do nothing } @Override @@ -528,7 +532,7 @@ public class FRTreeComboBox extends UIComboBox { } } - class FrTreeSearchComboBoxEditor extends UIComboBoxEditor implements DocumentListener { + public class FrTreeSearchComboBoxEditor extends UIComboBoxEditor implements DocumentListener { private volatile boolean setting = false; private FRTreeComboBox comboBox; private Object item; diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java index 74cd42a7ef..ca4eddfe3e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java @@ -3,6 +3,11 @@ */ package com.fr.design.gui.icombobox; +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.general.FRFont; +import com.fr.stable.Constants; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; @@ -11,18 +16,10 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; - import javax.swing.DefaultComboBoxModel; import javax.swing.JLabel; import javax.swing.JList; -import com.fr.base.FRContext; -import com.fr.base.GraphHelper; -import com.fr.base.ScreenResolution; -import com.fr.general.FRFont; - -import com.fr.stable.Constants; - /** * Combobox for selecting line styles. @@ -88,13 +85,13 @@ public class LineComboBox extends UIComboBox { FontMetrics fm = GraphHelper.getFontMetrics(rfont); if (style == Constants.LINE_NONE) { //draw "none" string - GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2D + fm.getAscent()); } else { - GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, style); + GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style); } if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式. - drawArrow(g2d, new Point2D.Double(4, d.height / 2), new Point2D.Double(d.width - 8, d.height/2)); + drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D)); } } @@ -142,4 +139,4 @@ public class LineComboBox extends UIComboBox { private int style = Constants.LINE_NONE; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java index 9f96f655eb..6130050dc2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java @@ -172,11 +172,9 @@ public class UIComboBoxButton extends JButton { } c.setBackground(UIManager.getColor("ComboBox.focusBackground")); if (c instanceof JComponent) { - mustResetOpaque = true; JComponent jc = (JComponent) c; - savedOpaque = jc.isOpaque(); + jc.isOpaque(); jc.setOpaque(true); - paintFocus = true; } } else { c.setForeground(comboBox.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java index 1513eb6e95..2a5c29d8c8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java @@ -1,12 +1,11 @@ package com.fr.design.gui.icontainer; -import com.fr.base.BaseUtils; -import com.fr.base.vcs.DesignerMode; + +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.stable.Constants; import javax.swing.*; import java.awt.*; @@ -174,6 +173,7 @@ public class UIEastResizableContainer extends JPanel { @Override public void addLayoutComponent(String name, Component comp) { + // do nothing } }; @@ -238,6 +238,7 @@ public class UIEastResizableContainer extends JPanel { * 伸缩右子面板时,触发此方法 */ public void onResize() { + // do nothing here } private class TopToolPane extends JPanel { @@ -261,6 +262,7 @@ public class UIEastResizableContainer extends JPanel { @Override public void mouseDragged(MouseEvent e) { + // do nothing } }); addMouseListener(new MouseAdapter() { @@ -282,7 +284,7 @@ public class UIEastResizableContainer extends JPanel { } onResize(); refreshContainer(); - if (DesignerMode.isAuthorityEditing()) { + if (DesignModeContext.isAuthorityEditing()) { DesignerContext.getDesignerFrame().doResize(); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index eadb94109f..a589b0c878 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -1,6 +1,7 @@ package com.fr.design.gui.icontainer; import com.fr.base.vcs.DesignerMode; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -46,7 +47,7 @@ public class UIModeControlContainer extends JLayeredPane { private boolean isHideMode = false; private boolean isSheeetCovered = false; - private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 30 / 100.0F); + private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); public UIModeControlContainer() { this(new JPanel(), new JPanel()); @@ -85,7 +86,7 @@ public class UIModeControlContainer extends JLayeredPane { public void needToShowCoverAndHidPane() { - if (DesignerMode.isAuthorityEditing()) { + if (DesignModeContext.isAuthorityEditing()) { this.remove(coverPane); this.remove(hidePane); } else { @@ -128,7 +129,7 @@ public class UIModeControlContainer extends JLayeredPane { if (isHideMode || !upEditMode) { return; } - if (DesignerMode.isAuthorityEditing()) { + if (DesignModeContext.isAuthorityEditing()) { return; } setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); @@ -151,11 +152,12 @@ public class UIModeControlContainer extends JLayeredPane { MouseMotionListener mouseMotionListener = new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) { + //do nothing } @Override public void mouseDragged(MouseEvent e) { - if (DesignerMode.isAuthorityEditing()) { + if (DesignModeContext.isAuthorityEditing()) { return; } boolean notUpEditMode = isHideMode || !upEditMode; @@ -174,7 +176,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void removeLayoutComponent(Component comp) { - + //do nothing } @Override @@ -234,11 +236,12 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void addLayoutComponent(String name, Component comp) { + // do nothing } }; protected void onModeChanged() { - + //do nothing here } /** @@ -309,7 +312,7 @@ public class UIModeControlContainer extends JLayeredPane { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - + // do nothing } }); } @@ -319,6 +322,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void removeLayoutComponent(Component comp) { + // do nothing } @Override @@ -333,10 +337,12 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void layoutContainer(Container parent) { + // do nothing } @Override public void addLayoutComponent(String name, Component comp) { + // do nothing } }; @@ -366,7 +372,7 @@ public class UIModeControlContainer extends JLayeredPane { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { - + // do nothing } }); @@ -407,6 +413,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void removeLayoutComponent(Component comp) { + // do nothing } @Override @@ -437,6 +444,7 @@ public class UIModeControlContainer extends JLayeredPane { @Override public void addLayoutComponent(String name, Component comp) { + // do nothing } }; diff --git a/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java b/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java index 432628f0fa..ebccd24f45 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java @@ -1,5 +1,6 @@ package com.fr.design.gui.ilable; +import javax.swing.event.MouseInputAdapter; import java.awt.Color; import java.awt.Cursor; import java.awt.Graphics; @@ -7,9 +8,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; -import com.fr.design.gui.ilable.UILabel; -import javax.swing.event.MouseInputAdapter; - /** * Action label */ @@ -31,6 +29,7 @@ public class ActionLabel extends UILabel { /** * Repaints the text. */ + @Override public void paintComponent(Graphics _gfx) { super.paintComponent(_gfx); @@ -39,12 +38,17 @@ public class ActionLabel extends UILabel { } private MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() { + @Override public void mouseClicked(MouseEvent e) { + //do nothing } + @Override public void mousePressed(MouseEvent e) { + //do nothing } + @Override public void mouseReleased(MouseEvent evt) { Object source = evt.getSource(); @@ -65,6 +69,7 @@ public class ActionLabel extends UILabel { } } + @Override public void mouseExited(MouseEvent evt) { Object source = evt.getSource(); @@ -73,6 +78,7 @@ public class ActionLabel extends UILabel { } } + @Override public void mouseDragged(MouseEvent e) { } diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 844120c51b..a14de81c55 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -287,7 +287,7 @@ public class UIBasicMenuItemUI extends MenuItemUI { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d = getPreferredSize(c); - d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS); + d.width -= (double) v.getPreferredSpan(View.X_AXIS) - (double) v.getMinimumSpan(View.X_AXIS); } return d; } @@ -345,7 +345,7 @@ public class UIBasicMenuItemUI extends MenuItemUI { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { d = getPreferredSize(c); - d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS); + d.width += (double) v.getMaximumSpan(View.X_AXIS) - (double) v.getPreferredSpan(View.X_AXIS); } return d; } @@ -816,7 +816,6 @@ public class UIBasicMenuItemUI extends MenuItemUI { // get Accelerator text KeyStroke accelerator = b.getAccelerator(); String acceleratorText = ""; - drawMenu(acceleratorText, accelerator, c, ic, maxValue, offset, paintIcon, b); String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null, arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, @@ -834,43 +833,6 @@ public class UIBasicMenuItemUI extends MenuItemUI { g.setFont(holdf); } - private void drawMenu(String acceleratorText, KeyStroke accelerator, JComponent c, - Icon ic, int maxValue, int offset, Icon paintIcon, JMenuItem b) { - if (accelerator != null) { - int modifiers = accelerator.getModifiers(); - if (modifiers > 0) { - acceleratorText = KeyEvent.getKeyModifiersText(modifiers); - //acceleratorText += "-"; - acceleratorText += acceleratorDelimiter; - } - - int keyCode = accelerator.getKeyCode(); - if (keyCode != 0) { - acceleratorText += KeyEvent.getKeyText(keyCode); - } else { - acceleratorText += accelerator.getKeyChar(); - } - } - if (!isTopLevelMenu()) { - if (c instanceof JCheckBoxMenuItem || c instanceof JRadioButtonMenuItem) { - ic = checkIcon; - if (checkIcon.getIconWidth() < maxValue) { - ic = new EmptyIcon(maxValue, checkIcon.getIconHeight()); - offset = (maxValue - checkIcon.getIconWidth()) / 2; - } - paintIcon = null; - } else if (c instanceof JMenuItem) { - if (ic == null || ic.getIconWidth() < maxValue) { - int height = (ic == null) ? 2 : b.getIcon().getIconHeight(); - int width = (ic == null) ? 2 : b.getIcon().getIconWidth(); - offset = (maxValue - width) / 2; - ic = new EmptyIcon(maxValue, height); - } - } - } - } - - private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) { if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) { //Get the maxAccWidth from the parent to calculate the offset. diff --git a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java index d950e91ed7..938e0caccc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java @@ -157,8 +157,7 @@ public class UIMenuTable extends JTable { @Override public TableCellRenderer getDefaultRenderer(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultRenderer(columnClass); + return super.getDefaultRenderer(UITable.class); } private class UITableRender implements TableCellRenderer { diff --git a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java index c4df50e82a..30074f5638 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java +++ b/designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java @@ -72,6 +72,7 @@ public class UIProgressBorder extends UIRoundedBorder { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } + @SuppressWarnings("squid:S2164") private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); shadowWidth = Math.max(shadowWidth, 2); @@ -85,6 +86,7 @@ public class UIProgressBorder extends UIRoundedBorder { } } + @SuppressWarnings("squid:S2164") private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) { float[] clr1 = c1.getComponents(null); float[] clr2 = c2.getComponents(null); diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java index 851f907977..821ebbc335 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java @@ -165,50 +165,6 @@ public class UIBasicScrollBarUI extends BasicScrollBarUI { // drawColorAndLength(g, t, x2, y2, color); } - private void drawColorAndLength(Graphics g, Rectangle t, int x2, int y2, Color color) { - - if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { - int y1 = t.y + (t.height) / 2 - 4; - y2 = Math.min(y1 + 8, t.y + t.height - 5); - - int y = y1; - // we take only saturation & brightness and apply them - // to the background color (normal/rollover/pressed) - g.setColor(UISBChooser.getAdjustedColor(color, 0, 71)); - while (y < y2) { - g.drawLine(5, y, 11, y); - y += 2; - } - - y = y1 + 1; - g.setColor(UISBChooser.getAdjustedColor(color, 0, -13)); - while (y < y2) { - g.drawLine(6, y, 12, y); - y += 2; - } - } else { - int x1 = t.x + (t.width) / 2 - 4; - x2 = Math.min(x1 + 8, t.x + t.width - 5); - - int x = x1 + 1; - // we take only saturation & brightness and apply them - // to the background color (normal/rollover/pressed) - g.setColor(UISBChooser.getAdjustedColor(color, 0, 71)); - while (x < x2) { - g.drawLine(x, 5, x, 11); - x += 2; - } - - x = x1; - g.setColor(UISBChooser.getAdjustedColor(color, 0, -13)); - while (x < x2) { - g.drawLine(x, 6, x, 12); - x += 2; - } - } - } - - private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2, Color pressedColor, Color rolloverColor, Color normalColor) { diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java index a6ba742830..c780eeb2d7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java @@ -90,6 +90,7 @@ public class UISBChooser extends JDialog { (frame.getHeight() - getSize().height) / 2); } + @SuppressWarnings("squid:S1226") private void initP3(JPanel p3, JPanel p1) { p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8)); p3.add(new JLabel("R:")); @@ -198,6 +199,7 @@ public class UISBChooser extends JDialog { twoColorField.setUpperColor(outColor); } + @SuppressWarnings("squid:S2164") public static Color getAdjustedColor(Color inColor, int sat, int bri) { Color briColor = inColor; @@ -219,9 +221,9 @@ public class UISBChooser extends JDialog { int dg = briColor.getGreen() - satColor.getGreen(); int db = briColor.getBlue() - satColor.getBlue(); - r = briColor.getRed() - (int) Math.round(dr * sat / VALUE * 1.0); - g = briColor.getGreen() - (int) Math.round(dg * sat / VALUE * 1.0); - b = briColor.getBlue() - (int) Math.round(db * sat / VALUE * 1.0); + r = briColor.getRed() - (int) Math.round(dr * sat / (VALUE * 1.0)); + g = briColor.getGreen() - (int) Math.round(dg * sat / (VALUE * 1.0)); + b = briColor.getBlue() - (int) Math.round(db * sat / (VALUE * 1.0)); } else { float d = ColorRoutines.getGreyValue(briColor); float dr = briColor.getRed() - d; diff --git a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java index d3393054ae..949b3958ae 100644 --- a/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java @@ -2,6 +2,25 @@ package com.fr.design.gui.iscrollbar; import com.fr.design.constants.UIConstants; import com.fr.stable.StringUtils; +import sun.swing.DefaultLookup; + +import javax.swing.BoundedRangeModel; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import javax.swing.LookAndFeel; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.Timer; +import javax.swing.UIManager; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.plaf.ComponentUI; +import javax.swing.plaf.ScrollBarUI; +import javax.swing.plaf.UIResource; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -22,24 +41,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import javax.swing.BoundedRangeModel; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; -import javax.swing.JViewport; -import javax.swing.LookAndFeel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.Timer; -import javax.swing.UIManager; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.plaf.ComponentUI; -import javax.swing.plaf.ScrollBarUI; -import javax.swing.plaf.UIResource; -import sun.swing.DefaultLookup; /** * Like BasicScrollBarUI,but without two buttons @@ -590,6 +591,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo * will cause a repaint. */ + @SuppressWarnings("squid:S2164") protected void layoutVScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); @@ -672,6 +674,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo * Make sure the thumb fits between the buttons. Note that setting the * thumbs bounds causes a repaint. */ + @SuppressWarnings("squid:S2164") protected void layoutHScrollbar(JScrollBar sb) { Dimension sbSize = sb.getSize(); Insets sbInsets = sb.getInsets(); @@ -1080,7 +1083,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo scrollbar.repaint(); } - + @SuppressWarnings("squid:S2164") private void setValueFrom(MouseEvent e) { boolean active = isThumbRollover(); BoundedRangeModel model = scrollbar.getModel(); diff --git a/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java b/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java index ca214c4241..e5dcd7fd14 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java +++ b/designer-base/src/main/java/com/fr/design/gui/itable/UITable.java @@ -291,8 +291,7 @@ public class UITable extends JTable implements UIObserver { * */ public TableCellEditor getDefaultEditor(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultEditor(columnClass); + return super.getDefaultEditor(UITable.class); } @Override @@ -300,8 +299,7 @@ public class UITable extends JTable implements UIObserver { * */ public TableCellRenderer getDefaultRenderer(Class columnClass) { - columnClass = UITable.class; - return super.getDefaultRenderer(columnClass); + return super.getDefaultRenderer(UITable.class); } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java deleted file mode 100644 index 2d0891181e..0000000000 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.fr.design.gui.itextfield; - -import java.awt.Graphics; - -import javax.swing.plaf.metal.MetalTextFieldUI; -import javax.swing.text.JTextComponent; - -import de.muntjak.tinylookandfeel.Theme; - -public class TextFieldUI extends MetalTextFieldUI { - - - protected void paintBackground(Graphics g) { - JTextComponent editor = getComponent(); - // We will only be here if editor is opaque, so we don't have to test - - if(editor.isEnabled()) { - if(editor.isEditable()) { - g.setColor(editor.getBackground()); - } - else { - // not editable - if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) { - // set default panel background - g.setColor(Theme.backColor[Theme.style].getColor()); - } - else { - // color changed by user - set textfield background - g.setColor(editor.getBackground()); - } - } - - g.fillRect(0, 0, editor.getWidth(), editor.getHeight()); - } - else { - if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) { - g.setColor(Theme.textDisabledBgColor[Theme.style].getColor()); - } - else { - // color changed by user - set textfield background - g.setColor(editor.getBackground()); - } - - g.fillRect(0, 0, editor.getWidth(), editor.getHeight()); - - if(Theme.style != Theme.YQ_STYLE) return; - - g.setColor(Theme.backColor[Theme.style].getColor()); - g.drawRect(1, 1, editor.getWidth() - 3, editor.getHeight() - 3); - g.drawRect(2, 2, editor.getWidth() - 5, editor.getHeight() - 5); - } - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java index 9bbca6d2bc..b188cb5aa8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java @@ -102,7 +102,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}}; Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL}; - hAlignmentPane = new UIButtonGroup(hAlignmentIconArray, hAlignment); + hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment); hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")}); hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); @@ -112,7 +112,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")}, {IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}}; Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM}; - vAlignmentPane = new UIButtonGroup(vAlignmentIconArray, vAlignment); + vAlignmentPane = new UIButtonGroup<>(vAlignmentIconArray, vAlignment); vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")}); initOtherComponent(); initAllNames(); @@ -174,7 +174,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } private void initTextRotationCombox() { - ArrayList selectOption = new ArrayList(); + ArrayList selectOption = new ArrayList<>(); selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle")); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); selectOption.addAll(Arrays.asList(processor.getComboxOption())); @@ -343,8 +343,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); // alex:indent - this.leftIndentSpinner.setValue(new Integer(leftPadding)); - this.rightIndentSpinner.setValue(new Integer(rightPadding)); + this.leftIndentSpinner.setValue(leftPadding); + this.rightIndentSpinner.setValue(rightPadding); this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); this.spaceAfterSpinner.setValue(style.getSpacingAfter()); @@ -360,7 +360,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO public Style update(Style style) { // peter:需要判断传递进来的值是否为null. if (style == null) { - return style; + return null; } if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) { @@ -463,7 +463,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO } /** - * @param name + * @param name 全局名 */ public void setGlobalName(String name) { } diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java index 795c6d455a..cf362f7f5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java @@ -6,6 +6,7 @@ import com.fr.base.Style; import com.fr.base.TextFormat; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; +import com.fr.design.i18n.Toolkit; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.UIConstants; @@ -36,20 +37,23 @@ import java.text.SimpleDateFormat; * @author zhou * @since 2012-5-24上午10:57:00 */ -public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver { +public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver { private static final long serialVersionUID = 724330854437726751L; - private static final int LABLE_X = 4; - private static final int LABLE_Y = 18; - private static final int LABLE_DELTA_WIDTH = 8; - private static final int LABLE_HEIGHT = 15; //标签背景的范围 + private static final int LABEL_X = 4; + private static final int LABEL_Y = 18; + private static final int LABEL_DELTA_WIDTH = 8; + private static final int LABEL_HEIGHT = 15; //标签背景的范围 private static final int CURRENCY_FLAG_POINT = 6; - private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0,30,0,0); + private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0, 30, 0, 0); - private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC, - FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; + private static final Integer[] TYPES = new Integer[]{ + FormatContents.NULL, FormatContents.NUMBER, + FormatContents.CURRENCY, FormatContents.PERCENT, + FormatContents.SCIENTIFIC, FormatContents.DATE, + FormatContents.TIME, FormatContents.TEXT}; - private static final Integer[] DATETYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME,}; + private static final Integer[] DATE_TYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME}; private Format format; @@ -61,7 +65,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs private JPanel centerPane; private JPanel formatFontPane; private FRFontPane frFontPane; - private boolean isRightFormate; + private boolean isRightFormat; private boolean isDate = false; private GlobalNameListener globalNameListener = null; @@ -78,7 +82,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs protected void initComponents(Integer[] types) { this.setLayout(new BorderLayout(0, 4)); - iniSampleLable(); + initSampleLabel(); contentPane = new JPanel(new BorderLayout(0, 4)) { @Override public Dimension getPreferredSize() { @@ -108,7 +112,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs frFontPane = new FRFontPane(); - UILabel font = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT); + UILabel font = new UILabel(Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT); JPanel fontPane = new JPanel(new BorderLayout()); fontPane.add(font, BorderLayout.NORTH); @@ -136,7 +140,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, new Component[]{centerPane, null}, new Component[]{fontPane, frFontPane}, }; @@ -155,24 +159,24 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs }; } - private void iniSampleLable() { - Border innterborder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); - Font tmpFont = null; - Border border = BorderFactory.createTitledBorder(innterborder, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"), TitledBorder.LEFT, 0, tmpFont, UIConstants.LINE_COLOR); + private void initSampleLabel() { + Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); + String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); + Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR); sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { @Override public void paint(Graphics g) { super.paint(g); int width = getWidth(); - Color orignal = g.getColor(); + Color original = g.getColor(); g.setColor(getBackground()); - g.fillRect(LABLE_X, LABLE_Y, width - LABLE_DELTA_WIDTH, LABLE_HEIGHT); + g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT); g.setColor(UIConstants.LINE_COLOR); FontMetrics cellFM = g.getFontMetrics(); int textWidth = cellFM.stringWidth(getText()); GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26); - g.setColor(orignal); + g.setColor(original); } }; sampleLabel.setHorizontalAlignment(UILabel.CENTER); @@ -197,7 +201,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs * @return 标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"); + return Toolkit.i18nText("Fine-Design_Report_Text"); } /** @@ -212,13 +216,9 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs if (format instanceof CoreDecimalFormat) { // check all value String pattern = ((CoreDecimalFormat) format).toPattern(); - boolean isCurrency1 = (pattern.length() > 0 && pattern.charAt(0) == '¤'); - boolean isCurrency2 = (pattern.length() > 0 && pattern.charAt(0) == '$'); - boolean isCurrency = isCurrency1 || isCurrency2; - boolean isCurrency4 = (pattern.length() > CURRENCY_FLAG_POINT && ComparatorUtils.equals(pattern.substring(0, CURRENCY_FLAG_POINT), "#,##0;")); - if (isCurrency || isCurrency4) { + if (isCurrencyFormatStyle(pattern)) { setPatternComboBoxAndList(FormatContents.CURRENCY, pattern); - } else if (pattern.endsWith("%")) { + } else if (pattern.indexOf("%") > 0) { setPatternComboBoxAndList(FormatContents.PERCENT, pattern); } else if (pattern.indexOf("E") > 0) { setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern); @@ -238,6 +238,17 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs } } + private boolean isCurrencyFormatStyle(String pattern) { + if (pattern.length() == 0) { + return false; + } + + if (pattern.charAt(0) == '¤' || pattern.charAt(0) == '$') { + return true; + } + + return pattern.length() > CURRENCY_FLAG_POINT && pattern.startsWith("#,##0;"); + } /** * 判断是否是数组有模式 @@ -273,7 +284,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs if (getFormatContents() == FormatContents.TEXT) { return FormatField.getInstance().getFormat(getFormatContents(), patternString); } - if (isRightFormate) { + if (isRightFormat) { if (StringUtils.isNotEmpty(patternString)) { return FormatField.getInstance().getFormat(getFormatContents(), patternString); } @@ -292,7 +303,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); try { - isRightFormate = true; + isRightFormat = true; if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { return; } @@ -300,7 +311,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs } catch (Exception e) { this.sampleLabel.setForeground(Color.red); this.sampleLabel.setText(e.getMessage()); - isRightFormate = false; + isRightFormat = false; } } @@ -401,8 +412,8 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs this.isDate = isDate; this.typeComboBox.setSelectedIndex(0); if (isDate) { - for (int i = 0; i < DATETYPES.length; i++) { - this.typeComboBox.addItem(DATETYPES[i]); + for (int i = 0; i < DATE_TYPES.length; i++) { + this.typeComboBox.addItem(DATE_TYPES[i]); } for (int i = 0; i < TYPES.length; i++) { this.typeComboBox.removeItemAt(1); @@ -411,7 +422,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs for (int i = 0; i < TYPES.length; i++) { this.typeComboBox.addItem(TYPES[i]); } - for (int i = 0; i < DATETYPES.length; i++) { + for (int i = 0; i < DATE_TYPES.length; i++) { this.typeComboBox.removeItemAt(1); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java index 352676010c..749bf45408 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java @@ -9,6 +9,8 @@ */ package com.fr.design.gui.syntax.print; +import com.fr.log.FineLoggerFactory; + import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; @@ -62,8 +64,8 @@ public abstract class RPrintUtilities { private static int getLineBreakPoint(String line, final int maxCharsPerLine) { int breakPoint = -1; - for (int i=0; i breakPoint) breakPoint = breakCharPos; } @@ -147,11 +149,11 @@ public abstract class RPrintUtilities { int tabIndex = curLineString.indexOf('\t'); while (tabIndex > -1) { int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces); - String replacementString = ""; + StringBuilder replacementString = new StringBuilder(); for (int i=0; i-1 && pos>currentPos) // currentPos = pos; - if (pos>0 && pos>currentPos & pos!=currentLineString.length()) + if (pos > 0 && pos > currentPos & pos != currentLineString.length()) currentPos = pos; } @@ -440,7 +442,7 @@ public abstract class RPrintUtilities { try { doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg); } catch (BadLocationException ble) { - System.err.println(ble); + FineLoggerFactory.getLogger().error(ble.getMessage()); return Printable.NO_SUCH_PAGE; } currentLineLengthInPixels = Utilities. @@ -453,12 +455,11 @@ public abstract class RPrintUtilities { try { doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg); } catch (BadLocationException ble) { - System.err.println("BadLocationException in print (a):"); - System.err.println("==> currentLineStart: " + currentLineStart + - "; startingOffset: " + startingOffset + "; currentPos: " + currentPos); - System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " + - (currentLineStart+startingOffset+currentPos)); - ble.printStackTrace(); + FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart + + "; startingOffset: " + startingOffset + "; currentPos: " + currentPos + + "==> Range: " + (currentLineStart+startingOffset) + " - " + + (currentLineStart+startingOffset+currentPos)); + FineLoggerFactory.getLogger().error(ble.getMessage()); return Printable.NO_SUCH_PAGE; } @@ -521,7 +522,8 @@ public abstract class RPrintUtilities { return x; int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int ntabs = (((int) x) - xOffset) / tabSizeInPixels; - return xOffset + ((ntabs + 1) * tabSizeInPixels); + double reFloat = (double) xOffset + (double) ((ntabs + 1) * tabSizeInPixels); + return (float) reFloat; } } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java index ddb3ddfa3c..596c5d9bd9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java @@ -518,6 +518,8 @@ public class RSyntaxUtilities implements SwingConstants { } numEmbedded--; } + } else { + //do nothing } } // End of for (int i=segOffset; i { token = null; } } + else { + throw new NoSuchElementException(); + } return t; } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java index e99208afc0..97e367ef0c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java @@ -268,7 +268,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -458,7 +458,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -841,10 +841,11 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, * @return the tab stop, measured in points >= 0 */ public float nextTabStop(float x, int tabOffset) { - if (tabSize == 0) + if (tabSize == 0) { return x; + } int ntabs = ((int) x - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java index 79d8da0a30..41f51215c7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java @@ -172,7 +172,7 @@ public class HtmlFoldParser implements FoldParser { // Continuing an MLC from a previous line if (inMLC) { // Found the end of the MLC starting on a previous line... - if (t.endsWith(MLC_END)) { + if (currentFold != null && t.endsWith(MLC_END)) { int mlcEnd = t.getEndOffset() - 1; currentFold.setEndOffset(mlcEnd); Fold parentFold = currentFold.getParent(); diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java index aae7216734..98b5265c39 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java @@ -18,6 +18,7 @@ import java.io.IOException; * on 9/18/19 6:12 PM from the specification file * /Users/3dot141/Downloads/FolxDownload/App/jflex-1.4.1/bin/FormulaTokenMaker.flex */ +@SuppressWarnings("squid:S1192") public class FormulaTokenMaker extends AbstractJFlexCTokenMaker { /** This character denotes the end of file */ diff --git a/designer-base/src/main/java/com/fr/design/icon/BorderIcon.java b/designer-base/src/main/java/com/fr/design/icon/BorderIcon.java index 3afc423be1..8250cd7022 100644 --- a/designer-base/src/main/java/com/fr/design/icon/BorderIcon.java +++ b/designer-base/src/main/java/com/fr/design/icon/BorderIcon.java @@ -85,9 +85,9 @@ public class BorderIcon implements Icon { cellBorderStyle.getBottomColor()); drawLine(gr, x1, y1, x1, y2, cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor()); - drawLine(gr, defaultWidth / 2, y1, defaultWidth / 2, y2, + drawLine(gr, defaultWidth / 2.0, y1, defaultWidth / 2.0, y2, cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor()); - drawLine(gr, x1, defaultHeight / 2, x2, defaultHeight / 2, + drawLine(gr, x1, defaultHeight / 2.0, x2, defaultHeight / 2.0, cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor()); } diff --git a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java index 0c3a067a95..80efde739e 100644 --- a/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java @@ -562,7 +562,7 @@ public class FRGUIPaneFactory { double n = (double)(width + WIDTH_OFFSET_N ) / (double)WIDTH_PARA_F; double i = Math.abs(((double) ((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); double j = Math.abs(((double) ((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); - double x = i > j ? i : j; + double x = Math.max(i,j); if (AssistUtils.equals(x, i)) { w = (int) (Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M); } else if (AssistUtils.equals(x, j)) { diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java index f8134be1fd..2cf288da63 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayout.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayout.java @@ -1747,7 +1747,7 @@ public class TableLayout implements LayoutManager2, Serializable { for (counter = 0; counter < numCr; counter++) if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0)) fillSizeRatio -= crSpec[z][counter]; - else if (crSpec[z][counter] == FILL) + else if (AssistUtils.equals(crSpec[z][counter], FILL)) numFillSize++; // Adjust fill ratios to reflect number of fill rows/columns @@ -1773,8 +1773,8 @@ public class TableLayout implements LayoutManager2, Serializable { int crPrefMin[] = new int[numCr]; for (counter = 0; counter < numCr; counter++) - if ((crSpec[z][counter] == PREFERRED) || - (crSpec[z][counter] == MINIMUM)) { + if ((AssistUtils.equals(crSpec[z][counter], PREFERRED)) || + (AssistUtils.equals(crSpec[z][counter], MINIMUM))) { crPrefMin[counter] = crSize[z][counter]; } diff --git a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java index 1be77c8492..d394f43ee7 100644 --- a/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java +++ b/designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java @@ -372,7 +372,8 @@ public class TableLayoutHelper { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE); - JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, (double)2 * TEN, (double)2 * TEN); + JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), + TableLayoutHelper.FILL_LASTCOL_AND_ROW, (double)2 * TEN, (double)2 * TEN); JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"), new double[]{f, p, f, p}, new double[]{f, f}, 4, 4); JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"), diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index dd31d8322d..2cf8d8c350 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -40,25 +40,29 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; +import com.fr.design.os.impl.MacOsAddListenerAction; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.event.EventDispatcher; import com.fr.exception.DecryptTemplateException; +import com.fr.exit.DesignerExiter; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; +import com.fr.invoke.Reflect; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; -import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; +import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.project.ProjectConstants; @@ -313,6 +317,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // window close listener. this.addWindowListeners(getFrameListeners()); + addMacOsListener(); + this.addComponentListener(new ComponentAdapter() { @Override @@ -465,7 +471,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta OSSupportCenter.buildAction(new OSBasedAction() { @Override public void execute(Object... objects) { - bbsLoginPane[0] = ad.createBBSLoginPane(); + bbsLoginPane[0] = ad.createBBSLoginPane(); } }, SupportOSImpl.USERINFOPANE); processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]); @@ -477,7 +483,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta OSSupportCenter.buildAction(new OSBasedAction() { @Override public void execute(Object... objects) { - northEastPane.add(ad.createBBSLoginPane()); + northEastPane.add(ad.createBBSLoginPane()); } }, SupportOSImpl.USERINFOPANE); @@ -500,8 +506,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta image = ICODecoder.read(DesignerFrame.class .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); } - this.setIconImages(image); - } catch (IOException e) { + if (OperatingSystem.isMacos()) { + Class clazz = Class.forName("com.apple.eawt.Application"); + BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1); + Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon); + } else { + this.setIconImages(image); + } + } catch (IOException | ClassNotFoundException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); } @@ -514,6 +526,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } + private void addMacOsListener() { + OSSupportCenter.buildAction(new MacOsAddListenerAction(), SupportOSImpl.DOCK_QUIT); + } + protected ArrayList getFrameListeners() { ArrayList arrayList = new ArrayList<>(); @@ -1088,8 +1104,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta if (tplFile != null) { int index = HistoryTemplateListCache.getInstance().contains(tplFile); if (index != -1) { - HistoryTemplateListCache.getInstance().getHistoryList().get(index).activeOldJTemplate(); - return; + JTemplate jt = HistoryTemplateListCache.getInstance().getHistoryList().get(index); + if (!(jt instanceof JVirtualTemplate)) { + jt.activeOldJTemplate(); + return; + } } } @@ -1125,8 +1144,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta Thread.currentThread().interrupt(); } - DesignerEnvManager.getEnvManager().setLastOpenFile( - HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (jt != null) { + DesignerEnvManager.getEnvManager().setLastOpenFile(jt.getEditingFILE().getPath()); + } DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY( WestRegionContainerPane.getInstance().getToolPaneY()); @@ -1152,8 +1173,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.dispose(); this.ad.shutDown(); - - System.exit(0); + DesignerExiter.getInstance().execute(); } // harry:添加程序外拖拽文件进来打开的功能 @@ -1260,4 +1280,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta progressDialog.dispose(); } + + /** + * 设计器是否已经打开 + * + * @return 设计器是否已经打开 + */ + public boolean isDesignerOpened() { + return designerOpened; + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 0b52a582d3..bcac7f946c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -218,7 +218,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt if (VcsHelper.getInstance().needInit()) { vcsAction = new VcsAction(); - if (WorkContext.getCurrent().isLocal()) { + if (!WorkContext.getCurrent().isCluster()) { vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_Title")); } else { vcsAction.setName(Toolkit.i18nText("Fine-Design_Vcs_NotSupportRemote")); @@ -684,21 +684,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt this.dispose(); //模版重命名 - boolean success = false; - - // 提醒保存文件 - SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); - // 只有一个文件未保存时 - if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) { - int choose = saveSomeTempaltePane.saveLastOneTemplate(); - if (choose != JOptionPane.CANCEL_OPTION) { - success = selectedOperation.rename(fnf, path, newPath); - } - } else { - if (saveSomeTempaltePane.showSavePane()) { - success = selectedOperation.rename(fnf, path, newPath); - } - } + boolean success = selectedOperation.rename(fnf, path, newPath); if (success) { HistoryTemplateListCache.getInstance().rename(fnf, path, newPath); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java similarity index 94% rename from designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java rename to designer-base/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java index 9bfd729dd4..99950edae7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java @@ -21,6 +21,9 @@ import java.util.Date; */ public class ErrorInfo { + private static final String SUFFIX = ".json"; + private static final String FOLDER_NAME = "errorInfo"; + private String username; private String uuid; private String activekey; @@ -128,8 +131,8 @@ public class ErrorInfo { public void saveFileToCache(JSONObject jo) { String content = jo.toString(); - String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX; - File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName)); + String fileName = UUID.randomUUID() + SUFFIX; + File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FOLDER_NAME, fileName)); FileOutputStream out = null; try (InputStream in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) { StableUtils.makesureFileExist(file); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 57d1d457f6..5937770c4e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -53,6 +53,12 @@ public class DesignerLogHandler { private static final int SERVER_GAP_Y = -20; + private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":"; + + private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":"; + + private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":"; + public static DesignerLogHandler getInstance() { return HOLDER.singleton; @@ -310,11 +316,11 @@ public class DesignerLogHandler { private String appendLocaleMark(String str, int style) { if (style == DesignerLogger.ERROR_INT) { - str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":" + str + "\n"; + str = ERROR_MARK + str + "\n"; } else if (style == DesignerLogger.WARN_INT) { - str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":" + str + "\n"; + str = WARN_MARK + str + "\n"; } else { - str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":" + str + "\n"; + str = NORMAL_MARK + str + "\n"; } return str; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogDetailPane.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogDetailPane.java index 5ea260f469..0ed6386168 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogDetailPane.java @@ -6,6 +6,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import com.fr.base.BaseUtils; +import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; public class LogDetailPane extends JPanel{ @@ -20,7 +21,7 @@ public class LogDetailPane extends JPanel{ fr.setSize(600, 400); GUICoreUtils.centerWindow(fr); fr.setResizable(false); - fr.setTitle("日志"); + fr.setTitle(Toolkit.i18nText("Fine-Design_Basic_Log")); fr.setIconImage(BaseUtils.readImageWithCache("com/fr/design/images/buttonicon/history.png")); fr.getContentPane().setLayout(new BorderLayout()); fr.getContentPane().add(this, BorderLayout.CENTER); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java index 5a4ba1edaf..bbb9eed346 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java @@ -69,7 +69,7 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus int w = button.getWidth(); int h = button.getHeight(); Graphics2D g2d = (Graphics2D) g; - GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1, darkColor); + GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, (float)(h - 1), darkColor); g2d.setPaint(gp); g2d.fillRect(0, 0, w, h); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/messagecollect/StartErrorMessageCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/messagecollect/StartErrorMessageCollector.java new file mode 100644 index 0000000000..ca3fd13ccc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/messagecollect/StartErrorMessageCollector.java @@ -0,0 +1,44 @@ +package com.fr.design.mainframe.messagecollect; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.errorinfo.ErrorInfo; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; + +/** + * + * @author hades + * @version 10.0 + * Created by hades on 2020/1/8 + */ +public class StartErrorMessageCollector { + + private static final StartErrorMessageCollector INSTANCE = new StartErrorMessageCollector(); + + private String uuid; + private String activeKey; + + + public static StartErrorMessageCollector getInstance() { + return INSTANCE; + } + + private StartErrorMessageCollector() { + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + this.uuid = envManager.getUUID(); + this.activeKey = envManager.getActivationKey(); + } + + public void record(String id, String msg, String detail) { + FineLoggerFactory.getLogger().error(id + ": " + msg + ", detail: " + detail); + ErrorInfo errorInfo = new ErrorInfo(StringUtils.EMPTY, uuid, activeKey); + errorInfo.setLogid(id); + errorInfo.setLog(msg); + errorInfo.setStackTrace(detail); + errorInfo.saveAsJSON(); + } + + public void record(String id, String msg) { + record(id, msg, StringUtils.EMPTY); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/messagecollect/entity/DesignerErrorMessage.java b/designer-base/src/main/java/com/fr/design/mainframe/messagecollect/entity/DesignerErrorMessage.java new file mode 100644 index 0000000000..d2047336ec --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/messagecollect/entity/DesignerErrorMessage.java @@ -0,0 +1,37 @@ +package com.fr.design.mainframe.messagecollect.entity; + +import com.fr.design.i18n.Toolkit; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/1/8 + */ +public enum DesignerErrorMessage { + + DESIGNER_PROCESS_OCCUPIED("11300201", Toolkit.i18nText("Fine-Design_Error_Process_Occupied_Message")), + PORT_OCCUPIED("11300202", Toolkit.i18nText("Fine-Design_Error_Port_Occupied_Message")), + FINEDB_PROBLEM("11300203", Toolkit.i18nText("Fine-Design_Error_Finedb_Problem_Message")), + DESIGNER_OUT_OF_MEMORY("11300204", Toolkit.i18nText("Fine-Design_Error_Out_Of_Memory_Message")), + REMOTE_DESIGN_NO_RESPONSE("11300205", Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Message")), + UNEXCEPTED_START_FAILED("11300200", Toolkit.i18nText("Fine-Design_Error_UnExcepted_Start_Failed")), + UNEXCEPTED_FALL_BACK("11300400 ", Toolkit.i18nText("Fine-Design_Error_UnExcepted_Fall_Back")); + + + + private String id; + private String message; + + public String getId() { + return id; + } + + public String getMessage() { + return message; + } + + DesignerErrorMessage(String id, String message) { + this.id = id; + this.message = message; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java index 0a480d99a0..7812e8f32a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java @@ -30,11 +30,15 @@ public class MobileBookMarkStyleDefinePane extends BasicBeanPane { + public static final int LEFT_PANEL_WIDTH = 140; + public static final int LEFT_PANEL_HEIGHT = 565; + public static final int RIGHT_PANEL_WIDTH = 510; + public static final int RIGHT_PANEL_HEIGHT = 565; + public static ListCellRenderer renderer = new DefaultListCellRenderer() { @Override @@ -48,6 +55,7 @@ public class MobileBookMarkStylePane extends BasicBeanPane private void initComponent() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.listModel = new DefaultListModel<>(); this.card = new CardLayout(); this.rightPane = FRGUIPaneFactory.createCardLayout_S_Pane(); @@ -79,14 +87,16 @@ public class MobileBookMarkStylePane extends BasicBeanPane } }); JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + leftPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); leftPanel.add(bookMarkList, BorderLayout.CENTER); - leftPanel.setPreferredSize(new Dimension(100, 500)); + leftPanel.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, LEFT_PANEL_HEIGHT)); this.add(leftPanel, BorderLayout.WEST); } private void initRightPanel() { JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - centerPane.setPreferredSize(new Dimension(500, 500)); + centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + centerPane.setPreferredSize(new Dimension(RIGHT_PANEL_WIDTH, RIGHT_PANEL_HEIGHT)); centerPane.add(rightPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER); } @@ -94,10 +104,12 @@ public class MobileBookMarkStylePane extends BasicBeanPane private List getMobileBookMarkStyleProvider() { DefaultMobileBookMarkStyleProvider defaultMobileBookMarkStyleProvider = new DefaultMobileBookMarkStyleProvider(); + SidebarMobileBookMarkStyleProvider sidebarMobileBookMarkStyleProvider = new SidebarMobileBookMarkStyleProvider(); Set mobileBookMarkStyleProviders = ExtraDesignClassManager.getInstance().getArray( MobileBookMarkStyleProvider.XML_TAG); List list = new ArrayList<>(); list.add(defaultMobileBookMarkStyleProvider); + list.add(sidebarMobileBookMarkStyleProvider); list.addAll(mobileBookMarkStyleProviders); return Collections.unmodifiableList(list); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java new file mode 100644 index 0000000000..79bab33dfc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java @@ -0,0 +1,387 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.icombobox.LineComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UnsignedIntUISpinner; +import com.fr.design.gui.style.FRFontPane; +import com.fr.design.gui.style.NumberDragBar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.form.ui.mobile.MobileBookMarkStyle; +import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle; +import com.fr.stable.CoreConstants; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; + +/** + * @author Starryi + * @version 10.0 + * Created by Starryi on 2020/02/28 + */ +public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane { + private static final long serialVersionUID = 1L; + + private static final int COLUMN_WIDTH = 160; + + private UnsignedIntUISpinner buttonWidthSpinner; + private UnsignedIntUISpinner buttonHeightSpinner; + private UnsignedIntUISpinner buttonGapSpinner; + private UnsignedIntUISpinner buttonBorderRadiusSpinner; + + private ColorSelectBox normalBackgroundColorBox; + private NumberDragBar normalOpacityDragBar; + private UnsignedIntUISpinner normalOpacitySpinner; + private LineComboBox normalBorderWidthComBox; + private ColorSelectBox normalBorderColorBox; + private UIComboBox normalFontNameComboBox; + private UIComboBox normalFontSizeComboBox; + private UIColorButton normalFontColorButton; + private UIToggleButton normalFontItalicButton; + private UIToggleButton normalFontBoldButton; + + private ColorSelectBox selectedBackgroundColorBox; + private NumberDragBar selectedOpacityDragBar; + private UnsignedIntUISpinner selectedOpacitySpinner; + private LineComboBox selectedBorderWidthComBox; + private ColorSelectBox selectedBorderColorBox; + private UIComboBox selectedFontNameComboBox; + private UIComboBox selectedFontSizeComboBox; + private UIColorButton selectedFontColorButton; + private UIToggleButton selectedFontItalicButton; + private UIToggleButton selectedFontBoldButton; + + private SidebarMobileBookMarkStyle DEFAULT_STYLE = new SidebarMobileBookMarkStyle(); + + public SidebarMobileBookMarkStyleCustomDefinePane() { + this.initComponent(); + } + + private void initComponent() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + + this.add(this.createNavButtonStylePanel()); + this.add(this.createNormalStateStylePanel()); + this.add(this.createSelectedStateStylePanel()); + } + + private JPanel createNavButtonStylePanel() { + + buttonWidthSpinner = new UnsignedIntUISpinner(20, 150, 1, DEFAULT_STYLE.getWidth()); + buttonHeightSpinner = new UnsignedIntUISpinner(20, 100, 1, DEFAULT_STYLE.getHeight()); + buttonGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getGap()); + buttonBorderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getBorderRadius()); + + UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":", + SwingConstants.RIGHT); + JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + sizePane.add(buttonWidthSpinner); + sizePane.add(buttonHeightSpinner); + + JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"), + SwingConstants.CENTER)); + sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"), + SwingConstants.CENTER)); + + UILabel gapLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Gap") + ":", + SwingConstants.RIGHT); + UILabel borderRadiusLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Border_Radius") + ":", + SwingConstants.RIGHT); + + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, COLUMN_WIDTH}; + double[] verticalGaps = {0, 10, 10}; + + JPanel navButtonSettingsPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{ + {sizeLabel, sizePane}, + {null, sizeTipsPane}, + {gapLabel, buttonGapSpinner}, + {borderRadiusLabel, buttonBorderRadiusSpinner}, + }, rowSize, columnSize, 5, verticalGaps); + + navButtonSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + + JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + containerPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Style"), + Color.decode("#2F8EF1"))); + containerPane.add(navButtonSettingsPanel); + + return containerPane; + } + + private JPanel createNormalStateStylePanel() { + double p = TableLayout.PREFERRED; + + normalBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH); + normalBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getBackgroundColor()); + normalOpacityDragBar = new NumberDragBar(0, 100); + normalOpacityDragBar.setValue(DEFAULT_STYLE.getOpacity()); + normalOpacityDragBar.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + normalOpacitySpinner.setValue(normalOpacityDragBar.getValue()); + } + }); + normalOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getOpacity()); + normalOpacitySpinner.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + normalOpacityDragBar.setValue((int) normalOpacitySpinner.getValue()); + } + }); + normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderWidth()); + normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); + normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor()); + normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + normalFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily()); + normalFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + normalFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getFontSize()); + normalFontColorButton = new UIColorButton(); + normalFontColorButton.setColor(DEFAULT_STYLE.getFontColor()); + normalFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + normalFontItalicButton.setSelected(DEFAULT_STYLE.isFontItalic()); + normalFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); + normalFontBoldButton.setSelected(DEFAULT_STYLE.isFontBold()); + + JPanel opacityPane = new JPanel(new BorderLayout(0, 0)); + JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + jp.add(normalOpacityDragBar); + jp.add(normalOpacitySpinner); + opacityPane.add(jp, BorderLayout.CENTER); + + JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}}, + new double[]{p}, + new double[]{p, p, p, p}, + 0, 5 + ); + + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p, COLUMN_WIDTH, p}; + + JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT), + normalBackgroundColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT), + opacityPane, + new UILabel("%") + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT), + normalBorderWidthComBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT), + normalBorderColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT), + normalFontNameComboBox, + fontExtraPane + } + }, rowSize, columnSize, 5, 10); + normalStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + + JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + containerPane.setBorder( + GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Normal_Style"), + Color.decode("#2F8EF1")) + ); + containerPane.add(normalStateStyleSettingsPanel); + + return containerPane; + } + + private JPanel createSelectedStateStylePanel() { + double p = TableLayout.PREFERRED; + + selectedBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH); + selectedBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBackgroundColor()); + selectedOpacityDragBar = new NumberDragBar(0, 100); + selectedOpacityDragBar.setValue(DEFAULT_STYLE.getSelectedOpacity()); + selectedOpacityDragBar.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + selectedOpacitySpinner.setValue(selectedOpacityDragBar.getValue()); + } + }); + selectedOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getSelectedOpacity()); + selectedOpacitySpinner.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + selectedOpacityDragBar.setValue((int) selectedOpacitySpinner.getValue()); + } + }); + selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); + selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderWidth()); + selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); + selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor()); + selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + selectedFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily()); + selectedFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); + selectedFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontSize()); + selectedFontColorButton = new UIColorButton(); + selectedFontColorButton.setColor(DEFAULT_STYLE.getSelectedFontColor()); + selectedFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + selectedFontItalicButton.setSelected(DEFAULT_STYLE.isSelectedFontItalic()); + selectedFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); + selectedFontBoldButton.setSelected(DEFAULT_STYLE.isSelectedFontBold()); + + JPanel opacityPane = new JPanel(new BorderLayout(0, 0)); + JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); + jp.add(selectedOpacityDragBar); + jp.add(selectedOpacitySpinner); + opacityPane.add(jp, BorderLayout.CENTER); + + JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( + new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}}, + new double[]{p}, + new double[]{p, p, p, p}, + 0, 5 + ); + + double[] rowSize = {p, p, p, p, p}; + double[] columnSize = {p, COLUMN_WIDTH, p}; + + JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT), + selectedBackgroundColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT), + opacityPane, + new UILabel("%") + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT), + selectedBorderWidthComBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT), + selectedBorderColorBox + }, + { + new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT), + selectedFontNameComboBox, + fontExtraPane + } + }, rowSize, columnSize, 5, 10); + selectedStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + + JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + containerPane.setBorder( + GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Selected_Style"), + Color.decode("#2F8EF1")) + ); + containerPane.add(selectedStateStyleSettingsPanel); + + return containerPane; + } + + @Override + public void populateBean(MobileBookMarkStyle ob) { + SidebarMobileBookMarkStyle style = null; + if (ob instanceof SidebarMobileBookMarkStyle) { + style = (SidebarMobileBookMarkStyle) ob; + } + if (style == null) { + return; + } + + buttonWidthSpinner.setValue(style.getWidth()); + buttonHeightSpinner.setValue(style.getHeight()); + buttonGapSpinner.setValue(style.getGap()); + buttonBorderRadiusSpinner.setValue(style.getBorderRadius()); + + normalBackgroundColorBox.setSelectObject(style.getBackgroundColor()); + normalOpacityDragBar.setValue(style.getOpacity()); + normalOpacitySpinner.setValue(style.getOpacity()); + normalBorderWidthComBox.setSelectedLineStyle(style.getBorderWidth()); + normalBorderColorBox.setSelectObject(style.getBorderColor()); + normalFontNameComboBox.setSelectedItem(style.getFontFamily()); + normalFontSizeComboBox.setSelectedItem(style.getFontSize()); + normalFontColorButton.setColor(style.getFontColor()); + normalFontItalicButton.setSelected(style.isFontItalic()); + normalFontBoldButton.setSelected(style.isFontBold()); + + selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor()); + selectedOpacityDragBar.setValue(style.getSelectedOpacity()); + selectedOpacitySpinner.setValue(style.getSelectedOpacity()); + selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderWidth()); + selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor()); + selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily()); + selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize()); + selectedFontColorButton.setColor(style.getSelectedFontColor()); + selectedFontItalicButton.setSelected(style.isSelectedFontItalic()); + selectedFontBoldButton.setSelected(style.isSelectedFontBold()); + } + + @Override + public MobileBookMarkStyle updateBean() { + SidebarMobileBookMarkStyle style = new SidebarMobileBookMarkStyle(); + + style.setWidth((int) buttonWidthSpinner.getValue()); + style.setHeight((int) buttonHeightSpinner.getValue()); + style.setGap((int) buttonGapSpinner.getValue()); + style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue()); + + if (normalBackgroundColorBox.getSelectObject() != null) { + style.setBackgroundColor(normalBackgroundColorBox.getSelectObject()); + } + style.setOpacity((int) normalOpacitySpinner.getValue()); + style.setBorderWidth(normalBorderWidthComBox.getSelectedLineStyle()); + style.setBorderColor(normalBorderColorBox.getSelectObject()); + if (normalFontNameComboBox.getSelectedItem() != null) { + style.setFontFamily((String) normalFontNameComboBox.getSelectedItem()); + } + if (normalFontSizeComboBox.getSelectedItem() != null) { + style.setFontSize((Integer) normalFontSizeComboBox.getSelectedItem()); + } + style.setFontColor(normalFontColorButton.getColor()); + style.setFontItalic(normalFontItalicButton.isSelected()); + style.setFontBold(normalFontBoldButton.isSelected()); + + if (selectedBackgroundColorBox.getSelectObject() != null) { + style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject()); + } + style.setSelectedOpacity((int) selectedOpacitySpinner.getValue()); + style.setSelectedBorderWidth(selectedBorderWidthComBox.getSelectedLineStyle()); + style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject()); + if (selectedFontNameComboBox.getSelectedItem() != null) { + style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem()); + } + if (selectedFontSizeComboBox.getSelectedItem() != null) { + style.setSelectedFontSize((Integer) selectedFontSizeComboBox.getSelectedItem()); + } + style.setSelectedFontColor(selectedFontColorButton.getColor()); + style.setSelectedFontItalic(selectedFontItalicButton.isSelected()); + style.setSelectedFontBold(selectedFontBoldButton.isSelected()); + + return style; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java new file mode 100644 index 0000000000..7c9202f3fd --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleProvider.java @@ -0,0 +1,30 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractMobileBookMarkStyleProvider; +import com.fr.design.i18n.Toolkit; +import com.fr.form.ui.mobile.MobileBookMarkStyle; +import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle; + +/** + * @author Starryi + * @version 10.0 + * Created by Starryi on 2020/02/28 + */ +public class SidebarMobileBookMarkStyleProvider extends AbstractMobileBookMarkStyleProvider { + + @Override + public Class classForMobileBookMarkStyle() { + return SidebarMobileBookMarkStyle.class; + } + + @Override + public Class> classForMobileBookMarkStyleAppearance() { + return SidebarMobileBookMarkStyleCustomDefinePane.class; + } + + @Override + public String displayName() { + return Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java index 15d8bae63e..8216ad5735 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java @@ -31,7 +31,7 @@ import java.util.List; public class FileVersionDialog extends UIDialog { - public static final long DELAY = 24 * 60 * 60 * 1000; + public static final long DELAY = 24 * 60 * 60 * 1000L; private UIButton okBtn; private UIButton cancelBtn; private DateEditor dateEditor; diff --git a/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java new file mode 100644 index 0000000000..bc09dbf6a1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java @@ -0,0 +1,45 @@ +package com.fr.design.os.impl; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.exit.DesignerExiter; +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.os.support.OSBasedAction; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/13 + */ +public class MacOsAddListenerAction implements OSBasedAction { + + @Override + public void execute(final Object... objects) { + try { + Class app = Class.forName("com.apple.eawt.Application"); + Class handler = Class.forName("com.apple.eawt.QuitHandler"); + Object instance = Proxy.newProxyInstance(handler.getClassLoader(), new Class[]{handler}, + new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, + Object[] args) throws Throwable { + if ("handleQuitRequestWith".equals(method.getName())) { + if (DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isShowing()) { + DesignerContext.getDesignerFrame().exit(); + } else { + DesignerExiter.getInstance().execute(); + } + } + return null; + } + }); + Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", instance); + } catch (ClassNotFoundException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 9bc29b8295..f6c0e30549 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -73,6 +73,30 @@ public enum SupportOSImpl implements SupportOS { public boolean support() { return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM; } + }, + + /** + * mac下dock栏右键退出 + */ + DOCK_QUIT { + @Override + public boolean support() { + return OperatingSystem.isMacos(); + } + }, + + NON_GUARDIAN_START { + @Override + public boolean support() { + return OperatingSystem.isLinux() || Arch.getArch() == Arch.ARM; + } + }, + + DOCK_ICON { + @Override + public boolean support() { + return OperatingSystem.isMacos(); + } } } diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java index 14487ca5fa..8e8819c67d 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java @@ -17,6 +17,7 @@ import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.FloatEditor; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.editor.editor.TextEditor; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -24,6 +25,8 @@ import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.util.ArrayList; import java.util.Date; @@ -103,6 +106,12 @@ public class ParameterInputPane extends BasicPane { contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane)); //add editor to parameter hashtable. + textF.getCurrentEditor().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); + } + }); this.editorNameMap.put(textF, parameter.getName()); nameAddedList.add(parameter.getName()); } diff --git a/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java b/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java index 3e0a9eb068..2cd482e1e3 100644 --- a/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java +++ b/designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java @@ -20,7 +20,7 @@ public class VerticalRulerUI extends RulerUI{ @Override protected void paintRuler(Graphics g, int showText, int extra, Dimension size, int ratio) { int k = pxToLength(extra) * ratio; - for (int i = k; i < (pxToLength(size.height + extra) + 1) * ratio; i++) { + for (int i = k; i < (pxToLength( (double)size.height + extra) + 1) * ratio; i++) { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_10 == 0) { double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution(); @@ -44,7 +44,7 @@ public class VerticalRulerUI extends RulerUI{ @Override protected void paintPTRuler(Graphics g, int extra, Dimension size, int unit) { int k = pxToLength(extra); - for (int i = unit * (k/unit); i < pxToLength(size.height + extra); i += unit) { + for (int i = unit * (k/unit); i < pxToLength((double)size.height + extra); i += unit) { g.setColor(BaseRuler.UNIT_SIGN_COLOR); if (i % BaseRuler.SCALE_100 == 0) { GraphHelper.drawLine(g, size.width, toPX(i) - extra, 0, toPX(i) - extra); diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java index ffb4e1eb0b..886076ca08 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java @@ -159,15 +159,15 @@ public class PatternBackgroundPane extends BPane { Dimension d = getSize(); this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, - d.width - 1, d.height - 1)); + d.width - 1d, d.height - 1d)); if (this.pIndex == patternIndex) {// it's selected. g2d.setPaint(new Color(255, 51, 0)); } else { g2d.setPaint(Color.gray); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); } public Dimension getPreferredSize() { diff --git a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java index 8c99a89cdd..3dd59bd5b4 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java @@ -152,8 +152,8 @@ public class TextureBackgroundPane extends BPane { Dimension d = getSize(); g2d.setPaint(this.buttonTexturePaint); - GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's // selected. @@ -161,8 +161,8 @@ public class TextureBackgroundPane extends BPane { } else { g2d.setPaint(Color.gray); } - GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, - d.height - 1)); + GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d, + d.height - 1d)); } public Dimension getPreferredSize() { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java index b5a5e40752..4ee3a119ea 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java @@ -38,6 +38,10 @@ public abstract class ColorControlWindow extends JPopupMenu { return selectionPopupPane.getColor(); } + public PopupHider getPopupHider() { + return popupHider; + } + /** * Init components. */ @@ -49,9 +53,13 @@ public abstract class ColorControlWindow extends JPopupMenu { setOpaque(false); setDoubleBuffered(true); setFocusable(false); + initSelectionPopupPane(isSupportTransparent); + this.pack(); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { selectionPopupPane = new ColorSelectionPopupPane(isSupportTransparent); this.add(selectionPopupPane, BorderLayout.CENTER); - this.pack(); } class ColorSelectionPopupPane extends NewColorSelectPane { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java new file mode 100644 index 0000000000..cbb0e97eaa --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java @@ -0,0 +1,126 @@ +package com.fr.design.style.color; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ipoppane.PopupHider; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; + +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public abstract class ColorControlWindowWithAuto extends ColorControlWindow { + + private ColorSelectionPopupPaneWithAuto selectionPopupPaneWithAuto; + + public ColorControlWindowWithAuto(PopupHider popupHider) { + this(false, popupHider); + } + + public ColorControlWindowWithAuto(boolean isSupportTransparent, PopupHider popupHider) { + super(isSupportTransparent, popupHider); + } + + public Color getColor() { + if (selectionPopupPaneWithAuto == null) { + return null; + } + return selectionPopupPaneWithAuto.getColor(); + } + + protected void initSelectionPopupPane(boolean isSupportTransparent) { + selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent); + this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER); + } + + class ColorSelectionPopupPaneWithAuto extends NewColorSelectPane { + private static final long serialVersionUID = 7822856562329146354L; + + private final static int BUTTON_HEIGHT = 15; + + public ColorSelectionPopupPaneWithAuto(boolean isSupportTransparent) { + super(isSupportTransparent); + + this.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + colorChanged(); + } + }); + } + + protected void doTransparent() { + getPopupHider().hidePopupMenu(); + setColor(null); + } + + protected void doAuto() { + getPopupHider().hidePopupMenu(); + setColor(ChartConstants.AUTO_FONT_COLOR); + } + + public void customButtonPressed() { + getPopupHider().hidePopupMenu(); + super.customButtonPressed(); + } + + protected void initSelectButton(boolean isSupportTransparent) { + setSupportTransparent(isSupportTransparent); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); + + UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + UIButton autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto")); + + transparentButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doTransparent(); + } + }); + + autoButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + doAuto(); + } + }); + + if (isSupportTransparent) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, 0}; + double[] rowSize = {p, p}; + + Component[][] components = new Component[][]{ + new Component[]{autoButton, null}, + new Component[]{transparentButton, null} + }; + + JPanel buttonGroup = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.add(buttonGroup, BorderLayout.NORTH); + } else { + this.add(autoButton, BorderLayout.NORTH); + } + } + + public Dimension getPreferredSize() { + if (isSupportTransparent()) { + return new Dimension(super.getPreferredSize().width, TRANSPARENT_WINDOW_HEIGHT + BUTTON_HEIGHT); + } + return new Dimension(super.getPreferredSize().width, WINDOW_HEIGHT + BUTTON_HEIGHT); + } + + } + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index d532324165..6c21c10cba 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -5,6 +5,7 @@ import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; @@ -39,8 +40,8 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { // 是否支持透明 private boolean isSupportTransparent; - private final static int TRANSPANENT_WINDOW_HEIGHT = 165; - private final static int WINDWO_HEIGHT = 150; + public final static int TRANSPARENT_WINDOW_HEIGHT = 165; + public final static int WINDOW_HEIGHT = 150; // 最近使用颜色 private UsedColorPane usedColorPane; @@ -56,20 +57,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { * Constructor. */ NewColorSelectPane(boolean isSupportTransparent) { - this.isSupportTransparent = isSupportTransparent; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); - if (isSupportTransparent) { - UIButton transpanrentButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); - this.add(transpanrentButton, BorderLayout.NORTH); - transpanrentButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - doTransparent(); - } - }); - } + initSelectButton(isSupportTransparent); // center JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); @@ -97,7 +85,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_More_Color")); // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) customButton.addMouseListener(new MouseAdapter() { @@ -117,6 +105,31 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(centerPane1); } + public boolean isSupportTransparent() { + return isSupportTransparent; + } + + public void setSupportTransparent(boolean supportTransparent) { + isSupportTransparent = supportTransparent; + } + + protected void initSelectButton(boolean isSupportTransparent){ + this.isSupportTransparent = isSupportTransparent; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); + if (isSupportTransparent) { + UIButton transparentButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_ChartF_Transparency")); + this.add(transparentButton, BorderLayout.NORTH); + transparentButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + doTransparent(); + } + }); + } + } + /** * 添加监听 @@ -199,9 +212,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { @Override public Dimension getPreferredSize() { if (isSupportTransparent) { - return new Dimension(super.getPreferredSize().width, TRANSPANENT_WINDOW_HEIGHT); + return new Dimension(super.getPreferredSize().width, TRANSPARENT_WINDOW_HEIGHT); } - return new Dimension(super.getPreferredSize().width, WINDWO_HEIGHT); + return new Dimension(super.getPreferredSize().width, WINDOW_HEIGHT); } /** diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index 12b1d74b7c..efd809e791 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -58,7 +58,14 @@ public class DesignerPushUpdateManager { private String getFullLatestVersion() { try { - String res = HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update")); + String url = CloudCenter.getInstance().acquireUrlByKind("jar10.update"); + if(StringUtils.isBlank(url)){ + return StringUtils.EMPTY; + } + String res = HttpToolbox.get(url); + if(StringUtils.isBlank(res)){ + return StringUtils.EMPTY; + } return new JSONObject(res).optString("buildNO"); } catch (Throwable e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java index 52e4144deb..78df599c57 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java @@ -30,6 +30,8 @@ import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.stable.*; import com.fr.stable.project.ProjectConstants; import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; @@ -598,6 +600,7 @@ public class UpdateMainDialog extends UIDialog { final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB); final JFrame frame = DesignerContext.getDesignerFrame(); final RestartHelper helper = new RestartHelper(); + FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); new FileProcess(callBack) { @Override public void onDownloadSuccess() { diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 6698a171fd..09a5b683dc 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -9,6 +9,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; import com.fr.design.mainframe.DesignerContext; +import com.fr.exit.DesignerExiter; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; @@ -30,7 +31,9 @@ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; +import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.ServerSocket; @@ -39,15 +42,21 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.Locale; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; /** * Some util method of Designer */ public class DesignUtils { - private static int port = DesignerPort.MESSAGE_PORT; + private static int port = DesignerPort.getInstance().getMessagePort(); + + private static boolean started = false; private DesignUtils() { } @@ -62,15 +71,54 @@ public class DesignUtils { } /** - * 通过端口是否被占用判断设计器有没有启动 - * s + * 判断设计器有没有启动 * * @return 启动了返回true */ public static boolean isStarted() { - try (Socket socket = new Socket("localhost", port)) { + return started; + } + + + /** + * 判断设计器端口是否被其他程序占用 + * 尝试去通信,无回应就是其他程序占用端口,否则需要继续判断是否为设计器进程未关闭 + * @return + */ + public static boolean isPortOccupied() { + ExecutorService executor = null; + Future future = null; + try (Socket socket = new Socket("localhost", port); + BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8)); + PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8)))) { + writer.println("check"); + writer.flush(); + executor = Executors.newSingleThreadExecutor(); + future = executor.submit(new Callable() { + @Override + public String call() throws Exception { + String line; + while ((line = reader.readLine()) != null) { + if ("response".equals(line)) { + // 正常通信 上一次设计器进程未关闭 + started = true; + return line; + } + } + return StringUtils.EMPTY; + } + }); + future.get(2, TimeUnit.SECONDS); + return false; + } catch (TimeoutException e) { + future.cancel(true); return true; - } catch (Exception ignored) { + } catch (Exception ignore) { + + } finally { + if (executor != null) { + executor.shutdownNow(); + } } return false; } @@ -80,15 +128,12 @@ public class DesignUtils { * * @param lines 命令行 */ - public static void clientSend(String[] lines) { + public static void clientSend(String[] lines, Socket socket) { if (lines == null || lines.length == 0) { return; } - Socket socket = null; PrintWriter writer = null; try { - socket = new Socket("localhost", port); - writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8))); for (int i = 0; i < lines.length; i++) { writer.println(lines[i]); @@ -97,19 +142,23 @@ public class DesignUtils { } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } finally { - try { - if (writer != null) { - writer.close(); - } - if (socket != null) { - socket.close(); - } - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + if (writer != null) { + writer.close(); } } } + public static void clientSend(String[] lines) { + if (lines == null || lines.length == 0) { + return; + } + try (Socket socket = new Socket("localhost", port)) { + clientSend(lines, socket); + } catch (Exception ignore) { + + } + } + /** * 建立监听端口 * @@ -139,7 +188,11 @@ public class DesignUtils { if (line.startsWith("demo")) { DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); ServerStarter.browserDemoURL(); - } else if (StringUtils.isNotEmpty(line)) { + } else if ("check".equals(line)) { + clientSend(new String[] {"response"}, socket); + } else if ("end".equals(line)) { + DesignerExiter.getInstance().execute(); } + else if (StringUtils.isNotEmpty(line)) { File f = new File(line); String path = f.getAbsolutePath(); @@ -166,6 +219,14 @@ public class DesignUtils { } + public static void responseToClient(Socket socket) { + try (OutputStream outputStream = socket.getOutputStream()) { + outputStream.write("reponse".getBytes(StandardCharsets.UTF_8)); + outputStream.flush(); + } catch (IOException ignore) { + } + } + /** * 弹出对话框,显示报错 * diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java index 7c082800ed..55dc1f00d9 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -1,26 +1,222 @@ package com.fr.design.utils; +import com.fr.design.DesignerEnvManager; +import com.fr.design.RestartHelper; +import com.fr.design.dialog.TipDialog; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.exit.DesignerExiter; +import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLReadable; +import com.fr.stable.xml.XMLWriter; +import com.fr.stable.xml.XMLableReader; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + /** * 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化 */ -public class DesignerPort { +public class DesignerPort implements XMLReadable, XMLWriter { + + public static final String XML_TAG = "DesignerPort"; + private static final int MIN_PORT = 1024; + private static final int MAX_PORT = 65535; + + public static final DesignerPort INSTANCE = new DesignerPort(); + + public static DesignerPort getInstance() { + return INSTANCE; + } + private DesignerPort() { } /** - * 设计器端口,避免编译期常量优化展开 + * 设计器端口 */ - public static final int MESSAGE_PORT = getMessagePort(); + private int messagePort = 51462; + /** - * 设计器端口,避免编译期常量优化展开 + * 设计器端口,debug模式下 */ - public static final int DEBUG_MESSAGE_PORT = getDebugMessagePort(); + private int debugMessagePort = 51463; + + public int getMessagePort() { + return messagePort; + } + + public int getDebugMessagePort() { + return debugMessagePort; + } + + public void setMessagePort(int messagePort) { + this.messagePort = messagePort; + } + + public void setDebugMessagePort(int debugMessagePort) { + this.debugMessagePort = debugMessagePort; + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isAttr()) { + this.setMessagePort(reader.getAttrAsInt("messagePort", 51462)); + this.setDebugMessagePort(reader.getAttrAsInt("debugMessagePort", 51463)); + } + } - private static int getMessagePort() { - return 51462; + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(XML_TAG); + writer.attr("messagePort", this.messagePort); + writer.attr("debugMessagePort", this.debugMessagePort); + writer.end(); } - private static int getDebugMessagePort() { - return 51463; + public void resetPort() { + + TipDialog dialog = new TipDialog(null, + StringUtils.EMPTY, + Toolkit.i18nText("Fine-Design_Port_Found_Port_Conflict"), + Toolkit.i18nText("Fine-Design_End_Occupied_Process"), + Toolkit.i18nText("Fine-Design_Modify_Designer_Port")) { + @Override + protected void endEvent() { + dispose(); + } + + @Override + protected void cancelEvent() { + new ResetPortDialog(); + } + }; + dialog.setVisible(true); + DesignerExiter.getInstance().execute(); } + + private class ResetPortDialog extends JDialog { + private UITextField portFiled; + private UILabel warnLabel; + private UIButton okButton; + + private ResetPortDialog() { + this.setLayout(new BorderLayout()); + this.setModal(true); + this.portFiled = new UITextField(); + this.portFiled.setPreferredSize(new Dimension(180, 20)); + this.portFiled.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + checkValid(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + checkValid(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + checkValid(); + } + }); + JPanel iconPanel = new JPanel(); + UILabel iconLabel = new UILabel(); + iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/edit/edit_typing.png")); + iconPanel.add(iconLabel); + iconPanel.add(iconLabel); + JPanel textPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); + textPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Tip"))); + textPane.add(portFiled); + warnLabel = new UILabel(); + warnLabel.setVisible(false); + warnLabel.setForeground(Color.RED); + okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_OK")); + okButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int value = Integer.parseInt(portFiled.getText().trim()); + if (ComparatorUtils.equals("true", System.getProperty("debug"))) { + setDebugMessagePort(value); + } else { + setMessagePort(value); + } + dispose(); + DesignerEnvManager.getEnvManager().saveXMLFile(); + RestartHelper.restart(); + } + }); + UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")); + cancelButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + dispose(); + } + }); + JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); + buttonPane.add(okButton); + buttonPane.add(cancelButton); + JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + controlPane.add(buttonPane, BorderLayout.EAST); + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + northPane.add(iconPanel, BorderLayout.WEST); + northPane.add(textPane, BorderLayout.CENTER); + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.add(warnLabel); + JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + southPane.add(controlPane); + this.add(northPane, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + this.add(southPane, BorderLayout.SOUTH); + this.setSize(300, 150); + this.setTitle(Toolkit.i18nText("Fine-Design_Modify_Designer_Port")); + this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + this.setResizable(false); + this.setAlwaysOnTop(true); + GUICoreUtils.centerWindow(this); + this.setVisible(true); + } + + private void checkValid() { + String port = this.portFiled.getText().trim(); + if (StringUtils.isEmpty(port)) { + okButton.setEnabled(false); + return; + } + + int value; + try { + value = Integer.parseInt(port); + } catch (NumberFormatException ignore) { + warnLabel.setText(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Not_Number_Tip")); + warnLabel.setVisible(true); + okButton.setEnabled(false); + return; + } + + if (value < MIN_PORT || value > MAX_PORT) { + warnLabel.setText(Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Out_Of_Range_Tip")); + warnLabel.setVisible(true); + okButton.setEnabled(false); + return; + } + + warnLabel.setVisible(false); + okButton.setEnabled(true); + } + } + } diff --git a/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java b/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java index fcb272dd54..d07d42b3e2 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/CustomJobPane.java @@ -29,7 +29,7 @@ import java.awt.event.ActionListener; public abstract class CustomJobPane extends BasicBeanPane { protected UITextField classNameTextField; protected ObjectProperiesPane objectProperiesPane; - public static final int DEFAULT_LENGTH = 30; + private static final int DEFAULT_LENGTH = 25; public CustomJobPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index 15e5aed4a7..9df5d7916a 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -701,7 +701,7 @@ public class DBManipulationPane extends BasicBeanPane { } jobs = new NameSubmitJob[dmlConfig.getSubmitJobCount()]; for (int i = 0; i < jobs.length; i++) { - jobs[i] = dmlConfig.getSubmitJob(i); + jobs[i] = dmlConfig.getNameSubmitJob(i); } condition = dmlConfig.getCondition(); UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected()); diff --git a/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java new file mode 100644 index 0000000000..9134d6429f --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/CheckServiceDialog.java @@ -0,0 +1,135 @@ +package com.fr.env; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.env.RemoteDesignerWorkspaceInfo; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.env.utils.DisplayUtils; +import com.fr.general.FRFont; +import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +/** + * @author: Maksim + * @Date: Created in 2020/2/3 + * @Description: 远程连接时,服务检测提醒对话框 + */ +public class CheckServiceDialog extends JDialog implements ActionListener { + private JPanel topPanel; + private JPanel centerPanel; + private JPanel bottomPanel; + private UICheckBox remindBox; + + public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){ + super(parent,true); + //上面的标签面板 + topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel imagePanel = new JPanel(); + Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning5.png"); + + JLabel imageLabel = new JLabel(); + imageLabel.setIcon(icon); + imagePanel.add(imageLabel); + imagePanel.setPreferredSize(new Dimension(110,100)); + + JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + FRFont font = FRFont.getInstance(); + font = font.applySize(15).applyStyle(1); + JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency")); + label.setFont(font); + label.setPreferredSize(new Dimension(650,30)); + + String text = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch + + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch; + String delimiter = DisplayUtils.getDisplayLength(text) > 70? "
":"/"; + JLabel label2 = new JLabel(""+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + + localBranch + delimiter + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+""); + label2.setPreferredSize(new Dimension(600,30)); + + JTextPane tipsPane = new JTextPane(); + tipsPane.setEditable(false); + tipsPane.setBackground(verticalPanel.getBackground()); + tipsPane.setPreferredSize(new Dimension(500,40)); + tipsPane.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update")); + + verticalPanel.add(label); + verticalPanel.add(label2); + verticalPanel.add(tipsPane); + + topPanel.add(imagePanel,BorderLayout.WEST); + topPanel.add(verticalPanel,BorderLayout.CENTER); + topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,0,10)); + + //中间的文本域面板 + centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + centerPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); + centerPanel.setPreferredSize(new Dimension(480,320)); + + JLabel titleLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Affected_Function")); + titleLabel.setPreferredSize(new Dimension(400,40)); + JTextArea checkArea = new JTextArea(areaText); + checkArea.setEnabled(false); + centerPanel.add(titleLabel,BorderLayout.NORTH); + centerPanel.add(checkArea,BorderLayout.CENTER); + + //下面的按钮面板 + remindBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remind_Show")); + remindBox.addActionListener(remindCheckboxListener); + UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm")); + JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); + buttonPanel.add(remindBox, BorderLayout.WEST); + buttonPanel.add(okButton,BorderLayout.EAST); + okButton.addActionListener(this ); + bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + bottomPanel.add(buttonPanel); + + this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint")); + this.setResizable(false); + + this.add(topPanel,BorderLayout.NORTH); + this.add(centerPanel, BorderLayout.CENTER); + this.add(buttonPanel,BorderLayout.SOUTH); + this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 750:600, 500)); + + GUICoreUtils.centerWindow(this); + } + @Override + public void actionPerformed(ActionEvent e) { + this.dispose(); + } + + + private ActionListener remindCheckboxListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String remindTime = format.format(new Date()); + //环境已切换,通过当前环境获取,一定是远程环境 + String currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName(); + RemoteDesignerWorkspaceInfo currentEnv = (RemoteDesignerWorkspaceInfo)DesignerEnvManager.getEnvManager().getWorkspaceInfo(currentEnvName); + currentEnv.setRemindTime(remindBox.isSelected()? remindTime : ""); + } + }; + +} diff --git a/designer-base/src/main/java/com/fr/env/EnvListPane.java b/designer-base/src/main/java/com/fr/env/EnvListPane.java index 6300abe95a..911a7b22f8 100644 --- a/designer-base/src/main/java/com/fr/env/EnvListPane.java +++ b/designer-base/src/main/java/com/fr/env/EnvListPane.java @@ -96,8 +96,9 @@ public class EnvListPane extends JListControlPane { */ public String updateEnvManager() { DesignerEnvManager mgr = DesignerEnvManager.getEnvManager(); - mgr.clearAllEnv(); + //这里代码时序换一下,因为update中需要借助mgr来获取提醒时间,已确认mgr对res无依赖 Nameable[] res = this.update(); + mgr.clearAllEnv(); for (Nameable re : res) { NameObject nameObject = (NameObject) re; mgr.putEnv(nameObject.getName(), (DesignerWorkspaceInfo) nameObject.getObject()); diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 4871bb769c..9ea2f7019e 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -10,6 +10,7 @@ import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.itextfield.UITextField; @@ -25,17 +26,7 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.exception.WorkspaceAuthException; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JPanel; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import javax.swing.ToolTipManager; -import javax.swing.UIManager; +import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -295,10 +286,13 @@ public class RemoteEnvPane extends BasicBeanPane { contentPanel.add(configPanel, BorderLayout.NORTH); contentPanel.add(accountPanel, BorderLayout.CENTER); - + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.add(contentPanel, BorderLayout.NORTH); + panel.add(testPanel, BorderLayout.CENTER); + panel.setPreferredSize(new Dimension(440, 600)); + UIScrollPane scrollPane = new UIScrollPane(panel); this.setLayout(new BorderLayout()); - this.add(contentPanel, BorderLayout.NORTH); - this.add(testPanel, BorderLayout.CENTER); + this.add(scrollPane); } @Override diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 5362dbbd83..4524254f40 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -34,7 +34,7 @@ public enum TestConnectionResult { }, /** - * 不完全成功,版本不匹配,但测试连接成功。 + * 不完全成功,版本不匹配,但测试连接成功。该状态先保留 */ PARTLY_SUCCESS { @Override @@ -89,16 +89,7 @@ public enum TestConnectionResult { if (!value) { return FULLY_FAILED; } - try { - String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); - if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { - return FULLY_SUCCESS; - } - return PARTLY_SUCCESS; - } catch (Exception e) { - // 发生异常,说明没连接上。返回完全失败。 - FineLoggerFactory.getLogger().error(e.getMessage()); - return FULLY_FAILED; - } + //去掉测试连接时所做的检测 + return FULLY_SUCCESS; } } diff --git a/designer-base/src/main/java/com/fr/env/utils/DisplayUtils.java b/designer-base/src/main/java/com/fr/env/utils/DisplayUtils.java new file mode 100644 index 0000000000..1795c5fb14 --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/utils/DisplayUtils.java @@ -0,0 +1,39 @@ +package com.fr.env.utils; + +/** + * @author: Maksim + * @Date: Created in 2020/3/16 + * @Description: + */ +public class DisplayUtils { + + /** + * 获取字符串显示时的计算长度 + * @param text 被计算的字符串 + * @return 计算长度 + */ + public static int getDisplayLength(String text){ + if (text == null) { + return 0; + } + char[] c = text.toCharArray(); + int len = 0; + for (int i = 0; i < c.length; i++) { + len++; + if(!isLetter(c[i])){ + len++; + }; + } + return len; + } + + /** + * 判断字符是否为字母、数字、英文符号 + * @param c 传入的字符 + * @return 如果符合上述条件,返回true + */ + public static boolean isLetter(char c) { + int k = 0x80; + return c / k == 0; + } +} diff --git a/designer-base/src/main/java/com/fr/exit/DesignerExiter.java b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java new file mode 100644 index 0000000000..e7189511a1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/exit/DesignerExiter.java @@ -0,0 +1,33 @@ +package com.fr.exit; + +import com.fr.design.env.DesignerWorkspaceGenerator; +import com.fr.process.engine.core.FineProcessContext; +import com.fr.process.engine.core.FineProcessEngineEvent; +import com.fr.stable.StableUtils; + + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/2/12 + */ +public class DesignerExiter { + + public static final DesignerExiter INSTANCE = new DesignerExiter(); + + public static DesignerExiter getInstance() { + return INSTANCE; + } + + public void execute() { + beforeExit(); + if (FineProcessContext.getParentPipe() != null) { + FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY); + } + System.exit(0); + } + + private void beforeExit() { + DesignerWorkspaceGenerator.stop(); + } +} diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index ac76405d9f..0ca481b09b 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -505,6 +505,9 @@ public class FILEChooserPane extends BasicPane { if (StringUtils.isEmpty(fileName) || StringUtils.isEmpty(filterExtension) || fileFilter.containsExtension(fileExtension.getExtension())) { return fileName; } + if (!ComparatorUtils.equals(fileNameExtension, filterExtension)) { + return fileName + filterExtension; + } return fileNameWithOutExtension + filterExtension; } @@ -734,6 +737,7 @@ public class FILEChooserPane extends BasicPane { fileNameTextField.setText(""); fileNameTextField.addDocumentListener(); } + dialog.setAlwaysOnTop(true); dialog.setVisible(true); return option; } diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index dce2c38e0b..138cfe3456 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -23,7 +23,7 @@ import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.resource.WorkResourceTempRenameStream; import com.fr.workspace.server.lock.TplOperator; -import javax.swing.Icon; +import javax.swing.*; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.OutputStream; @@ -68,14 +68,14 @@ public class FileNodeFILE implements FILE { this.node = new FileNode(StableUtils.pathJoin(parentDir, name), isDir); this.envPath = WorkContext.getCurrent().getPath(); - this.hasFullAuth = NodeAuthProcessor.getInstance().fixFileNodeAuth(node); + this.hasFullAuth = NodeAuthProcessor.getInstance().checkFileNodeAuth(node); } public FileNodeFILE(FileNode node) { this.node = node; this.envPath = WorkContext.getCurrent().getPath(); - this.hasFullAuth = NodeAuthProcessor.getInstance().fixFileNodeAuth(node); + this.hasFullAuth = NodeAuthProcessor.getInstance().checkFileNodeAuth(node); } public FileNodeFILE(FileNode node, boolean hasFullAuth) { @@ -91,7 +91,7 @@ public class FileNodeFILE implements FILE { public FileNodeFILE(FileNode node, String envPath) { this.node = node; this.envPath = envPath; - this.hasFullAuth = NodeAuthProcessor.getInstance().fixFileNodeAuth(node); + this.hasFullAuth = NodeAuthProcessor.getInstance().checkFileNodeAuth(node); } public FileNodeFILE(FileNode node, String envPath, boolean hasFullAuth) { diff --git a/designer-base/src/main/java/com/fr/file/RenameExportFILE.java b/designer-base/src/main/java/com/fr/file/RenameExportFILE.java index 8b03e943f6..75583051dc 100644 --- a/designer-base/src/main/java/com/fr/file/RenameExportFILE.java +++ b/designer-base/src/main/java/com/fr/file/RenameExportFILE.java @@ -99,4 +99,9 @@ public class RenameExportFILE extends AbstractFILE { } return out; } + + @Override + public void closeTemplate() throws Exception { + //do nothing + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java b/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java index a25ebe7b6e..147e1946d4 100644 --- a/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java +++ b/designer-base/src/main/java/com/fr/file/filter/ChooseFileFilter.java @@ -4,6 +4,8 @@ import com.fr.base.extension.FileExtension; import com.fr.file.FILE; import com.fr.file.FileFILE; import com.fr.general.ComparatorUtils; +import com.fr.stable.CoreConstants; +import com.fr.stable.StringUtils; import javax.swing.filechooser.FileFilter; import java.io.File; @@ -275,25 +277,25 @@ public class ChooseFileFilter extends FileFilter implements FILEFilter, java.io. } /** + * 默认情况下 返回首位的后缀名 * get extention. */ public String getExtensionString() { - if (filters == null) { - return ""; - } - - StringBuffer extsb = new StringBuffer("."); - -// Enumeration keys = filters.keys(); -// while (keys.hasMoreElements()) { -// extsb.append((String) keys.nextElement()); -// } + return getExtensionString(0); + } - for (int i = 0; i < filters.size(); i++) { - extsb.append(filters.get(i)); + public String getExtensionString(int index) { + if (filters == null || filters.isEmpty() || index >= filters.size()) { + return StringUtils.EMPTY; } + return CoreConstants.DOT + filters.get(index); + } - return extsb.toString(); + public int getExtensionCount() { + if (filters == null || filters.isEmpty()) { + return 0; + } + return filters.size(); } /** diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 3ad4708a84..90ac634ce0 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -14,11 +14,11 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.ui.util.UIUtil; -import com.fr.design.utils.DesignUtils; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; +import com.fr.exit.DesignerExiter; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; @@ -47,8 +47,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock { private void init() { prepare(); - // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 - DesignUtils.initLookAndFeel(); // 初始化Log Handler DesignerEnvManager.loadLogSetting(); createDesignerFrame(); @@ -137,7 +135,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { if (!isException) { showDesignerFrame(true); } else { - System.exit(0); + DesignerExiter.getInstance().execute(); } } } diff --git a/designer-base/src/main/java/com/fr/start/ServerStarter.java b/designer-base/src/main/java/com/fr/start/ServerStarter.java index d4e1143c61..d2b8498bb9 100644 --- a/designer-base/src/main/java/com/fr/start/ServerStarter.java +++ b/designer-base/src/main/java/com/fr/start/ServerStarter.java @@ -3,10 +3,9 @@ package com.fr.start; import com.fr.base.ServerConfig; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.BrowseUtils; -import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; -import com.fr.stable.StableUtils; import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServerMonitor; import com.fr.workspace.WorkContext; @@ -25,23 +24,11 @@ public class ServerStarter { if (!WorkContext.getCurrent().isLocal()) { //有问题,这里拿不到远程的http端口 BrowseUtils.browser(WorkContext.getCurrent().getPath()); - } else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用 - String web = GeneralContext.getCurrentAppNameOfEnv(); - browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + web + "/" + ServerConfig.getInstance().getServletName()); } else { - initDemoServerAndBrowser(); - } - - } - - - private static void initDemoServerAndBrowser() { - - try { - FineEmbedServer.start(); - } finally { - //先访问Demo, 后访问报表, 不需要重置服务器. - BrowseUtils.browser("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + GeneralContext.getCurrentAppNameOfEnv() + "/" + ServerConfig.getInstance().getServletName()); + browserURLWithLocalEnv("http://localhost:" + + DesignerEnvManager.getEnvManager().getEmbedServerPort() + + "/" + GeneralContext.getCurrentAppNameOfEnv() + + "/" + ServerConfig.getInstance().getServletName()); } } @@ -51,8 +38,8 @@ public class ServerStarter { * @param url 指定路径 */ public static void browserURLWithLocalEnv(final String url) { - - if (!FineEmbedServerMonitor.getInstance().isComplete()) { + // 内置服务器没有启动并且设计器已经打开,可以使用带进度条的启动方式 + if (!FineEmbedServer.isRunning() && DesignerContext.getDesignerFrame().isDesignerOpened()) { FineEmbedServerMonitor.getInstance().monitor(); ExecutorService service = Executors.newSingleThreadExecutor(new NamedThreadFactory("ServerStarter")); service.submit(new Runnable() { @@ -68,8 +55,15 @@ public class ServerStarter { } }); service.shutdown(); + } else if (!FineEmbedServer.isRunning()) { + // 普通方式启动内置服务器 + try { + FineEmbedServer.start(); + } finally { + BrowseUtils.browser(url); + } } else { - FineEmbedServer.start(); + // 已经启动内置服务器只需打开链接 BrowseUtils.browser(url); } } diff --git a/designer-base/src/main/resources/com/fr/design/icon/logo.png b/designer-base/src/main/resources/com/fr/design/icon/logo.png new file mode 100644 index 0000000000..d4c7d8b24d Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/icon/logo.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png b/designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png new file mode 100644 index 0000000000..929f14137a Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/edit/edit_typing.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/error/error.png b/designer-base/src/main/resources/com/fr/design/images/error/error.png new file mode 100644 index 0000000000..fd4a465091 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/error/error.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/error/error2.png b/designer-base/src/main/resources/com/fr/design/images/error/error2.png new file mode 100644 index 0000000000..ff0450a5a4 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/error/error2.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png b/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png new file mode 100755 index 0000000000..4186fea2cf Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/gui/color/autoForeground.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/warning4.png b/designer-base/src/main/resources/com/fr/design/images/warnings/warning4.png new file mode 100644 index 0000000000..a982ee864b Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/warnings/warning4.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png b/designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png new file mode 100644 index 0000000000..059206e0cc Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/warnings/warning5.png differ diff --git a/designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java b/designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java new file mode 100644 index 0000000000..fa9915b315 --- /dev/null +++ b/designer-base/src/test/java/com/fr/common/detect/CommonPortDetectorTest.java @@ -0,0 +1,45 @@ +package com.fr.common.detect; + +import com.fr.invoke.Reflect; +import com.fr.log.FineLoggerFactory; +import junit.framework.TestCase; +import org.junit.Assert; + +import java.io.IOException; +import java.net.ServerSocket; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/10 + */ +public class CommonPortDetectorTest extends TestCase { + + private ServerSocket serverSocket; + + @Override + public void setUp() throws Exception { + serverSocket = new ServerSocket(55555); + new Thread(new Runnable() { + @Override + public void run() { + try { + serverSocket.accept(); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }).start(); + } + + public void testCheckPort() { + CommonPortDetector detector = CommonPortDetector.getInstance(); + boolean access = Reflect.on(detector).call("checkPort", 55555).get(); + Assert.assertTrue(access); + } + + @Override + public void tearDown() throws Exception { + serverSocket.close(); + } +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java new file mode 100644 index 0000000000..f37c6e73d1 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -0,0 +1,58 @@ +package com.fr.design; + +import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; +import com.fr.env.CheckServiceDialog; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author: Maksim + * @Date: Created in 2020/3/5 + * @Description: + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({FunctionalHttpRequest.class,EnvChangeEntrance.class,CheckServiceDialog.class}) +public class EnvChangeEntranceTest { + + @Test + public void showServiceDialog() throws Exception { + try { + EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); + DesignerWorkspaceInfo selectedEnv = EasyMock.mock(DesignerWorkspaceInfo.class); + WorkspaceConnectionInfo connectionInfo = EasyMock.mock(WorkspaceConnectionInfo.class); + + String remoteBranch = "Build#persist-2020.02.15.01.01.12.12"; + EasyMock.expect(selectedEnv.getConnection()).andReturn(connectionInfo); + EasyMock.expect(selectedEnv.getType()).andReturn(DesignerWorkspaceType.Remote); + EasyMock.expect(selectedEnv.getRemindTime()).andReturn(null); + + FunctionalHttpRequest request = EasyMock.mock(FunctionalHttpRequest.class); + EasyMock.expect(request.getServiceList()).andReturn(null); + + PowerMock.expectNew(FunctionalHttpRequest.class, connectionInfo).andReturn(request).anyTimes(); + EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch); + + CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class); + PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject()).andReturn(dialog); + + EasyMock.replay(request); + EasyMock.replay(selectedEnv); + EasyMock.replay(connectionInfo); + PowerMock.replayAll(); + + entrance.showServiceDialog(selectedEnv); + Assert.assertTrue(true); + }catch (Exception e){ + Assert.assertTrue(false); + } + } + +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java b/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java index c6675da0d3..9a5ce7b8c1 100644 --- a/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java @@ -9,6 +9,7 @@ import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; import com.fr.invoke.Reflect; +import com.fr.stable.ArrayUtils; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Test; @@ -146,4 +147,12 @@ public class DesignTableDataManagerTest { "columnCache").get(); Assert.assertEquals(new String[]{"a", "b", "c"}, map.get(null).get("ds1")); } + + @Test + public void testGetDsColumnNames() { + Assert.assertTrue(ArrayUtils.isEmpty(DesignTableDataManager.getDsColumnNames("ds1"))); + String[] columnNames = new String[]{"a", "b", "c"}; + DesignTableDataManager.addDsColumnNames("ds1", new String[]{"a", "b", "c"}); + Assert.assertEquals(columnNames, DesignTableDataManager.getDsColumnNames("ds1")); + } } diff --git a/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java b/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java new file mode 100644 index 0000000000..fe7f365e64 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java @@ -0,0 +1,54 @@ +package com.fr.design.env; + +import com.fr.base.operator.common.CommonOperator; +import com.fr.invoke.ReflectException; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2020/1/2 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({WorkContext.class}) +public class RemoteWorkspaceTest { + @Test + public void testIsWarDeploy() { + + Workspace workspace = EasyMock.mock(Workspace.class); + PowerMock.mockStatic(WorkContext.class); + EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); + + CommonOperator operator = EasyMock.createMock(CommonOperator.class); + EasyMock.expect(workspace.get(CommonOperator.class)).andReturn(operator).anyTimes(); + + EasyMock.expect(operator.isWarDeploy()).andReturn(true).once(); + EasyMock.expect(operator.isWarDeploy()).andReturn(false).once(); + EasyMock.expect(operator.isWarDeploy()).andThrow(new ReflectException()).once(); + + EasyMock.replay(workspace, operator); + PowerMock.replayAll(); + + WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey"); + + RemoteWorkspace remoteWorkspace= new RemoteWorkspace(null, info); + + Assert.assertTrue(remoteWorkspace.isWarDeploy()); + Assert.assertFalse(remoteWorkspace.isWarDeploy()); + Assert.assertFalse(remoteWorkspace.isWarDeploy()); + + EasyMock.verify(workspace, operator); + PowerMock.verifyAll(); + + + } +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java b/designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java new file mode 100644 index 0000000000..9db729a978 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java @@ -0,0 +1,32 @@ +package com.fr.design.utils; + + +import com.fr.general.ComparatorUtils; +import junit.framework.TestCase; +import org.junit.Test; + +import java.net.ServerSocket; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/1/10 + */ +public class DesignUtilsTest extends TestCase { + + @Test + public void testIsPortOccupied() { + assertFalse(DesignUtils.isPortOccupied()); + try { + if (ComparatorUtils.equals("true", System.getProperty("debug"))) { + new ServerSocket(DesignerPort.getInstance().getDebugMessagePort()); + } else { + new ServerSocket(DesignerPort.getInstance().getMessagePort()); + } + } catch (Exception ignore) { + System.exit(0); + } + assertTrue(DesignUtils.isPortOccupied()); + } + +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/env/utils/DisplayUtilsTest.java b/designer-base/src/test/java/com/fr/env/utils/DisplayUtilsTest.java new file mode 100644 index 0000000000..181bd97887 --- /dev/null +++ b/designer-base/src/test/java/com/fr/env/utils/DisplayUtilsTest.java @@ -0,0 +1,52 @@ +package com.fr.env.utils; + +import org.junit.Assert; +import org.junit.Test; + + +/** + * @author: Maksim + * @Date: Created in 2020/3/16 + * @Description: + */ +public class DisplayUtilsTest { + + @Test + public void getDisplayLengthTest() { + String s1 = "本地设计器"; + String s2 = "リモートサーバ"; + String s3 = "Local Designer:"; + String s4 = "本地,设,计器: persist-2020.01.15"; + String s5 = "ローカルデザイナrelease-2020.03.03 ... Remote Server:persist-2020.01.15"; + String s6 = "本地 00:00ロ ーカDE / abc "; + + int length1 = DisplayUtils.getDisplayLength(s1); + int length2 = DisplayUtils.getDisplayLength(s2); + int length3 = DisplayUtils.getDisplayLength(s3); + int length4 = DisplayUtils.getDisplayLength(s4); + int length5 = DisplayUtils.getDisplayLength(s5); + int length6 = DisplayUtils.getDisplayLength(s6); + Assert.assertEquals(10,length1); + Assert.assertEquals(14,length2); + Assert.assertEquals(15,length3); + Assert.assertEquals(34,length4); + Assert.assertEquals(72,length5); + Assert.assertEquals(26,length6); + } + + @Test + public void isLetterTest(){ + char c1 = 'A'; + char c2 = '中'; + char c3 = ','; + char c4 = ','; + char c5 = 'デ'; + char c6 = ' '; + Assert.assertTrue(DisplayUtils.isLetter(c1)); + Assert.assertFalse(DisplayUtils.isLetter(c2)); + Assert.assertTrue(DisplayUtils.isLetter(c3)); + Assert.assertFalse(DisplayUtils.isLetter(c4)); + Assert.assertFalse(DisplayUtils.isLetter(c5)); + Assert.assertTrue(DisplayUtils.isLetter(c6)); + } +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java b/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java index c8431a8621..064cd05cec 100644 --- a/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java +++ b/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java @@ -25,15 +25,30 @@ public class FILEChooserPaneTest { ChooseFileFilter chooseFileFilter2 = new ChooseFileFilter(FileExtension.CPTX, StringUtils.EMPTY); String result3 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cpt", chooseFileFilter2).get(); - Assert.assertEquals("WorkBook1.cptx", result3); + Assert.assertEquals("WorkBook1.cpt.cptx", result3); ChooseFileFilter chooseFileFilter3 = new ChooseFileFilter(FileExtension.CPT, StringUtils.EMPTY); String result4 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cptx", chooseFileFilter3).get(); - Assert.assertEquals("WorkBook1.cpt", result4); + Assert.assertEquals("WorkBook1.cptx.cpt", result4); ChooseFileFilter chooseFileFilter5 = new ChooseFileFilter(FileExtension.CPTX, StringUtils.EMPTY); String result5 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cptx", chooseFileFilter5).get(); Assert.assertEquals("WorkBook1.cptx", result5); + + ChooseFileFilter chooseFileFilter6 = new ChooseFileFilter(FileExtension.CPT, StringUtils.EMPTY); + String result6 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.xls", chooseFileFilter6).get(); + Assert.assertEquals("WorkBook1.xls.cpt", result6); + + ChooseFileFilter chooseFileFilter7 = new ChooseFileFilter(FileExtension.XLS, StringUtils.EMPTY); + chooseFileFilter7.addExtension(".xlsx"); + String result7 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1", chooseFileFilter7).get(); + Assert.assertEquals("WorkBook1.xls", result7); + + ChooseFileFilter chooseFileFilter8 = new ChooseFileFilter(FileExtension.XLSX, StringUtils.EMPTY); + chooseFileFilter8.addExtension(".xls"); + String result8 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1", chooseFileFilter8).get(); + Assert.assertEquals("WorkBook1.xlsx", result8); + } } diff --git a/designer-base/src/test/java/com/fr/file/filter/ChooseFileFilterTest.java b/designer-base/src/test/java/com/fr/file/filter/ChooseFileFilterTest.java new file mode 100644 index 0000000000..ec6779bab0 --- /dev/null +++ b/designer-base/src/test/java/com/fr/file/filter/ChooseFileFilterTest.java @@ -0,0 +1,33 @@ +package com.fr.file.filter; + +import com.fr.base.extension.FileExtension; +import com.fr.stable.CoreConstants; +import com.fr.stable.StringUtils; +import junit.framework.TestCase; +import org.junit.Assert; + + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/3/18 + */ +public class ChooseFileFilterTest extends TestCase { + + public void testGetExtensionString() { + ChooseFileFilter chooseFileFilter = new ChooseFileFilter(FileExtension.XLSX, StringUtils.EMPTY); + chooseFileFilter.addExtension(FileExtension.XLS.getExtension()); + Assert.assertEquals(CoreConstants.DOT + FileExtension.XLSX.getExtension(), chooseFileFilter.getExtensionString()); + Assert.assertEquals(CoreConstants.DOT + FileExtension.XLS.getExtension(), chooseFileFilter.getExtensionString(1)); + ChooseFileFilter chooseFileFilter1 = new ChooseFileFilter(); + Assert.assertEquals(StringUtils.EMPTY, chooseFileFilter1.getExtensionString()); + Assert.assertEquals(StringUtils.EMPTY, chooseFileFilter1.getExtensionString(1)); + + } + + public void testGetExtensionCount() { + ChooseFileFilter chooseFileFilter = new ChooseFileFilter(FileExtension.CPT, StringUtils.EMPTY); + chooseFileFilter.addExtension(FileExtension.CPTX.getExtension()); + Assert.assertEquals(2, chooseFileFilter.getExtensionCount()); + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index f6f674ba95..4eb7258348 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -11,6 +11,18 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.ChartTypeUIProvider; import com.fr.design.chart.gui.ChartWidgetOption; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.core.WidgetOption; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.AbstractChartAttrPane; +import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.mainframe.chart.ChartsConfigPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.type.ui.AreaChartTypeUI; import com.fr.design.type.ui.BarChartTypeUI; import com.fr.design.type.ui.BubbleChartTypeUI; @@ -28,18 +40,6 @@ import com.fr.design.type.ui.RadarChartTypeUI; import com.fr.design.type.ui.RangeChartTypeUI; import com.fr.design.type.ui.StockChartTypeUI; import com.fr.design.type.ui.XYScatterChartTypeUI; -import com.fr.design.condition.ConditionAttributesPane; -import com.fr.design.gui.core.WidgetOption; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.mainframe.chart.AbstractChartAttrPane; -import com.fr.design.mainframe.chart.ChartEditPane; -import com.fr.design.mainframe.chart.ChartsConfigPane; -import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.ChartStylePane; -import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; -import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; -import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; -import com.fr.design.module.DesignModuleFactory; import com.fr.extended.chart.AbstractChart; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; @@ -80,20 +80,20 @@ import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.area.AreaIndependentVanChartInterface; import com.fr.van.chart.bar.BarIndependentVanChartInterface; import com.fr.van.chart.bubble.BubbleIndependentVanChartInterface; -import com.fr.van.chart.column.ColumnIndependentVanChartInterface; +import com.fr.van.chart.column.VanColumnChartTypeUI; import com.fr.van.chart.custom.CustomIndependentVanChartInterface; -import com.fr.van.chart.drillmap.DrillMapIndependentVanChartInterface; +import com.fr.van.chart.drillmap.VanDrillMapChartTypeUI; import com.fr.van.chart.funnel.designer.FunnelIndependentVanChartInterface; import com.fr.van.chart.gantt.designer.GanttIndependentVanChartInterface; import com.fr.van.chart.gauge.GaugeIndependentVanChartInterface; -import com.fr.van.chart.heatmap.designer.HeatMapIndependentVanChartInterface; +import com.fr.van.chart.heatmap.designer.VanHeatMapChartTypeUI; import com.fr.van.chart.line.LineIndependentVanChartInterface; -import com.fr.van.chart.map.MapIndependentVanChartInterface; +import com.fr.van.chart.map.VanMapChartTypeUI; import com.fr.van.chart.multilayer.MultiPieIndependentVanChartInterface; import com.fr.van.chart.pie.PieIndependentVanChartInterface; import com.fr.van.chart.radar.RadarIndependentVanChartInterface; import com.fr.van.chart.scatter.ScatterIndependentVanChartInterface; -import com.fr.van.chart.structure.desinger.StructureIndependentVanChartInterface; +import com.fr.van.chart.structure.desinger.VanStructureChartTypeUI; import com.fr.van.chart.treemap.TreeMapIndependentVanChartInterface; import com.fr.van.chart.wordcloud.designer.WordCloudIndependentVanChartInterface; @@ -182,7 +182,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static void readVanChart() { addChartTypeInterface(VAN_CHART_PRIORITY, PiePlot4VanChart.VAN_CHART_PIE_PLOT, new PieIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new ColumnIndependentVanChartInterface()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID, new VanColumnChartTypeUI()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID, new BarIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartLinePlot.VAN_CHART_LINE_PLOT, new LineIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID, new AreaIndependentVanChartInterface()); @@ -192,14 +192,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr addChartTypeInterface(VAN_CHART_PRIORITY, VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID, new BubbleIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID, new CustomIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMultiPiePlot.VAN_CHART_MULTILAYER_PLOT_ID, new MultiPieIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMapPlot.VAN_CHART_MAP_ID, new MapIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new DrillMapIndependentVanChartInterface()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartMapPlot.VAN_CHART_MAP_ID, new VanMapChartTypeUI()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartDrillMapPlot.VAN_CHART_DRILL_MAP_ID, new VanDrillMapChartTypeUI()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartTreeMapPlot.VAN_CHART_TREE_MAP_PLOT_ID, new TreeMapIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartFunnelPlot.VAN_CHART_FUNNEL_PLOT_ID, new FunnelIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new HeatMapIndependentVanChartInterface()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartHeatMapPlot.VAN_CHART_HEAT_MAP_ID, new VanHeatMapChartTypeUI()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); - addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface()); + addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI()); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java index 7485d57973..854505d630 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java @@ -44,6 +44,7 @@ public class ChartIcon implements Icon, XMLable { * @param x 缩略图的起始坐标x * @param y 缩略图的起始坐标y */ + @Override public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2d = (Graphics2D) g; @@ -66,6 +67,7 @@ public class ChartIcon implements Icon, XMLable { * * @return int 缩略图宽度 */ + @Override public int getIconWidth() { return WIDTH; } @@ -75,6 +77,7 @@ public class ChartIcon implements Icon, XMLable { * * @return int 缩略图高度 */ + @Override public int getIconHeight() { return HEIGHT; } @@ -94,18 +97,21 @@ public class ChartIcon implements Icon, XMLable { } + @Override public void readXML(XMLableReader reader) { - + //do nothing } + @Override public void writeXML(XMLPrintWriter writer) { - + //do nothing } /** * @return 克隆后的对象 * @throws CloneNotSupportedException 如果克隆失败则抛出此异常 */ + @Override public Object clone() throws CloneNotSupportedException { ChartIcon cloned = (ChartIcon) super.clone(); cloned.imagePath = this.imagePath; diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index 2385cabd60..ca1f4f1400 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -55,12 +55,12 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene this(); populate(cc); } - + public ChartComponent(BaseChartCollection cc) { this(); populate(cc); } - + public ChartComponent(ChartCollection cc, PropertyChangeListener l) { this(); populate(cc); @@ -72,6 +72,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene * 右键编辑 图表编辑层的监听事件, 在停止编辑时 响应整个编辑模板(form, sheet)的改变. * @param l 监听事件 */ + @Override public void addStopEditingListener(PropertyChangeListener l) { if (!listeners.contains(l)) { listeners.add(l); @@ -87,6 +88,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene /** * 停止编辑, 通知事情, 刷新画出新界面. */ + @Override public void reset() { fireStopEditing(); @@ -97,6 +99,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene repaint(); } + @Override public void populate(BaseChartCollection cc) { // kunsnat_bug: 5471 实现设置的即时预览 try {// clone 为了判断编辑前后的值. this.chartCollection4Design = (ChartCollection)cc; @@ -107,6 +110,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene reset(); } + @Override public BaseChartCollection update() { return this.chartCollection4Design; } @@ -180,53 +184,63 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene * @param event 鼠标事件 * 不设置鼠标点击跳转事件 */ + @Override public void mouseClicked(MouseEvent event) { + //do nothing } /** * 鼠标按压 * @param e 鼠标事件 */ + @Override public void mousePressed(MouseEvent e) { - - + //do nothing } /** * 鼠标松开 * @param e 鼠标事件 */ - public void mouseReleased(MouseEvent e) { + @Override + public void mouseReleased(MouseEvent e) { + //do nothing } /** * 鼠标进入 * @param e 鼠标事件 */ + @Override public void mouseEntered(MouseEvent e) { - + //do nothing } /** * 鼠标退出 * @param e 鼠标事件 */ + @Override public void mouseExited(MouseEvent e) { - + //do nothing } /** * 鼠标拖拽 * @param e 鼠标事件 */ - public void mouseDragged(MouseEvent e) { + @Override + public void mouseDragged(MouseEvent e) { + //do nothing } /** * 鼠标移动 * @param e 鼠标事件 */ + @Override public void mouseMoved(MouseEvent e) { + //do nothing } private boolean needRefreshChartGlyph() { @@ -243,7 +257,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - painter.paint(g2d, chartWidth, chartHeight, resolution, null); + painter.paint(g2d, chartWidth, chartHeight, resolution, null, this); } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java index b8690f8df6..c7893ae240 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java @@ -5,7 +5,10 @@ import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.stable.AssistUtils; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; import java.awt.BorderLayout; /** @@ -13,6 +16,12 @@ import java.awt.BorderLayout; */ public abstract class AbstractChartDataPane extends ChartDataPane { + private VanChart vanChart; + + protected VanChart getVanChart() { + return vanChart; + } + public AbstractChartDataPane(AttributeChangeListener listener) { super(listener); } @@ -26,15 +35,15 @@ public abstract class AbstractChartDataPane paneList; + private UITabGroup tabPane; + + private String[] nameArray; + + @Override + protected void initContentPane() { + if (customPlot == null) { + return; + } + cardLayout = new CardLayout(); + initPaneList(); + relayoutWhenListChange(); + } + + private void initPaneList() { + + paneList = new ArrayList<>(); + + List customPlotList = customPlot.getCustomPlotList(); + + for (int i = 0; i < customPlotList.size(); i++) { + //根据不同的plot创建不同的数据配置界面 + final VanChartPlot vanChartPlot = customPlotList.get(i); + paneList.add(new AbstractVanSingleDataPane(listener) { + @Override + protected SingleDataPane createSingleDataPane() { + return createSingleDataPaneByPlot(vanChartPlot); + } + }); + } + } + + private SingleDataPane createSingleDataPaneByPlot(VanChartPlot plot) { + CustomPlotType customType = CustomPlotFactory.getCustomType(plot); + switch (customType) { + case RING: + case SLOT: + case CUVETTE: + return new SingleDataPane(new GaugeDataSetFieldsPane(), new GaugeCellDataFieldsPane()); + case SCATTER: + case BUBBLE: + return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); + case PIE: + case SAME_PIE: + case DIFFERENT_PIE: + case POINTER_180: + case POINTER_360: + return new SingleDataPane(new SingleCategoryDataSetFieldsPane() { + @Override + public void checkBoxUse(boolean hasUse) { + super.checkBoxUse(hasUse); + UIComboBox[] comboBoxes = super.filedComboBoxes(); + for (UIComboBox comboBox : comboBoxes) { + comboBox.setEnabled(false); + } + } + }, new SingleCategoryCellDataFieldsPane() { + @Override + protected TinyFormulaPane[] formulaPanes() { + TinyFormulaPane[] tinyFormulaPanes = super.formulaPanes(); + for (TinyFormulaPane tinyFormulaPane : tinyFormulaPanes) { + GUICoreUtils.setEnabled(tinyFormulaPane, false); + } + return tinyFormulaPanes; + } + }); + default: + if (StringUtils.equals(CustomStyle.CUSTOM.toString(), plot.getCustomType())){ + return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + } else { + return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + } + } + } + + private void relayoutWhenListChange() { + centerPane = new JPanel(cardLayout) { + @Override + public Dimension getPreferredSize() { + return paneList.get(tabPane.getSelectedIndex()).getPreferredSize(); + } + }; + + //获取tab的标题 + initTabTitle(); + + tabPane = new VanChartCustomPlotUITabGroup(nameArray) { + @Override + public void tabChanged(int index) { + dealWithTabChanged(index); + } + }; + tabPane.setSelectedIndex(0); + tabPane.tabChanged(0); + initLayout(); + } + + private void initTabTitle() { + + if (customPlot == null) { + return; + } + + List customPlotList = customPlot.getCustomPlotList(); + nameArray = new String[Math.min(customPlotList.size(), paneList.size())]; + for (int i = 0; i < nameArray.length; i++) { + JPanel pane = paneList.get(i); + VanChartPlot vanChartPlot = customPlotList.get(i); + CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); + + nameArray[i] = CustomPlotFactory.getTitle(plotType); + centerPane.add(pane, nameArray[i]); + } + } + + protected void dealWithTabChanged(int index) { + cardLayout.show(centerPane, nameArray[index]); + } + + private void initLayout() { + JPanel tabPanel = new JPanel(new BorderLayout()); + tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); + tabPanel.add(tabPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout(HGAP, VGAP)); + this.add(tabPanel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + @Override + public void populate(ChartCollection collection) { + if (collection == null) { + return; + } + VanChart chart = collection.getSelectedChart(VanChart.class); + if (chart == null) { + return; + } + customPlot = chart.getPlot(); + + this.removeAll(); + initContentPane(); + + CustomChartDataDefinition dataSetCollection = (CustomChartDataDefinition) chart.getChartDataDefinition(); + + if (dataSetCollection != null) { + Map customDefinitions = dataSetCollection.getCustomDefinitions(); + for (int i = 0; i < paneList.size(); i++) { + VanChartPlot vanChartPlot = customPlot.getCustomPlotList().get(i); + AbstractDataDefinition dataDefinition = customDefinitions.get(CustomPlotFactory.getCustomType(vanChartPlot)); + if (dataDefinition != null) { + paneList.get(i).populate(dataDefinition); + } + } + } + + this.initAllListeners(); + this.validate(); + } + + + @Override + public void update(ChartCollection collection) { + if (collection == null) { + return; + } + VanChart chart = collection.getSelectedChart(VanChart.class); + if (chart == null) { + return; + } + Map definitions = new HashMap<>(); + for (int i = 0; i < paneList.size(); i++) { + definitions.put(CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)), paneList.get(i).update()); + } + CustomChartDataDefinition customDefinition = new CustomChartDataDefinition(); + customDefinition.setCustomDefinitions(definitions); + chart.setChartDataDefinition(customDefinition); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java deleted file mode 100644 index d172d7ba5d..0000000000 --- a/designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.fr.design.chartx; - -import com.fr.chartx.data.GanttChartDataDefinition; -import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane; -import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane; -import com.fr.design.chartx.single.SingleDataPane; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.van.chart.map.designer.VanChartGroupPane; - -import javax.swing.JPanel; - -/** - * Created by shine on 2019/5/22. - */ -public class GanttChartDataPane extends AbstractChartDataPane { - - private AbstractVanSingleDataPane dataPane; - private AbstractVanSingleDataPane linkPane; - - @Override - protected JPanel createContentPane() { - dataPane = new AbstractVanSingleDataPane(listener) { - @Override - protected SingleDataPane createSingleDataPane() { - return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); - } - }; - linkPane = new AbstractVanSingleDataPane(listener) { - @Override - protected SingleDataPane createSingleDataPane() { - return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); - } - }; - return new VanChartGroupPane(new String[]{"data", "link"}, new JPanel[]{dataPane, linkPane}) { - }; - } - - public GanttChartDataPane(AttributeChangeListener listener) { - super(listener); - } - - @Override - public void populate(GanttChartDataDefinition ganttChartDataDefinition) { - dataPane.populate(ganttChartDataDefinition.getDataDefinition()); - linkPane.populate(ganttChartDataDefinition.getLinkDefinition()); - } - - @Override - public GanttChartDataDefinition update() { - return null; - } -} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java index 443fea07a7..e93900ea6f 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java @@ -22,11 +22,13 @@ import com.fr.stable.StringUtils; import javax.swing.JPanel; import javax.swing.SwingConstants; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.ArrayList; -import java.util.List; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; /** * Created by shine on 2018/9/12. @@ -148,9 +150,18 @@ public abstract class AbstractCustomFieldComboBoxPane extends UIComboBoxPane< private void initComponents() { series = new UIComboBox(); + value = valueComboBoxHasNone() ? new UIComboBoxWithNone() : new UIComboBox(); + value.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + function.setEnabled(value.getSelectedItem() != null); + } + }); + function = new CalculateComboBox(); + function.setEnabled(false); Component[][] components = new Component[][]{ new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), SwingConstants.LEFT), series}, @@ -171,7 +182,6 @@ public abstract class AbstractCustomFieldComboBoxPane extends UIComboBoxPane< public void checkBoxUse(boolean hasUse) { series.setEnabled(hasUse); value.setEnabled(hasUse); - function.setEnabled(hasUse); } public void clearAllBoxList() { diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java index 2a8154d7bb..d22d957415 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java @@ -10,13 +10,13 @@ import com.fr.general.IOUtils; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; /** @@ -24,7 +24,6 @@ import java.util.List; * 一列组件 可增可删,通过JComponent后面的加减button增删。 */ public abstract class AbstractMultiComponentPane extends JPanel { - private static final int COM_W = 96; private static final int H = 20; private static final int ICON_W = 20; @@ -35,6 +34,7 @@ public abstract class AbstractMultiComponentPane extends J private List categoryComponentList = new ArrayList(); + private boolean categoryAxis = true; protected abstract T createFirstFieldComponent(); @@ -44,13 +44,23 @@ public abstract class AbstractMultiComponentPane extends J protected abstract void updateField(T component, ColumnField field); + public void setCategoryAxis(boolean categoryAxis) { + this.categoryAxis = categoryAxis; + if(!categoryAxis){ + addButton.setEnabled(false); + for (JComponent component : categoryComponentList) { + component.setEnabled(false); + } + } + } + public AbstractMultiComponentPane() { UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); firstFieldComponent = createFirstFieldComponent(); - firstFieldComponent.setPreferredSize(new Dimension(COM_W, H)); + firstFieldComponent.setPreferredSize(new Dimension(componentWidth(), H)); addButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton.setPreferredSize(new Dimension(ICON_W, H)); @@ -64,7 +74,7 @@ public abstract class AbstractMultiComponentPane extends J }); final JPanel panel = new JPanel(); - panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); + panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 2)); panel.add(label); panel.add(firstFieldComponent); @@ -78,6 +88,10 @@ public abstract class AbstractMultiComponentPane extends J this.add(boxPane, BorderLayout.CENTER); } + protected int componentWidth() { + return 96; + } + private JPanel addComboBoxAndButtonToBox(T uiComboBox, UIButton uiButton) { final JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); @@ -93,7 +107,7 @@ public abstract class AbstractMultiComponentPane extends J private void addNewComboBox() { final T comboBox = createOtherFieldComponent(); - comboBox.setPreferredSize(new Dimension(COM_W, H)); + comboBox.setPreferredSize(new Dimension(componentWidth(), H)); UIButton delButton = new UIButton(IOUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); delButton.setPreferredSize(new Dimension(ICON_W, H)); @@ -123,7 +137,7 @@ public abstract class AbstractMultiComponentPane extends J } private boolean canAdd() { - return categoryComponentList.size() < 3; + return categoryComponentList.size() < 2 && categoryAxis; } public List componentList() { @@ -165,4 +179,16 @@ public abstract class AbstractMultiComponentPane extends J updateField(comboBox, temp); } } -} + + public void checkEnable(boolean hasUse) { + //增加按钮是否灰化要根据是否选择了数据源,是否分类轴,分类数量是否超标三个判断 + boolean buttonUse = hasUse && categoryAxis && categoryComponentList.size() < 2; + //额外的分类是否灰化根据是否选择了数据源,是否分类轴判断 + boolean categoryUse = hasUse && categoryAxis; + + addButton.setEnabled(buttonUse); + for (JComponent component : categoryComponentList) { + component.setEnabled(categoryUse); + } + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java index 5f0e6500b0..f784c4a861 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java @@ -11,10 +11,10 @@ import com.fr.stable.AssistUtils; import javax.swing.JComponent; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; import java.util.ArrayList; import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by shine on 2019/6/18. @@ -148,4 +148,8 @@ public abstract class AbstractMultiComponentPaneWithUISpinner { +public abstract class AbstractSingleFilterPane extends AbstractChartTabPane implements UIObserver { private static final int FIL_HEIGHT = 150; @@ -34,14 +36,12 @@ public abstract class AbstractSingleFilterPane extends AbstractChartTabPane categoryList = fieldCollection.getCategoryList(); + if (!categoryList.isEmpty()) { + populateCategory(categoryList.get(0).getFilterProperties()); + } + } + + public void updateMultiCategoryFieldCollection(MultiCategoryColumnFieldCollection fieldCollection) { + + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); + if (seriesValueCorrelationDefinition != null) { + seriesValueCorrelationDefinition.setFilterProperties(updateSeries()); + } + + List categoryList = fieldCollection.getCategoryList(); + if (!categoryList.isEmpty()) { + categoryList.get(0).setFilterProperties(updateCategory()); + } + } + + private void populateSeries(DataFilterProperties series) { + seriesFilterPane.populateBean(series); + + } + + private void populateCategory(DataFilterProperties category) { + categoryFilterPane.populateBean(category); + + } + + private DataFilterProperties updateSeries() { + return seriesFilterPane.updateBean(); + + } + + private DataFilterProperties updateCategory() { + return categoryFilterPane.updateBean(); + } + + +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/CellDataSeriesXYValueCorrelationPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/CellDataSeriesXYValueCorrelationPane.java new file mode 100644 index 0000000000..d14d59473c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/CellDataSeriesXYValueCorrelationPane.java @@ -0,0 +1,66 @@ +package com.fr.design.chartx.component; + +import com.fr.base.Utils; +import com.fr.chartx.data.field.ColumnField; +import com.fr.chartx.data.field.diff.BubbleColumnField; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.design.chartx.component.correlation.AbstractCorrelationPane; +import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper; +import com.fr.design.chartx.component.correlation.TinyFormulaPaneEditorComponent; +import com.fr.design.i18n.Toolkit; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Wim on 2019/11/04. + */ +public class CellDataSeriesXYValueCorrelationPane extends AbstractCorrelationPane { + + @Override + protected FieldEditorComponentWrapper[] createFieldEditorComponentWrappers() { + return new FieldEditorComponentWrapper[]{ + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_X_Axis")), + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Y_Axis")), + new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Value")) + }; + } + + @Override + protected List covertTBeanToTableModelList(BubbleColumnFieldCollection bubbleColumnFieldCollection) { + List result = new ArrayList<>(); + + List bubbleColumnFieldList = bubbleColumnFieldCollection.getList(); + for (BubbleColumnField field : bubbleColumnFieldList) { + Object[] array = new Object[]{ + field.getSeriesName().getFieldName(), + field.getXField().getFieldName(), + field.getYField().getFieldName(), + field.getSizeField().getFieldName() + }; + result.add(array); + } + + return result; + } + + @Override + protected void setTableModelListToTBean(List tableValues, BubbleColumnFieldCollection bubbleColumnFieldCollection) { + List bubbleColumnFieldList = new ArrayList<>(); + for (Object[] oneLine : tableValues) { + BubbleColumnField bubbleColumnField = new BubbleColumnField(); + ColumnField series = new ColumnField(Utils.objectToString(oneLine[0])); + ColumnField xField = new ColumnField(Utils.objectToString(oneLine[1])); + ColumnField yField = new ColumnField(Utils.objectToString(oneLine[2])); + ColumnField value = new ColumnField(Utils.objectToString(oneLine[3])); + bubbleColumnField.setSeriesName(series); + bubbleColumnField.setXField(xField); + bubbleColumnField.setYField(yField); + bubbleColumnField.setSizeField(value); + bubbleColumnFieldList.add(bubbleColumnField); + } + + bubbleColumnFieldCollection.setList(bubbleColumnFieldList); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java new file mode 100644 index 0000000000..41202061cd --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -0,0 +1,285 @@ +package com.fr.design.chartx.component; + +import com.fr.base.BaseUtils; +import com.fr.chartx.TwoTuple; +import com.fr.data.TableDataSource; +import com.fr.data.TableDataSourceTailor; +import com.fr.data.impl.EmbeddedTableData; +import com.fr.data.impl.NameTableData; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.datapane.TableDataComboBox; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; +import com.fr.general.data.DataModel; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.map.data.MapMatchResult; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; +import com.fr.script.Calculator; +import com.fr.stable.StringUtils; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.table.DefaultTableModel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-11-04 + */ +public class MapAreaMatchPane extends BasicBeanPane { + + private TableDataComboBox tableNameCombox; + private UIComboBox areaNameBox; + private UILabel refreshLabel; + + private MatchAreaTable matchAreaTable; + + private MatchResultTable matchResultTable; + + private static final Object[] HEADER = new Object[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Match_To")}; + + private static final Object[] HEADER_WITH_EMPTY = new Object[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Match_To"), ""}; + + public MapAreaMatchPane(TwoTuple> treeNodeAndItems) { + initButtonGroup(); + initRefreshLabel(); + areaNameBox = new UIComboBox(); + this.setLayout(new BorderLayout(5, 5)); + this.add(createContentPane(), BorderLayout.NORTH); + initTable(treeNodeAndItems); + + JPanel tablePane = new JPanel(); + tablePane.setLayout(new BorderLayout(5, 10)); + tablePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + JScrollPane matchAreaScroll = new JScrollPane(matchAreaTable) { + @Override + public Dimension getPreferredSize() { + return new Dimension(400, 290); + } + }; + tablePane.add(matchAreaScroll, BorderLayout.CENTER); + JScrollPane matchResultScroll = new JScrollPane(matchResultTable) { + @Override + public Dimension getPreferredSize() { + return new Dimension(400, 200); + } + }; + matchResultScroll.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_Custom_Match_List"))); + tablePane.add(matchResultScroll, BorderLayout.SOUTH); + + this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); + this.add(tablePane, BorderLayout.CENTER); + } + + private JPanel createContentPane() { + JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + + JPanel tableDataPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + panel.add(tableDataPane); + tableDataPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":")); + tableNameCombox.setPreferredSize(new Dimension(96, 20)); + tableDataPane.add(tableNameCombox); + + JPanel areaNamePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + panel.add(areaNamePane); + areaNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Name") + ":")); + areaNamePane.add(areaNameBox); + areaNameBox.setPreferredSize(new Dimension(96, 20)); + panel.add(refreshLabel); + return panel; + } + + private void initTable(TwoTuple> treeNodeAndItems) { + matchAreaTable = new MatchAreaTable(new Object[0][2], HEADER); + matchAreaTable.setRoot(treeNodeAndItems.getFirst()); + matchAreaTable.setItems(treeNodeAndItems.getSecond()); + + matchResultTable = new MatchResultTable(new Object[0][3], HEADER_WITH_EMPTY); + + DefaultTableModel model = new DefaultTableModel(new Object[0][3], HEADER_WITH_EMPTY); + matchResultTable.setModel(model); + + matchAreaTable.setMatchResultTable(matchResultTable); + matchResultTable.setMatchAreaTable(matchAreaTable); + } + + private void initButtonGroup() { + tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableNameCombox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + refreshBox(); + } + } + }); + } + + private void initRefreshLabel() { + Icon refreshImage = BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"); + refreshLabel = new UILabel(refreshImage); + refreshLabel.addMouseListener(new MouseAdapter() { + boolean mouseEntered = false; + boolean buttonPressed = false; + + public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用. + mouseEntered = true; + if (!buttonPressed) { + refreshLabel.setBackground(java.awt.Color.WHITE); + refreshLabel.setOpaque(true); + refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY)); + } + } + + public void mouseExited(MouseEvent e) { + mouseEntered = false; + refreshLabel.setOpaque(false); + refreshLabel.setBorder(BorderFactory.createEmptyBorder()); + } + + public void mousePressed(MouseEvent e) { + buttonPressed = true; + refreshLabel.setBackground(java.awt.Color.lightGray); + } + + public void mouseReleased(MouseEvent e) { + buttonPressed = false; + if (mouseEntered) { + refreshLabel.setBackground(java.awt.Color.WHITE); + populateData(tableNameCombox.getSelectedItem().getTableDataName(), GeneralUtils.objectToString(areaNameBox.getSelectedItem())); + } + } + }); + } + + public void updateBean(MapMatchResult matchResult) { + if (matchResult == null) { + return; + } + + matchResultTable.updateBean(matchResult); + } + + public void populateBean(MapMatchResult matchResult) { + + } + + public void populateBean(MapMatchResult matchResult, String tableName, String areaName) { + //先取保存的数据集名称和区域名,若不存在,就取数据集面板配置的数据集名称和区域名 + matchResultTable.populateBean(matchResult); + tableNameCombox.setSelectedTableDataByName(tableName); + if (StringUtils.isEmpty(areaName)) { + return; + } + areaNameBox.setSelectedItem(areaName); + populateData(tableName, areaName); + } + + private void populateData(String tableName, String columnName) { + Object[] columnData = getColumnData(tableName, columnName); + if (columnData == null) { + return; + } + populateMatchData(columnData); + } + + private Object[] getColumnData(String tableName, String columnName) { + NameTableData nameTableData = new NameTableData(tableName); + TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); + Calculator calculator = Calculator.createCalculator(); + calculator.setAttribute(TableDataSource.KEY, dataSource); + nameTableData.createTableData(calculator); + try { + EmbeddedTableData tableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, nameTableData, Integer.MAX_VALUE, false); + int colIndex = getColIndex(tableData, columnName); + if (colIndex == DataModel.COLUMN_NAME_NOT_FOUND) { + return null; + } + int size = tableData.getRowCount(); + HashSet columnData = new LinkedHashSet<>(); + for (int i = 0; i < size; i++) { + Object valueAt = tableData.getValueAt(i, colIndex); + columnData.add(GeneralUtils.objectToString(valueAt)); + } + return columnData.toArray(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return null; + } + } + + private int getColIndex(EmbeddedTableData tableData, String columnName) { + int colIndex = 0; + + for (int count = tableData.getColumnCount(); colIndex < count; ++colIndex) { + if (ComparatorUtils.tableDataColumnNameEquals(tableData.getColumnName(colIndex), columnName)) { + return colIndex; + } + } + return DataModel.COLUMN_NAME_NOT_FOUND; + } + + private void populateMatchData(Object[] columnData) { + Set geoAreas = matchAreaTable.getItems(); + + Map resultMap = ChartGEOJSONHelper.matchAreaList(columnData, geoAreas, matchResultTable.getCustomResult()); + + Object[][] data = new Object[resultMap.size()][2]; + + //构造table的数据结构 + Map areaNameIndex = new HashMap<>(); + int i = 0; + for (Map.Entry entry : resultMap.entrySet()) { + areaNameIndex.put(entry.getKey(), i); + data[i++] = new Object[]{entry.getKey(), entry.getValue()}; + } + + matchAreaTable.setAreaNameIndex(areaNameIndex); + matchAreaTable.setModel(new DefaultTableModel(data, HEADER)); + } + + private void refreshBox() { + TableDataWrapper dataWrap = tableNameCombox.getSelectedItem(); + + if (dataWrap == null) { + return; + } + + List columnNameList = dataWrap.calculateColumnNameList(); + + DataPaneHelper.refreshBoxItems(areaNameBox, columnNameList); + areaNameBox.setSelectedItem(null); + } + + public MapMatchResult updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Location_With_Area_Name"); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java new file mode 100644 index 0000000000..9c16b4663d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java @@ -0,0 +1,150 @@ +package com.fr.design.chartx.component; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.general.GeneralUtils; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; + +import javax.swing.AbstractCellEditor; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JTree; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumnModel; +import javax.swing.table.TableModel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.awt.Color; +import java.awt.Component; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-11-19 + */ +public class MatchAreaTable extends JTable { + + private Set items; + + private MatchResultTable matchResultTable; + + private Map areaNameIndex = new HashMap<>(); + + private DefaultMutableTreeNode root; + + public MatchAreaTable(Object[][] data, Object[] header) { + super(data, header); + this.getTableHeader().setReorderingAllowed(false); + } + + public void setItems(Set items) { + this.items = items; + } + + public Set getItems() { + return items; + } + + public void setRoot(DefaultMutableTreeNode root) { + this.root = root; + } + + public void setMatchResultTable(MatchResultTable matchResultTable) { + this.matchResultTable = matchResultTable; + } + + public void setAreaNameIndex(Map areaNameIndex) { + this.areaNameIndex = areaNameIndex; + } + + public void setModel(TableModel dataModel) { + super.setModel(dataModel); + + if (items == null) { + items = new HashSet<>(); + } + TableColumnModel columnModel = getColumnModel(); + columnModel.getColumn(0).setCellEditor(new UILabelEditor()); + columnModel.getColumn(1).setCellEditor(new UIComboBoxRenderAndEditor()); + columnModel.getColumn(1).setCellRenderer(new UIComboBoxRenderAndEditor()); + } + + public void reMatch(Object areaName) { + if (!areaNameIndex.containsKey(areaName)) { + return; + } + int index = areaNameIndex.get(areaName); + String result = ChartGEOJSONHelper.matchArea(GeneralUtils.objectToString(areaName), items); + getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); + this.setValueAt(result, index, 1); + } + + public class UIComboBoxRenderAndEditor extends AbstractCellEditor implements TableCellRenderer, TableCellEditor { + + TableTreeComboBox comboBox; + + public UIComboBoxRenderAndEditor() { + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + initComboBox(value, false); + return comboBox; + } + + public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, int column) { + initComboBox(value, true); + comboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + UIComboBoxRenderAndEditor.this.stopCellEditing(); + Object areaName = MatchAreaTable.this.getValueAt(row, 0); + Object result = MatchAreaTable.this.getValueAt(row, 1); + if (items.contains(result)) { + matchResultTable.dealMatch(areaName, result); + } + } + }); + return comboBox; + } + + private void initComboBox(Object value, boolean editor) { + //地图不显示第一层,钻取地图显示第一层。 + boolean showRoot = root.getUserObject() != null; + comboBox = new TableTreeComboBox(new JTree(root), showRoot); + comboBox.setEditable(true); + + comboBox.setSelectedItem(value); + if (!editor && value == null) { + JTextField textField = (JTextField) (comboBox.getEditor().getEditorComponent()); + textField.setForeground(Color.RED); + textField.setText(Toolkit.i18nText("Fine-Design_Chart_Prompt_Not_Selected")); + } + } + + public Object getCellEditorValue() { + comboBox.resetText(); + return comboBox.getSelectedItem(); + } + } + + public static class UILabelEditor extends AbstractCellEditor implements TableCellEditor { + + UILabel uiLabel; + + public Component getTableCellEditorComponent(JTable table, Object value, + boolean isSelected, + int row, int column) { + uiLabel = new UILabel(GeneralUtils.objectToString(value)); + return uiLabel; + } + + public Object getCellEditorValue() { + return uiLabel.getText(); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java new file mode 100644 index 0000000000..8a85c84a47 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java @@ -0,0 +1,146 @@ +package com.fr.design.chartx.component; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.map.data.MapMatchResult; +import com.fr.stable.StringUtils; + +import javax.swing.AbstractCellEditor; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumnModel; +import javax.swing.table.TableModel; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Vector; +import java.awt.Component; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-11-20 + */ +public class MatchResultTable extends JTable { + + private MatchAreaTable matchAreaTable; + + public MatchResultTable(Object[][] data, Object[] header) { + super(data, header); + this.getTableHeader().setReorderingAllowed(false); + } + + public void setMatchAreaTable(MatchAreaTable matchAreaTable) { + this.matchAreaTable = matchAreaTable; + } + + public void setModel(TableModel dataModel) { + super.setModel(dataModel); + + TableColumnModel columnModel = getColumnModel(); + columnModel.getColumn(0).setCellEditor(new MatchAreaTable.UILabelEditor()); + columnModel.getColumn(1).setCellEditor(new MatchAreaTable.UILabelEditor()); + columnModel.getColumn(2).setCellEditor(new UIButtonEditorAndRender()); + columnModel.getColumn(2).setCellRenderer(new UIButtonEditorAndRender()); + columnModel.getColumn(2).setMaxWidth(20); + } + + public void dealMatch(Object areaName, Object result) { + int rowCount = this.getRowCount(); + for (int i = 0; i < rowCount; i++) { + if (ComparatorUtils.equals(this.getValueAt(i, 0), areaName)) { + getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); + this.setValueAt(result, i, 1); + return; + } + } + DefaultTableModel model = (DefaultTableModel) this.getModel(); + Vector vector = new Vector(); + vector.add(areaName); + vector.add(result); + vector.add(""); + model.addRow(vector); + } + + public void populateBean(MapMatchResult matchResult) { + if (matchResult == null) { + return; + } + Map customResult = matchResult.getCustomResult(); + if (customResult == null) { + return; + } + DefaultTableModel model = (DefaultTableModel) this.getModel(); + for (Map.Entry entry : customResult.entrySet()) { + Vector vector = new Vector(); + vector.add(entry.getKey()); + vector.add(entry.getValue()); + vector.add(""); + model.addRow(vector); + } + } + + public void updateBean(MapMatchResult matchResult) { + matchResult.setCustomResult(getCustomResult()); + } + + public Map getCustomResult() { + Map customResult = new LinkedHashMap<>(); + DefaultTableModel model = (DefaultTableModel) this.getModel(); + for (int i = 0, rowCount = model.getRowCount(); i < rowCount; i++) { + customResult.put(Utils.objectToString(model.getValueAt(i, 0)), Utils.objectToString(model.getValueAt(i, 1))); + } + return customResult; + } + + public class UIButtonEditorAndRender extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { + + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, int column) { + UIButton uiButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); + uiButton.addMouseListener(new MouseAdapter() { + boolean mouseEntered = false; + + public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用. + mouseEntered = true; + + } + + public void mouseExited(MouseEvent e) { + mouseEntered = false; + } + + public void mouseReleased(MouseEvent e) { + if (mouseEntered) { + MatchResultTable.this.getCellEditor().stopCellEditing(); + int val = JOptionPane.showConfirmDialog(MatchResultTable.this, Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", + Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + if (val == JOptionPane.OK_OPTION) { + DefaultTableModel model = (DefaultTableModel) MatchResultTable.this.getModel(); + Object areaName = MatchResultTable.this.getValueAt(row, 0); + model.removeRow(row); + matchAreaTable.reMatch(areaName); + } + } + } + }); + return uiButton; + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + UIButton button = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); + return button; + } + + public Object getCellEditorValue() { + return StringUtils.EMPTY; + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java index f1716a0ae0..f66dac3121 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java @@ -14,6 +14,7 @@ import java.util.List; public class MultiComboBoxPane extends AbstractMultiComponentPane { private List currentBoxItems = new ArrayList(); + public void setCurrentBoxItems(List currentBoxItems) { this.currentBoxItems = currentBoxItems; } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java index 5e56b967c4..bec7e6e7b1 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java @@ -8,6 +8,12 @@ import com.fr.design.formula.TinyFormulaPane; * Created by shine on 2019/4/12. */ public class MultiTinyFormulaPane extends AbstractMultiComponentPane { + + @Override + protected int componentWidth() { + return 116; + } + @Override protected TinyFormulaPane createFirstFieldComponent() { return new TinyFormulaPane(); @@ -28,4 +34,4 @@ public class MultiTinyFormulaPane extends AbstractMultiComponentPane { + private DrillMapLayerPane layerPane; + private DrillMapDataPane dataPane; + + public DrillMapChartDataPane(AttributeChangeListener listener) { + super(listener); + } + + private VanChartDrillMapPlot getDrillMapPlot() { + if (getVanChart() != null) { + return getVanChart().getPlot(); + } + return null; + } + + @Override + protected JPanel createContentPane() { + VanChartDrillMapPlot drillMapPlot = getDrillMapPlot(); + if (drillMapPlot == null) { + return new JPanel(); + } + + layerPane = new DrillMapLayerPane(drillMapPlot); + dataPane = new DrillMapDataPane(getVanChart()); + return new VanChartGroupPane(new String[]{Toolkit.i18nText("Fine-Design_Chart_Map_Drill_Level"), Toolkit.i18nText("Fine-Design_Chart_Use_Data")}, + new JPanel[]{layerPane, dataPane}) { + @Override + protected void tabChanged(int index) { + if (index == 0) { + return; + } + dataPane.fireMapTypeChanged(); + } + }; + } + + + @Override + protected void populate(DrillMapChartDataDefinition drillMapChartDataDefinition) { + if (drillMapChartDataDefinition == null) { + return; + } + VanChartDrillMapPlot drillMapPlot = getDrillMapPlot(); + + layerPane.populateBean(drillMapPlot); + dataPane.populateBean(drillMapChartDataDefinition); + } + + @Override + protected DrillMapChartDataDefinition update() { + VanChartDrillMapPlot drillMapPlot = getDrillMapPlot(); + + layerPane.updateBean(drillMapPlot); + + DrillMapChartDataDefinition definition = new DrillMapChartDataDefinition(); + dataPane.updateBean(definition); + + return definition; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapDataPane.java new file mode 100644 index 0000000000..f8bcf2e915 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapDataPane.java @@ -0,0 +1,124 @@ +package com.fr.design.chartx.data.drillMap; + +import com.fr.chartx.data.DrillMapChartDataDefinition; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.chartx.fields.diff.AreaMapCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.AreaMapDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; +import com.fr.plugin.chart.vanchart.VanChart; + +import java.util.ArrayList; +import java.util.List; +import java.awt.BorderLayout; + +/** + * Created by Mitisky on 16/6/20. + * 钻取地图数据配置界面中 和钻取层级平级的数据界面 + */ +public class DrillMapDataPane extends BasicBeanPane { + private UIComboBoxPane dataDefinitionType;//数据定义方式:底层数据汇总/各层级分别指定 + + private SingleDataPane bottomDataPane;//底层数据汇总方式定义钻取地图数据 + + private EachLayerDataDefinitionPane eachLayerDataDefinitionPane;//各层级分别指定 + + public DrillMapDataPane(VanChart vanChart) { + AreaMapDataSetFieldsPane areaMapDataSetFieldsPane = new AreaMapDataSetFieldsPane(); + areaMapDataSetFieldsPane.setChart(vanChart); + areaMapDataSetFieldsPane.setLevel(ChartGEOJSONHelper.BOTTOM_LEVEL); + bottomDataPane = new SingleDataPane(areaMapDataSetFieldsPane, new AreaMapCellDataFieldsPane()); + eachLayerDataDefinitionPane = new EachLayerDataDefinitionPane(vanChart); + + dataDefinitionType = new UIComboBoxPane() { + @Override + protected List> initPaneList() { + + List> paneList = new ArrayList>(); + paneList.add(new BottomLayerDataDefinitionPane()); + paneList.add(eachLayerDataDefinitionPane); + return paneList; + } + + @Override + protected String title4PopupWindow() { + return null; + } + }; + + this.setLayout(new BorderLayout()); + this.add(dataDefinitionType, BorderLayout.CENTER); + } + + public void fireMapTypeChanged() { + eachLayerDataDefinitionPane.fireMapTypeChanged(); + } + + @Override + public void populateBean(DrillMapChartDataDefinition ob) { + + dataDefinitionType.setSelectedIndex(ob.isFromBottomData() ? 0 : 1); + + bottomDataPane.populateBean(ob.getBottomDataDefinition()); + eachLayerDataDefinitionPane.populateBean(ob); + } + + /** + * Update. + */ + @Override + public DrillMapChartDataDefinition updateBean() { + return null; + } + + @Override + public void updateBean(DrillMapChartDataDefinition drillMapDefinition) { + if (dataDefinitionType.getSelectedIndex() == 0) { + drillMapDefinition.setFromBottomData(true); + drillMapDefinition.setBottomDataDefinition(bottomDataPane.updateBean()); + } else { + drillMapDefinition.setFromBottomData(false); + eachLayerDataDefinitionPane.updateBean(drillMapDefinition); + } + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Use_Data"); + } + + private class BottomLayerDataDefinitionPane extends FurtherBasicBeanPane { + + private BottomLayerDataDefinitionPane() { + this.setLayout(new BorderLayout()); + this.add(bottomDataPane, BorderLayout.CENTER); + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public void reset() { + + } + + @Override + public void populateBean(DrillMapChartDataDefinition ob) { + } + + @Override + public DrillMapChartDataDefinition updateBean() { + return null; + } + + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Bottom_Data_Sum"); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java new file mode 100644 index 0000000000..1102f7a64e --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java @@ -0,0 +1,221 @@ +package com.fr.design.chartx.data.drillMap; + +import com.fr.chartx.TwoTuple; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.map.data.MapMatchResult; +import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; +import com.fr.plugin.chart.type.MapType; +import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; +import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * Created by Mitisky on 16/6/20. + * 钻取地图数据配置界面--钻取层级界面 + */ +public class DrillMapLayerPane extends BasicBeanPane { + private static final String[] CUSTOM_MAP_TYPES = new String[]{MapType.AREA.getLocaleString(), MapType.POINT.getLocaleString()}; + private static final String[] AREA_MAP_TYPES = new String[]{MapType.AREA.getLocaleString()}; + private static final String[] POINT_MAP_TYPES = new String[]{MapType.POINT.getLocaleString()}; + + private static final java.util.Map TEMP = new HashMap(); + + static { + TEMP.put(MapType.AREA, AREA_MAP_TYPES); + TEMP.put(MapType.POINT, POINT_MAP_TYPES); + TEMP.put(MapType.CUSTOM, CUSTOM_MAP_TYPES); + } + + private MapDataTree mapDataTree; + private Component[][] detailComps; + + + public DrillMapLayerPane(VanChartDrillMapPlot drillMapPlot) { + + initMapTypeAndZoom(drillMapPlot); + + JPanel contentPane = createContentPane(drillMapPlot); + + this.setLayout(new BorderLayout()); + this.add(contentPane, BorderLayout.CENTER); + } + + private void initMapTypeAndZoom(VanChartDrillMapPlot drillMapPlot) { + + if (drillMapPlot != null) { + + int depth = getRootAndDepth(drillMapPlot).getSecond(); + + java.util.List levelList = drillMapPlot.getLayerLevelList(); + java.util.List mapTypeList = drillMapPlot.getLayerMapTypeList(); + List matchResultList = drillMapPlot.getMatchResultList(); + + //根据层级初始属性,一切以json那边读到的层级为准 + int levelSize = levelList.size(); + for (int i = levelSize; i < depth; i++) { + levelList.add(ZoomLevel.AUTO); + } + MapType mapType = drillMapPlot.getMapType() == MapType.POINT ? MapType.POINT : MapType.AREA; + int typeSize = mapTypeList.size(); + for (int j = typeSize; j < depth; j++) { + mapTypeList.add(mapType); + } + + int matchSize = matchResultList.size(); + for (int k = matchSize; k < depth; k++) { + matchResultList.add(new MapMatchResult()); + } + } + } + + public static TwoTuple getRootAndDepth(VanChartDrillMapPlot drillMapPlot) { + int depth = 1; + + DefaultMutableTreeNode root = CompatibleGeoJSONTreeHelper.getNodeByJSONPath(drillMapPlot.getGeoUrl()); + if (root != null) { + depth = root.getDepth() + 1;//根节点也算一层 + } + + return new TwoTuple<>(root, depth); + } + + private JPanel createContentPane(VanChartDrillMapPlot drillMapPlot) { + if (drillMapPlot == null) { + return new JPanel(); + } + + DefaultMutableTreeNode root = CompatibleGeoJSONTreeHelper.getNodeByJSONPath(drillMapPlot.getGeoUrl()); + + if (mapDataTree == null) { + mapDataTree = new MapDataTree(root); + mapDataTree.setRootVisible(true); + } else { + mapDataTree.changeRootNode(root); + } + + + JPanel mapDataTreePanel = new JPanel(new BorderLayout()); + mapDataTreePanel.add(mapDataTree); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Layer_Tree"), mapDataTreePanel)}, + new Component[]{createTitlePane(Toolkit.i18nText("Fine-Design_Chart_Layer_Detail"), createLayerDetailPane(drillMapPlot))} + }; + + JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(contentPane, BorderLayout.CENTER); + return panel; + } + + private JPanel createTitlePane(String title, JPanel panel) { + JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); + panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); + jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + return jPanel; + } + + private JPanel createLayerDetailPane(VanChartDrillMapPlot drillMapPlot) { + int depth = getRootAndDepth(drillMapPlot).getSecond(); + String[] items = TEMP.get(drillMapPlot.getMapType()); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, p, p}; + double[] rowSize = new double[depth + 1]; + detailComps = new Component[depth + 1][3]; + rowSize[0] = p; + detailComps[0] = new Component[]{ + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Descriptor")), + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layer_Map_Type")) + }; + for (int i = 0; i < depth; i++) { + rowSize[i + 1] = p; + int d = i + 1; + UILabel label = new UILabel(String.format("%s%d%s", Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); + UIComboBox level = new UIComboBox(VanChartMapSourceChoosePane.ZOOM_LEVELS); + level.setEnabled(i != 0); + UIComboBox type = new UIComboBox(items); + detailComps[i + 1] = new Component[]{label, level, type}; + } + + return TableLayoutHelper.createGapTableLayoutPane(detailComps, rowSize, columnSize, 10, 6); + } + + @Override + public void populateBean(VanChartDrillMapPlot drillMapPlot) { + + if (drillMapPlot != null) { + java.util.List levelList = drillMapPlot.getLayerLevelList(); + java.util.List mapTypeList = drillMapPlot.getLayerMapTypeList(); + + for (int i = 0; i < levelList.size(); i++) { + Component[] components = detailComps[i + 1]; + if (components != null) { + UIComboBox level = (UIComboBox) components[1]; + UIComboBox type = (UIComboBox) components[2]; + if (level != null) { + level.setSelectedItem(levelList.get(i)); + } + if (type != null) { + type.setSelectedItem(mapTypeList.get(i).getLocaleString()); + } + } + } + } + } + + /** + * Update. + */ + @Override + public VanChartDrillMapPlot updateBean() { + return null; + } + + @Override + public void updateBean(VanChartDrillMapPlot drillMapPlot) { + if (drillMapPlot != null && detailComps != null) { + java.util.List levelList = new ArrayList(); + java.util.List mapTypeList = new ArrayList(); + for (Component[] com : detailComps) { + if (com[1] instanceof UIComboBox && com[2] instanceof UIComboBox) { + UIComboBox level = (UIComboBox) com[1]; + UIComboBox type = (UIComboBox) com[2]; + levelList.add((ZoomLevel) level.getSelectedItem()); + if (type.getSelectedItem() != null) { + mapTypeList.add(MapType.parseLocale(type.getSelectedItem().toString())); + } + } + } + drillMapPlot.setLayerLevelList(levelList); + drillMapPlot.setLayerMapTypeList(mapTypeList); + } + } + + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Map_Drill_Level"); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/EachLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/EachLayerDataDefinitionPane.java new file mode 100644 index 0000000000..a7180e4c5d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/EachLayerDataDefinitionPane.java @@ -0,0 +1,144 @@ +package com.fr.design.chartx.data.drillMap; + +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.DrillMapChartDataDefinition; +import com.fr.design.chartx.fields.diff.AreaMapCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.AreaMapDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.PointMapCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.PointMapDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.MultiTabPane; +import com.fr.design.i18n.Toolkit; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.type.MapType; +import com.fr.plugin.chart.vanchart.VanChart; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Mitisky on 16/6/20. + * 各层级分别指定的界面 + */ +public class EachLayerDataDefinitionPane extends MultiTabPane { + + private List oldTypeList; + private VanChartDrillMapPlot plot; + + private VanChart vanChart; + + public EachLayerDataDefinitionPane(VanChart vanChart) { + this.vanChart = vanChart; + this.plot = vanChart.getPlot(); + initComps(); + } + + private void initComps() { + paneList = initPaneList(this.plot); + super.relayoutWhenListChange(); + } + + public void fireMapTypeChanged() { + if (!ComparatorUtils.equals(plot.getLayerMapTypeList(), oldTypeList)) { + initComps(); + } + } + + protected List initPaneList(VanChartDrillMapPlot drillMapPlot) { + List paneList = new ArrayList(); + + oldTypeList = drillMapPlot.getLayerMapTypeList(); + int depth = DrillMapLayerPane.getRootAndDepth(drillMapPlot).getSecond(); + + for (int i = 0; i < depth; i++) { + final String title = String.format("%s%d%s", Toolkit.i18nText("Fine-Design_Chart_Index_Article"), i, Toolkit.i18nText("Fine-Design_Chart_Index_Layer")); + MapType mapType = oldTypeList.get(i); + + SingleDataPane pane; + if (mapType == MapType.AREA) { + AreaMapDataSetFieldsPane areaMapDataSetFieldsPane = new AreaMapDataSetFieldsPane(); + areaMapDataSetFieldsPane.setChart(vanChart); + areaMapDataSetFieldsPane.setLevel(i); + pane = new SingleDataPane(areaMapDataSetFieldsPane, new AreaMapCellDataFieldsPane()) { + @Override + protected String title4PopupWindow() { + return title; + } + + }; + } else { + PointMapDataSetFieldsPane pointMapDataSetFieldsPane = new PointMapDataSetFieldsPane(); + pointMapDataSetFieldsPane.setChart(vanChart); + pointMapDataSetFieldsPane.setLevel(i); + pane = new SingleDataPane(pointMapDataSetFieldsPane, new PointMapCellDataFieldsPane()) { + @Override + protected String title4PopupWindow() { + return title; + } + }; + } + + paneList.add(pane); + } + + return paneList; + } + + @Override + public void relayoutWhenListChange() { + } + + @Override + protected List initPaneList() { + return new ArrayList(); + } + + @Override + public void populateBean(DrillMapChartDataDefinition drillMapChartDataDefinition) { + List eachLayerDataDefinitionList = drillMapChartDataDefinition.getEachLayerDataDefinitionList(); + + if (eachLayerDataDefinitionList == null) { + return; + } + + for (int i = 0, len = Math.min(paneList.size(), eachLayerDataDefinitionList.size()); i < len; i++) { + BasicPane basicPane = paneList.get(i); + if (basicPane instanceof SingleDataPane) { + ((SingleDataPane) basicPane).populateBean(eachLayerDataDefinitionList.get(i)); + } + } + } + + @Override + public DrillMapChartDataDefinition updateBean() { + return null; + } + + @Override + public void updateBean(DrillMapChartDataDefinition drillMapDefinition) { + List eachLayerDataDefinitionList = new ArrayList(); + for (BasicPane basicPane : paneList) { + if (basicPane instanceof SingleDataPane) { + eachLayerDataDefinitionList.add(((SingleDataPane) basicPane).updateBean()); + } + } + drillMapDefinition.setEachLayerDataDefinitionList(eachLayerDataDefinitionList); + } + + @Override + public boolean accept(Object ob) { + return false; + } + + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Each_Layer_Data_Special"); + } + + @Override + public void reset() { + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java new file mode 100644 index 0000000000..09393918a5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java @@ -0,0 +1,115 @@ +package com.fr.design.chartx.data.map; + +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.util.Arrays; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/13 + */ +public abstract class AbstractAreaLngLatPane extends JPanel { + private JPanel centerPane; + private UIButtonGroup locationType; + + private JPanel areaPane; + private JPanel lngLatAreaPane; + + protected abstract JPanel createAreaPane(); + + protected abstract JPanel createAreaLngLatPane(); + + public AbstractAreaLngLatPane() { + initComponents(); + } + + protected void initComponents() { + centerPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (locationType.getSelectedIndex() == 0) { + return areaPane.getPreferredSize(); + } else { + return lngLatAreaPane.getPreferredSize(); + } + } + }; + + locationType = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Location_With_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Location_With_LongAndLat")}); + locationType.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCenterPane(); + } + }); + + lngLatAreaPane = createAreaLngLatPane(); + areaPane = createAreaPane(); + + centerPane.add(areaPane, "area"); + centerPane.add(lngLatAreaPane, "longLat"); + + locationType.setSelectedIndex(0); + + this.setLayout(new BorderLayout(0, 6)); + this.add(locationType, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + + private void checkCenterPane() { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (locationType.getSelectedIndex() == 0) { + cardLayout.show(centerPane, "area"); + } else { + cardLayout.show(centerPane, "longLat"); + } + } + + public void populate(boolean useAreaName) { + locationType.setSelectedIndex(useAreaName ? 0 : 1); + + checkCenterPane(); + } + + public boolean update() { + return locationType.getSelectedIndex() == 0; + } + + protected JPanel createPane(String[] labels, JComponent... fieldComponents) { + + int len = Math.min(labels.length, fieldComponents.length); + + if (len == 0) { + return new JPanel(); + } + + Component[][] components = new Component[len][2]; + for (int i = 0; i < len; i++) { + components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]}; + } + double p = TableLayout.PREFERRED; + double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122}; + double[] rowSize = new double[len]; + Arrays.fill(rowSize, p); + + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6); + } + +} + diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java new file mode 100644 index 0000000000..5d2f2298a8 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithComboBox.java @@ -0,0 +1,121 @@ +package com.fr.design.chartx.data.map; + +import com.fr.chartx.data.field.diff.LineMapColumnFieldCollection; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.LineMapDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/13 + */ +public class LineMapAreaLngLatPaneWithComboBox extends LineMapAreaLngLatPaneWithTinyFormula { + private UIComboBox fromArea_tab0; + private UIComboBox toArea_tab0; + + private UIComboBox fromArea_tab1; + private UIComboBox fromLng_tab1; + private UIComboBox fromLat_tab1; + private UIComboBox toArea_tab1; + private UIComboBox toLng_tab1; + private UIComboBox toLat_tab1; + + private LineMapDataSetFieldsPane lineMapDataSetFieldsPane; + + public LineMapAreaLngLatPaneWithComboBox(LineMapDataSetFieldsPane lineMapDataSetFieldsPane) { + this.lineMapDataSetFieldsPane = lineMapDataSetFieldsPane; + initComponents(); + } + + protected void initComponents() { + if (lineMapDataSetFieldsPane == null) { + return; + } + super.initComponents(); + } + + + @Override + protected JPanel createAreaPane() { + if (fromArea_tab0 == null) { + fromArea_tab0 = new UIComboBox(); + toArea_tab0 = new UIComboBox(); + } + return createPane( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")}, + lineMapDataSetFieldsPane.createAreaPanel(fromArea_tab0), lineMapDataSetFieldsPane.createAreaPanel(toArea_tab0) + ); + } + + @Override + protected JPanel createAreaLngLatPane() { + if (fromArea_tab1 == null) { + fromArea_tab1 = new UIComboBox(); + fromLng_tab1 = new UIComboBox(); + fromLat_tab1 = new UIComboBox(); + toArea_tab1 = new UIComboBox(); + toLng_tab1 = new UIComboBox(); + toLat_tab1 = new UIComboBox(); + } + return createPane( + new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Start_Longitude"), + Toolkit.i18nText("Fine-Design_Chart_Start_Latitude"), + Toolkit.i18nText("Fine-Design_Chart_End_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_End_Longitude"), + Toolkit.i18nText("Fine-Design_Chart_End_Latitude")}, + lineMapDataSetFieldsPane.createAreaPanel(fromArea_tab1), + fromLng_tab1, + fromLat_tab1, + lineMapDataSetFieldsPane.createAreaPanel(toArea_tab1), + toLng_tab1, + toLat_tab1); + } + + protected void populateTab0(LineMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.populateField(fromArea_tab0, fieldCollection.getFromAreaName()); + AbstractDataSetFieldsPane.populateField(toArea_tab0, fieldCollection.getToAreaName()); + } + + protected void updateTab0(LineMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.updateField(fromArea_tab0, fieldCollection.getFromAreaName()); + AbstractDataSetFieldsPane.updateField(toArea_tab0, fieldCollection.getToAreaName()); + } + + protected void populateTab1(LineMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.populateField(fromArea_tab1, fieldCollection.getFromAreaName()); + AbstractDataSetFieldsPane.populateField(toArea_tab1, fieldCollection.getToAreaName()); + AbstractDataSetFieldsPane.populateField(fromLng_tab1, fieldCollection.getFromLng()); + AbstractDataSetFieldsPane.populateField(toLng_tab1, fieldCollection.getToLng()); + AbstractDataSetFieldsPane.populateField(fromLat_tab1, fieldCollection.getFromLat()); + AbstractDataSetFieldsPane.populateField(toLat_tab1, fieldCollection.getToLat()); + } + + protected void updateTab1(LineMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.updateField(fromArea_tab1, fieldCollection.getFromAreaName()); + AbstractDataSetFieldsPane.updateField(toArea_tab1, fieldCollection.getToAreaName()); + AbstractDataSetFieldsPane.updateField(fromLng_tab1, fieldCollection.getFromLng()); + AbstractDataSetFieldsPane.updateField(toLng_tab1, fieldCollection.getToLng()); + AbstractDataSetFieldsPane.updateField(fromLat_tab1, fieldCollection.getFromLat()); + AbstractDataSetFieldsPane.updateField(toLat_tab1, fieldCollection.getToLat()); + } + + public UIComboBox[] allFieldComboBox() { + return new UIComboBox[]{ + fromArea_tab0, + toArea_tab0, + fromArea_tab1, + fromLng_tab1, + fromLat_tab1, + toArea_tab1, + toLng_tab1, + toLat_tab1 + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithTinyFormula.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithTinyFormula.java new file mode 100644 index 0000000000..2fb37fee55 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/LineMapAreaLngLatPaneWithTinyFormula.java @@ -0,0 +1,113 @@ +package com.fr.design.chartx.data.map; + +import com.fr.chartx.data.field.diff.LineMapColumnFieldCollection; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; + +import javax.swing.JPanel; + + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/13 + */ +public class LineMapAreaLngLatPaneWithTinyFormula extends AbstractAreaLngLatPane { + private TinyFormulaPane fromArea_tab0; + private TinyFormulaPane toArea_tab0; + + private TinyFormulaPane fromArea_tab1; + private TinyFormulaPane fromLng_tab1; + private TinyFormulaPane fromLat_tab1; + private TinyFormulaPane toArea_tab1; + private TinyFormulaPane toLng_tab1; + private TinyFormulaPane toLat_tab1; + + + @Override + protected JPanel createAreaPane() { + if (fromArea_tab0 == null) { + fromArea_tab0 = new TinyFormulaPane(); + toArea_tab0 = new TinyFormulaPane(); + } + return createPane( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")}, + fromArea_tab0, toArea_tab0 + ); + } + + @Override + protected JPanel createAreaLngLatPane() { + if (fromArea_tab1 == null) { + fromArea_tab1 = new TinyFormulaPane(); + fromLng_tab1 = new TinyFormulaPane(); + fromLat_tab1 = new TinyFormulaPane(); + toArea_tab1 = new TinyFormulaPane(); + toLng_tab1 = new TinyFormulaPane(); + toLat_tab1 = new TinyFormulaPane(); + } + return createPane( + new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_Start_Longitude"), + Toolkit.i18nText("Fine-Design_Chart_Start_Latitude"), + Toolkit.i18nText("Fine-Design_Chart_End_Area_Name"), + Toolkit.i18nText("Fine-Design_Chart_End_Longitude"), + Toolkit.i18nText("Fine-Design_Chart_End_Latitude")}, + fromArea_tab1, + fromLng_tab1, + fromLat_tab1, + toArea_tab1, + toLng_tab1, + toLat_tab1); + } + + protected void populateTab0(LineMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.populateField(fromArea_tab0, fieldCollection.getFromAreaName()); + AbstractCellDataFieldsPane.populateField(toArea_tab0, fieldCollection.getToAreaName()); + } + + protected void updateTab0(LineMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.updateField(fromArea_tab0, fieldCollection.getFromAreaName()); + AbstractCellDataFieldsPane.updateField(toArea_tab0, fieldCollection.getToAreaName()); + } + + protected void populateTab1(LineMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.populateField(fromArea_tab1, fieldCollection.getFromAreaName()); + AbstractCellDataFieldsPane.populateField(toArea_tab1, fieldCollection.getToAreaName()); + AbstractCellDataFieldsPane.populateField(fromLng_tab1, fieldCollection.getFromLng()); + AbstractCellDataFieldsPane.populateField(toLng_tab1, fieldCollection.getToLng()); + AbstractCellDataFieldsPane.populateField(fromLat_tab1, fieldCollection.getFromLat()); + AbstractCellDataFieldsPane.populateField(toLat_tab1, fieldCollection.getToLat()); + } + + protected void updateTab1(LineMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.updateField(fromArea_tab1, fieldCollection.getFromAreaName()); + AbstractCellDataFieldsPane.updateField(toArea_tab1, fieldCollection.getToAreaName()); + AbstractCellDataFieldsPane.updateField(fromLng_tab1, fieldCollection.getFromLng()); + AbstractCellDataFieldsPane.updateField(toLng_tab1, fieldCollection.getToLng()); + AbstractCellDataFieldsPane.updateField(fromLat_tab1, fieldCollection.getFromLat()); + AbstractCellDataFieldsPane.updateField(toLat_tab1, fieldCollection.getToLat()); + } + + public void populate(LineMapColumnFieldCollection fieldCollection) { + super.populate(fieldCollection.isUseAreaName()); + if (fieldCollection.isUseAreaName()) { + populateTab0(fieldCollection); + } else { + populateTab1(fieldCollection); + } + } + + public void update(LineMapColumnFieldCollection fieldCollection) { + fieldCollection.setUseAreaName(super.update()); + if (fieldCollection.isUseAreaName()) { + updateTab0(fieldCollection); + } else { + updateTab1(fieldCollection); + } + } +} + diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java new file mode 100644 index 0000000000..fd4790d57d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java @@ -0,0 +1,108 @@ +package com.fr.design.chartx.data.map; + +import com.fr.chartx.data.MapChartDataDefinition; +import com.fr.design.chartx.AbstractChartDataPane; +import com.fr.design.chartx.fields.diff.AreaMapCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.AreaMapDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.LineMapCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.LineMapDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.PointMapCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.PointMapDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.type.MapType; +import com.fr.van.chart.map.designer.VanMapAreaPointAndLineGroupPane; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/12 + */ +public class MapChartDataPane extends AbstractChartDataPane { + + private SingleDataPane areaPane; + private SingleDataPane pointPane; + private SingleDataPane linePane; + + public MapChartDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected JPanel createContentPane() { + MapType mapType = MapType.AREA; + if (this.getVanChart() != null) { + VanChartMapPlot mapPlot = this.getVanChart().getPlot(); + mapType = mapPlot == null ? mapType : mapPlot.getMapType(); + } + AreaMapDataSetFieldsPane areaMapDataSetFieldsPane; + PointMapDataSetFieldsPane pointMapDataSetFieldsPane; + LineMapDataSetFieldsPane lineMapDataSetFieldsPane; + switch (mapType) { + case AREA: + areaMapDataSetFieldsPane = new AreaMapDataSetFieldsPane(); + areaMapDataSetFieldsPane.setChart(getVanChart()); + areaPane = new SingleDataPane(areaMapDataSetFieldsPane, new AreaMapCellDataFieldsPane()); + return areaPane; + case POINT: + pointMapDataSetFieldsPane = new PointMapDataSetFieldsPane(); + pointMapDataSetFieldsPane.setChart(getVanChart()); + pointPane = new SingleDataPane(pointMapDataSetFieldsPane, new PointMapCellDataFieldsPane()); + return pointPane; + case LINE: + lineMapDataSetFieldsPane = new LineMapDataSetFieldsPane(); + lineMapDataSetFieldsPane.setChart(getVanChart()); + linePane = new SingleDataPane(lineMapDataSetFieldsPane, new LineMapCellDataFieldsPane()); + return linePane; + case CUSTOM: + areaMapDataSetFieldsPane = new AreaMapDataSetFieldsPane(); + areaMapDataSetFieldsPane.setChart(getVanChart()); + pointMapDataSetFieldsPane = new PointMapDataSetFieldsPane(); + pointMapDataSetFieldsPane.setChart(getVanChart()); + lineMapDataSetFieldsPane = new LineMapDataSetFieldsPane(); + lineMapDataSetFieldsPane.setChart(getVanChart()); + areaPane = new SingleDataPane(areaMapDataSetFieldsPane, new AreaMapCellDataFieldsPane()); + pointPane = new SingleDataPane(pointMapDataSetFieldsPane, new PointMapCellDataFieldsPane()); + linePane = new SingleDataPane(lineMapDataSetFieldsPane, new LineMapCellDataFieldsPane()); + return new VanMapAreaPointAndLineGroupPane(areaPane, pointPane, linePane); + default: + areaPane = new SingleDataPane(new AreaMapDataSetFieldsPane(), new AreaMapCellDataFieldsPane()); + return areaPane; + } + } + + @Override + protected void populate(MapChartDataDefinition mapChartDataDefinition) { + if (mapChartDataDefinition == null) { + return; + } + if (areaPane != null) { + areaPane.populateBean(mapChartDataDefinition.getAreaMapDataDefinition()); + } + if (pointPane != null) { + pointPane.populateBean(mapChartDataDefinition.getPointMapDataDefinition()); + } + if (linePane != null) { + linePane.populateBean(mapChartDataDefinition.getLineMapDataDefinition()); + } + + } + + @Override + protected MapChartDataDefinition update() { + MapChartDataDefinition mapChartDataDefinition = new MapChartDataDefinition(); + if (areaPane != null) { + mapChartDataDefinition.setAreaMapDataDefinition(areaPane.updateBean()); + } + if (pointPane != null) { + mapChartDataDefinition.setPointMapDataDefinition(pointPane.updateBean()); + } + if (linePane != null) { + mapChartDataDefinition.setLineMapDataDefinition(linePane.updateBean()); + } + return mapChartDataDefinition; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java new file mode 100644 index 0000000000..b3b503ddda --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithComboBox.java @@ -0,0 +1,86 @@ +package com.fr.design.chartx.data.map; + +import com.fr.chartx.data.field.diff.PointMapColumnFieldCollection; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.chartx.fields.diff.PointMapDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/13 + */ +public class PointMapAreaLngLatPaneWithComboBox extends PointMapAreaLngLatPaneWithTinyFormula { + private UIComboBox area_tab0; + + private UIComboBox area_tab1; + private UIComboBox lng_tab1; + private UIComboBox lat_tab1; + + private PointMapDataSetFieldsPane pointMapDataSetFieldsPane; + + public PointMapAreaLngLatPaneWithComboBox(PointMapDataSetFieldsPane pointMapDataSetFieldsPane) { + this.pointMapDataSetFieldsPane = pointMapDataSetFieldsPane; + initComponents(); + } + + protected void initComponents() { + if (pointMapDataSetFieldsPane == null) { + return; + } + super.initComponents(); + } + + @Override + protected JPanel createAreaPane() { + if (area_tab0 == null) { + area_tab0 = new UIComboBox(); + } + return createPane( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name")}, + pointMapDataSetFieldsPane.createAreaPanel(area_tab0) + ); + } + + @Override + protected JPanel createAreaLngLatPane() { + if (area_tab1 == null) { + area_tab1 = new UIComboBox(); + lng_tab1 = new UIComboBox(); + lat_tab1 = new UIComboBox(); + } + return createPane( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Longitude"), Toolkit.i18nText("Fine-Design_Chart_Latitude")}, + pointMapDataSetFieldsPane.createAreaPanel(area_tab1), lng_tab1, lat_tab1 + ); + } + + protected void populateTab0(PointMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.populateField(area_tab0, fieldCollection.getAreaName()); + } + + protected void updateTab0(PointMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.updateField(area_tab0, fieldCollection.getAreaName()); + } + + protected void populateTab1(PointMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.populateField(area_tab1, fieldCollection.getAreaName()); + AbstractDataSetFieldsPane.populateField(lng_tab1, fieldCollection.getLng()); + AbstractDataSetFieldsPane.populateField(lat_tab1, fieldCollection.getLat()); + } + + protected void updateTab1(PointMapColumnFieldCollection fieldCollection) { + AbstractDataSetFieldsPane.updateField(area_tab1, fieldCollection.getAreaName()); + AbstractDataSetFieldsPane.updateField(lng_tab1, fieldCollection.getLng()); + AbstractDataSetFieldsPane.updateField(lat_tab1, fieldCollection.getLat()); + } + + public UIComboBox[] allFieldComboBox() { + return new UIComboBox[]{ + area_tab0, area_tab1, lng_tab1, lat_tab1 + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithTinyFormula.java b/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithTinyFormula.java new file mode 100644 index 0000000000..6da5a1b383 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/map/PointMapAreaLngLatPaneWithTinyFormula.java @@ -0,0 +1,84 @@ +package com.fr.design.chartx.data.map; + +import com.fr.chartx.data.field.diff.PointMapColumnFieldCollection; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/13 + */ +public class PointMapAreaLngLatPaneWithTinyFormula extends AbstractAreaLngLatPane { + private TinyFormulaPane area_tab0; + + private TinyFormulaPane area_tab1; + private TinyFormulaPane lng_tab1; + private TinyFormulaPane lat_tab1; + + + @Override + protected JPanel createAreaPane() { + if (area_tab0 == null) { + area_tab0 = new TinyFormulaPane(); + } + return createPane( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name")}, + area_tab0 + ); + } + + @Override + protected JPanel createAreaLngLatPane() { + if (area_tab1 == null) { + area_tab1 = new TinyFormulaPane(); + lng_tab1 = new TinyFormulaPane(); + lat_tab1 = new TinyFormulaPane(); + } + return createPane( + new String[]{Toolkit.i18nText("Fine-Design_Chart_Area_Name"), Toolkit.i18nText("Fine-Design_Chart_Longitude"), Toolkit.i18nText("Fine-Design_Chart_Latitude")}, + area_tab1, lng_tab1, lat_tab1 + ); + } + + protected void populateTab0(PointMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.populateField(area_tab0, fieldCollection.getAreaName()); + } + + protected void updateTab0(PointMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.updateField(area_tab0, fieldCollection.getAreaName()); + } + + protected void populateTab1(PointMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.populateField(area_tab1, fieldCollection.getAreaName()); + AbstractCellDataFieldsPane.populateField(lng_tab1, fieldCollection.getLng()); + AbstractCellDataFieldsPane.populateField(lat_tab1, fieldCollection.getLat()); + } + + protected void updateTab1(PointMapColumnFieldCollection fieldCollection) { + AbstractCellDataFieldsPane.updateField(area_tab1, fieldCollection.getAreaName()); + AbstractCellDataFieldsPane.updateField(lng_tab1, fieldCollection.getLng()); + AbstractCellDataFieldsPane.updateField(lat_tab1, fieldCollection.getLat()); + } + + public void populate(PointMapColumnFieldCollection fieldCollection) { + super.populate(fieldCollection.isUseAreaName()); + if (fieldCollection.isUseAreaName()) { + populateTab0(fieldCollection); + } else { + populateTab1(fieldCollection); + } + } + + public void update(PointMapColumnFieldCollection fieldCollection) { + fieldCollection.setUseAreaName(super.update()); + if (fieldCollection.isUseAreaName()) { + updateTab0(fieldCollection); + } else { + updateTab1(fieldCollection); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java index b302ec8632..6d1cf932ad 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java @@ -47,7 +47,7 @@ public abstract class AbstractCellDataFieldsPane extends BasicBeanPane { + public String tableName; + public AbstractDataSetFieldsPane() { initComponents(); } + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + protected void initComponents() { this.setLayout(new BorderLayout(0, 6)); - this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15)); + this.setBorder(BorderFactory.createEmptyBorder(6, 24, 0, 15)); JPanel north = createNorthPane(), center = createCenterPane(), @@ -95,7 +107,7 @@ public abstract class AbstractDataSetFieldsPane +public abstract class AbstractCellDataFieldsWithSeriesValuePane extends AbstractCellDataFieldsPane { private CellDataSeriesValueCorrelationPane seriesValueFieldsPane; @@ -41,12 +41,12 @@ public abstract class AbstractCellDataFieldsWithSeriesValuePane +public abstract class AbstractDataSetFieldsWithSeriesValuePane extends AbstractDataSetFieldsPane { private SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane; @@ -61,11 +61,11 @@ public abstract class AbstractDataSetFieldsWithSeriesValuePane { + private TinyFormulaPane areaName; + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name") + }; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[]{ + createAreaName() + }; + } + + private TinyFormulaPane createAreaName() { + if (areaName == null) { + areaName = new TinyFormulaPane(); + } + return areaName; + } + + @Override + public void populateBean(AreaMapColumnFieldCollection ob) { + populateField(areaName, ob.getAreaName()); + populateSeriesValuePane(ob); + } + + @Override + public AreaMapColumnFieldCollection updateBean() { + AreaMapColumnFieldCollection fieldCollection = new AreaMapColumnFieldCollection(); + updateField(areaName, fieldCollection.getAreaName()); + updateSeriesValuePane(fieldCollection); + return fieldCollection; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AreaMapDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AreaMapDataSetFieldsPane.java new file mode 100644 index 0000000000..2f4dc37ea1 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AreaMapDataSetFieldsPane.java @@ -0,0 +1,59 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.AreaMapColumnFieldCollection; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; + +import java.awt.Component; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/7 + */ +public class AreaMapDataSetFieldsPane extends MapDataSetFieldsPane { + + private UIComboBox areaName; + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Area_Name") + }; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{ + createAreaName() + }; + } + + @Override + protected Component[] fieldComponents() { + return new Component[]{ + createAreaPanel(createAreaName()) + }; + } + + private UIComboBox createAreaName() { + if (areaName == null) { + areaName = new UIComboBox(); + } + return areaName; + } + + @Override + public void populateBean(AreaMapColumnFieldCollection ob) { + populateField(areaName, ob.getAreaName()); + populateSeriesValuePane(ob); + } + + @Override + public AreaMapColumnFieldCollection updateBean() { + AreaMapColumnFieldCollection fieldCollection = new AreaMapColumnFieldCollection(); + updateField(areaName, fieldCollection.getAreaName()); + updateSeriesValuePane(fieldCollection); + return fieldCollection; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java new file mode 100644 index 0000000000..c1766576c4 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelCellDataFieldsPane.java @@ -0,0 +1,69 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/10/23. + * 饼图、多指针仪表盘 在组合图中 没有分类配置项, 也用这个。 + */ +public class FunnelCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { + + private AbstractSingleFilterPane filterPane; + + @Override + protected void initComponents() { + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[0]; + } + + @Override + public ColumnFieldCollectionWithSeriesValue updateBean() { + ColumnFieldCollectionWithSeriesValue fieldCollection = new ColumnFieldCollectionWithSeriesValue(); + updateSeriesValuePane(fieldCollection); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); + seriesValueCorrelationDefinition.setFilterProperties(filterPane.updateBean()); + return fieldCollection; + } + + @Override + public void populateBean(ColumnFieldCollectionWithSeriesValue ob) { + populateSeriesValuePane(ob); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); + filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java new file mode 100644 index 0000000000..ee15e39450 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/FunnelDataSetFieldsPane.java @@ -0,0 +1,71 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/10/23. + * 饼图、多指针仪表盘 在组合图中 没有分类配置项, 也用这个。 + */ +public class FunnelDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { + + + private AbstractSingleFilterPane filterPane; + + @Override + protected void initComponents() { + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[0]; + } + + @Override + public ColumnFieldCollectionWithSeriesValue updateBean() { + ColumnFieldCollectionWithSeriesValue collection = new ColumnFieldCollectionWithSeriesValue(); + updateSeriesValuePane(collection); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = collection.getSeriesValueCorrelationDefinition(); + seriesValueCorrelationDefinition.setFilterProperties(filterPane.updateBean()); + return collection; + } + + @Override + public void populateBean(ColumnFieldCollectionWithSeriesValue ob) { + populateSeriesValuePane(ob); + SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = ob.getSeriesValueCorrelationDefinition(); + filterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java new file mode 100644 index 0000000000..f93cf0effa --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeCellDataFieldsPane.java @@ -0,0 +1,82 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/11/07. + */ +public class GaugeCellDataFieldsPane extends AbstractCellDataFieldsPane { + + private TinyFormulaPane category; + private TinyFormulaPane value; + private AbstractSingleFilterPane filterPane; + + @Override + protected void initComponents() { + category = new TinyFormulaPane(); + value = new TinyFormulaPane(); + + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Category"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + } + + @Override + protected JPanel createSouthPane() { + return filterPane; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"), + Toolkit.i18nText("Fine-Design_Chart_Pointer_Value") + }; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[]{ + category, value + }; + } + + @Override + public GaugeColumnFieldCollection updateBean() { + GaugeColumnFieldCollection gauge = new GaugeColumnFieldCollection(); + updateField(category, gauge.getCategory()); + updateField(value, gauge.getValue()); + gauge.getCategory().setFilterProperties(filterPane.updateBean()); + return gauge; + } + + @Override + public void populateBean(GaugeColumnFieldCollection ob) { + populateField(category, ob.getCategory()); + populateField(value, ob.getValue()); + filterPane.populateBean(ob.getCategory().getFilterProperties()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java new file mode 100644 index 0000000000..2ff333cc79 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/GaugeDataSetFieldsPane.java @@ -0,0 +1,84 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/11/07. + */ +public class GaugeDataSetFieldsPane extends AbstractDataSetFieldsPane { + + private UIComboBox category; + private UIComboBox value; + + private AbstractSingleFilterPane filterPane; + + + @Override + protected void initComponents() { + category = new UIComboBox(); + value = new UIComboBox(); + + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Category"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"), + Toolkit.i18nText("Fine-Design_Chart_Pointer_Value") + }; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{ + category, value + }; + } + + @Override + public GaugeColumnFieldCollection updateBean() { + GaugeColumnFieldCollection gauge = new GaugeColumnFieldCollection(); + updateField(category, gauge.getCategory()); + updateField(value, gauge.getValue()); + gauge.getCategory().setFilterProperties(filterPane.updateBean()); + return gauge; + } + + @Override + public void populateBean(GaugeColumnFieldCollection ob) { + populateField(category, ob.getCategory()); + populateField(value, ob.getValue()); + filterPane.populateBean(ob.getCategory().getFilterProperties()); + } + + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapCellDataFieldsPane.java new file mode 100644 index 0000000000..7a321f0bec --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapCellDataFieldsPane.java @@ -0,0 +1,64 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.LineMapColumnFieldCollection; +import com.fr.design.chartx.data.map.LineMapAreaLngLatPaneWithTinyFormula; +import com.fr.design.formula.TinyFormulaPane; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/11 + */ +public class LineMapCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { + + private LineMapAreaLngLatPaneWithTinyFormula areaLngLatPane; + + private TinyFormulaPane lineName; + + @Override + protected JPanel createNorthPane() { + if (areaLngLatPane == null) { + areaLngLatPane = new LineMapAreaLngLatPaneWithTinyFormula(); + } + return areaLngLatPane; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + "lineName" + }; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + if (lineName == null) { + lineName = new TinyFormulaPane(); + } + return new TinyFormulaPane[]{ + lineName + }; + } + + @Override + public void populateBean(LineMapColumnFieldCollection ob) { + areaLngLatPane.populate(ob); + + populateField(lineName, ob.getLineName()); + + populateSeriesValuePane(ob); + } + + @Override + public LineMapColumnFieldCollection updateBean() { + LineMapColumnFieldCollection fieldCollection = new LineMapColumnFieldCollection(); + areaLngLatPane.update(fieldCollection); + + updateField(lineName, fieldCollection.getLineName()); + + updateSeriesValuePane(fieldCollection); + return fieldCollection; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapDataSetFieldsPane.java new file mode 100644 index 0000000000..b1a0587830 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapDataSetFieldsPane.java @@ -0,0 +1,61 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.LineMapColumnFieldCollection; +import com.fr.design.chartx.data.map.LineMapAreaLngLatPaneWithComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.third.jodd.util.ArraysUtil; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/11 + */ +public class LineMapDataSetFieldsPane extends MapDataSetFieldsPane { + private LineMapAreaLngLatPaneWithComboBox areaLngLatPane; + + private UIComboBox lineName; + + @Override + protected JPanel createNorthPane() { + if (areaLngLatPane == null) { + areaLngLatPane = new LineMapAreaLngLatPaneWithComboBox(this); + } + return areaLngLatPane; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + "lineName" + }; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + if (lineName == null) { + lineName = new UIComboBox(); + } + UIComboBox[] result = areaLngLatPane.allFieldComboBox(); + return ArraysUtil.join(new UIComboBox[]{ + lineName + }, result); + } + + @Override + public void populateBean(LineMapColumnFieldCollection ob) { + areaLngLatPane.populate(ob); + populateField(lineName, ob.getLineName()); + populateSeriesValuePane(ob); + } + + @Override + public LineMapColumnFieldCollection updateBean() { + LineMapColumnFieldCollection columnFieldCollection = new LineMapColumnFieldCollection(); + areaLngLatPane.update(columnFieldCollection); + updateField(lineName, columnFieldCollection.getLineName()); + updateSeriesValuePane(columnFieldCollection); + return columnFieldCollection; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java new file mode 100644 index 0000000000..1b6c6f9be0 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java @@ -0,0 +1,92 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.chartx.TwoTuple; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; +import com.fr.design.chartx.component.MapAreaMatchPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.plugin.chart.map.data.MapMatchResult; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; +import com.fr.plugin.chart.vanchart.VanChart; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.Set; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-12-25 + */ +public abstract class MapDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane { + + private VanChart chart; + + //钻取地图有层级,默认-1代表无层级关系 + private int level = ChartGEOJSONHelper.DEFAULT_LEVEL; + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public void setChart(VanChart chart) { + this.chart = chart; + } + + public VanChart getChart() { + return chart; + } + + public JPanel createAreaPanel(final UIComboBox areaBox) { + JPanel areaPanel = new JPanel(new BorderLayout(10, 0)); + areaBox.setPreferredSize(new Dimension(91, 20)); + areaPanel.add(areaBox, BorderLayout.WEST); + UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); + uiButton.addActionListener(new ActionListener() { + private TwoTuple> treeNodeAndItems; + + @Override + public void actionPerformed(ActionEvent e) { + VanChartMapPlot plot = chart.getPlot(); + if (treeNodeAndItems == null) { + treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level, plot.getMapType()); + } + final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems); + + String nameTable = getTableName(); + final MapMatchResult matchResult = plot.getMatchResult(level); + + pane.populateBean(matchResult, nameTable, Utils.objectToString(areaBox.getSelectedItem())); + BasicDialog dialog = pane.showWindow(new JFrame()); + dialog.addDialogActionListener(new DialogActionListener() { + @Override + public void doOk() { + pane.updateBean(matchResult); + } + + @Override + public void doCancel() { + + } + }); + dialog.setVisible(true); + } + }); + areaPanel.add(uiButton, BorderLayout.EAST); + return areaPanel; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java index 3645a08db7..72236f5684 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java @@ -1,15 +1,15 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.ColumnField; -import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; -import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.component.CategorySeriesFilterPane; import com.fr.design.chartx.component.MultiTinyFormulaPane; import com.fr.design.formula.TinyFormulaPane; -import com.fr.van.chart.map.designer.VanChartGroupPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.util.List; +import java.awt.BorderLayout; /** * Created by shine on 2019/4/12. @@ -18,43 +18,21 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS private MultiTinyFormulaPane multiCategoryPane; - private AbstractSingleFilterPane seriesFilterPane; - private AbstractSingleFilterPane categoryFilterPane; - - private void createMultiFormulaPane() { - if (multiCategoryPane == null) { - multiCategoryPane = new MultiTinyFormulaPane(); - } - } - - @Override - protected JPanel createNorthPane() { - - createMultiFormulaPane(); - - return multiCategoryPane; - } + private CategorySeriesFilterPane filterPane; @Override - protected JPanel createSouthPane() { - if (seriesFilterPane == null) { - seriesFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - //todo@shinerefactor - return "series"; - } - }; - categoryFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - return "category"; - } - }; - } - return new VanChartGroupPane(new String[]{seriesFilterPane.title4PopupWindow(), categoryFilterPane.title4PopupWindow()} - , new JPanel[]{seriesFilterPane, categoryFilterPane}) { - }; + protected void initComponents() { + multiCategoryPane = new MultiTinyFormulaPane(); + filterPane = new CategorySeriesFilterPane(); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(multiCategoryPane, BorderLayout.NORTH); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); } @Override @@ -64,9 +42,6 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS @Override protected TinyFormulaPane[] formulaPanes() { - - createMultiFormulaPane(); - List list = multiCategoryPane.componentList(); return list.toArray(new TinyFormulaPane[list.size()]); } @@ -80,15 +55,7 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS populateSeriesValuePane(multiCategoryColumnFieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); - - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties()); - } + filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection); } @Override @@ -101,15 +68,12 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS updateSeriesValuePane(fieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean()); - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean()); - } + filterPane.updateMultiCategoryFieldCollection(fieldCollection); return fieldCollection; } -} + + public void setCategoryAxis(boolean categoryAxis){ + multiCategoryPane.setCategoryAxis(categoryAxis); + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java index 5b18d8ae83..cba3807a92 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java @@ -1,15 +1,16 @@ package com.fr.design.chartx.fields.diff; import com.fr.chartx.data.field.ColumnField; -import com.fr.chartx.data.field.SeriesValueCorrelationDefinition; import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; -import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.component.CategorySeriesFilterPane; import com.fr.design.chartx.component.MultiComboBoxPane; import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.van.chart.map.designer.VanChartGroupPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.JSeparator; import java.util.List; +import java.awt.BorderLayout; /** @@ -19,8 +20,23 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer private MultiComboBoxPane multiCategoryPane; - private AbstractSingleFilterPane seriesFilterPane; - private AbstractSingleFilterPane categoryFilterPane; + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + multiCategoryPane = new MultiComboBoxPane(); + filterPane = new CategorySeriesFilterPane(); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(multiCategoryPane, BorderLayout.NORTH); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } @Override protected String[] fieldLabels() { @@ -29,42 +45,14 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer @Override protected UIComboBox[] filedComboBoxes() { - List list = initMultiCategoryPane().componentList(); + List list = multiCategoryPane.componentList(); return list.toArray(new UIComboBox[list.size()]); } - private MultiComboBoxPane initMultiCategoryPane() { - if (multiCategoryPane == null) { - multiCategoryPane = new MultiComboBoxPane(); - } - return multiCategoryPane; - } - @Override - protected JPanel createNorthPane() { - return initMultiCategoryPane(); - } - - @Override - protected JPanel createSouthPane() { - if (seriesFilterPane == null) { - seriesFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - //todo@shinerefactor - return "series"; - } - }; - categoryFilterPane = new AbstractSingleFilterPane() { - @Override - public String title4PopupWindow() { - return "category"; - } - }; - } - return new VanChartGroupPane(new String[]{seriesFilterPane.title4PopupWindow(), categoryFilterPane.title4PopupWindow()} - , new JPanel[]{seriesFilterPane, categoryFilterPane}) { - }; + public void checkBoxUse(boolean hasUse) { + super.checkBoxUse(hasUse); + multiCategoryPane.checkEnable(hasUse); } @Override @@ -81,15 +69,7 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer populateSeriesValuePane(multiCategoryColumnFieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties()); - - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties()); - } + filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection); } @Override @@ -102,15 +82,12 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer updateSeriesValuePane(columnFieldCollection); - SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = columnFieldCollection.getSeriesValueCorrelationDefinition(); - if (seriesValueCorrelationDefinition != null) { - seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean()); - } - - if (categoryList != null && !categoryList.isEmpty()) { - categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean()); - } + filterPane.updateMultiCategoryFieldCollection(columnFieldCollection); return columnFieldCollection; } + + public void setCategoryAxis(boolean categoryAxis){ + multiCategoryPane.setCategoryAxis(categoryAxis); + } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java index 950f49401a..32ab6e604c 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java @@ -4,10 +4,19 @@ import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection; import com.fr.design.chartx.component.MultiTinyFormulaPaneWithUISpinner; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.JSeparator; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by shine on 2019/6/18. @@ -30,7 +39,18 @@ public class MultiPieCellDataFieldsPane extends AbstractCellDataFieldsPane { + private PointMapAreaLngLatPaneWithTinyFormula areaLngLatPane; + + @Override + protected JPanel createNorthPane() { + if (areaLngLatPane == null) { + areaLngLatPane = new PointMapAreaLngLatPaneWithTinyFormula(); + } + return areaLngLatPane; + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[0]; + } + + @Override + public void populateBean(PointMapColumnFieldCollection ob) { + areaLngLatPane.populate(ob); + populateSeriesValuePane(ob); + } + + @Override + public PointMapColumnFieldCollection updateBean() { + PointMapColumnFieldCollection fieldCollection = new PointMapColumnFieldCollection(); + areaLngLatPane.update(fieldCollection); + updateSeriesValuePane(fieldCollection); + return fieldCollection; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/PointMapDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/PointMapDataSetFieldsPane.java new file mode 100644 index 0000000000..220f840d33 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/PointMapDataSetFieldsPane.java @@ -0,0 +1,51 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.PointMapColumnFieldCollection; +import com.fr.design.chartx.data.map.PointMapAreaLngLatPaneWithComboBox; +import com.fr.design.gui.icombobox.UIComboBox; + +import javax.swing.JPanel; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2019/11/8 + */ +public class PointMapDataSetFieldsPane extends MapDataSetFieldsPane { + private PointMapAreaLngLatPaneWithComboBox areaLngLatPane; + + @Override + protected JPanel createNorthPane() { + if (areaLngLatPane == null) { + areaLngLatPane = new PointMapAreaLngLatPaneWithComboBox(this); + } + return areaLngLatPane; + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + if (areaLngLatPane == null) { + areaLngLatPane = new PointMapAreaLngLatPaneWithComboBox(this); + } + return areaLngLatPane.allFieldComboBox(); + } + + @Override + public void populateBean(PointMapColumnFieldCollection ob) { + areaLngLatPane.populate(ob); + populateSeriesValuePane(ob); + } + + @Override + public PointMapColumnFieldCollection updateBean() { + PointMapColumnFieldCollection fieldCollection = new PointMapColumnFieldCollection(); + areaLngLatPane.update(fieldCollection); + updateSeriesValuePane(fieldCollection); + return fieldCollection; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java new file mode 100644 index 0000000000..06a177ea9a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterCellDataFieldsPane.java @@ -0,0 +1,88 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.component.CellDataSeriesXYValueCorrelationPane; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/11/04. + */ +public class ScatterCellDataFieldsPane extends AbstractCellDataFieldsPane { + + private CellDataSeriesXYValueCorrelationPane seriesXYValueCorrelationPane; + private AbstractSingleFilterPane filterPane; + + + public CellDataSeriesXYValueCorrelationPane getSeriesXYValueCorrelationPane() { + return seriesXYValueCorrelationPane; + } + + public void setSeriesXYValueCorrelationPane(CellDataSeriesXYValueCorrelationPane seriesXYValueCorrelationPane) { + this.seriesXYValueCorrelationPane = seriesXYValueCorrelationPane; + } + + @Override + protected void initComponents() { + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; + + this.setLayout(new BorderLayout(0, 6)); + this.add(createCenterPane(), BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + + } + + @Override + protected JPanel createCenterPane() { + JPanel normalCenter = super.createCenterPane(); + seriesXYValueCorrelationPane = new CellDataSeriesXYValueCorrelationPane(); + + if (normalCenter != null) { + JPanel panel = new JPanel(new BorderLayout(0, 6)); + panel.add(normalCenter, BorderLayout.NORTH); + panel.add(seriesXYValueCorrelationPane, BorderLayout.CENTER); + return panel; + } else { + return seriesXYValueCorrelationPane; + } + + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[0]; + } + + @Override + public BubbleColumnFieldCollection updateBean() { + BubbleColumnFieldCollection collection = new BubbleColumnFieldCollection(); + seriesXYValueCorrelationPane.updateBean(collection); + collection.setFilterProperties(filterPane.updateBean()); + return collection; + } + + @Override + public void populateBean(BubbleColumnFieldCollection ob) { + seriesXYValueCorrelationPane.populateBean(ob); + filterPane.populateBean(ob.getFilterProperties()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java new file mode 100644 index 0000000000..c5f4fdc3d8 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/ScatterDataSetFieldsPane.java @@ -0,0 +1,100 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.BubbleColumnField; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.design.chartx.component.AbstractSingleFilterPane; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.i18n.Toolkit; +import com.fr.extended.chart.UIComboBoxWithNone; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; + +/** + * Created by Wim on 2019/10/29. + */ +public class ScatterDataSetFieldsPane extends AbstractDataSetFieldsPane { + + private UIComboBoxWithNone series; + private UIComboBox xField; + private UIComboBox yField; + private UIComboBoxWithNone size; + + private AbstractSingleFilterPane filterPane; + + + @Override + protected void initComponents() { + + series = new UIComboBoxWithNone(); + xField = new UIComboBox(); + yField = new UIComboBox(); + size = new UIComboBoxWithNone(); + + filterPane = new AbstractSingleFilterPane() { + @Override + public String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Chart_Series"); + } + }; + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + JPanel contentPane = new JPanel(new BorderLayout()); + contentPane.add(new JPanel(), BorderLayout.NORTH); + contentPane.add(filterPane, BorderLayout.CENTER); + this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{ + series, xField, yField, size + }; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + "x", + "y", + Toolkit.i18nText("Fine-Design_Chart_Use_Value") + }; + } + + @Override + public BubbleColumnFieldCollection updateBean() { + BubbleColumnFieldCollection collection = new BubbleColumnFieldCollection(); + BubbleColumnField field = new BubbleColumnField(); + updateField(series, field.getSeriesName()); + updateField(xField, field.getXField()); + updateField(yField, field.getYField()); + updateField(size, field.getSizeField()); + collection.setFilterProperties(filterPane.updateBean()); + collection.add(field); + return collection; + } + + @Override + public void populateBean(BubbleColumnFieldCollection ob) { + if (ob.getList().isEmpty()){ + return; + } + BubbleColumnField field = ob.getBubbleColumnField(0); + populateField(series, field.getSeriesName()); + populateField(xField, field.getXField()); + populateField(yField, field.getYField()); + populateField(size, field.getSizeField()); + filterPane.populateBean(ob.getFilterProperties()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java new file mode 100644 index 0000000000..dc90ee09f0 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryCellDataFieldsPane.java @@ -0,0 +1,84 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-10-24 + */ +public class SingleCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithSeriesValuePane { + + private TinyFormulaPane categoryPane; + + private CategorySeriesFilterPane filterPane; + + @Override + protected void initComponents() { + categoryPane = new TinyFormulaPane(); + filterPane = new CategorySeriesFilterPane(); + + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); + label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); + + JPanel northPane = new JPanel(new BorderLayout(0, 6)); + northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryPane, null, null, label, null}), BorderLayout.NORTH); + northPane.add(createCenterPane(), BorderLayout.CENTER); + northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8)); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[]{categoryPane}; + } + + @Override + public void populateBean(MultiCategoryColumnFieldCollection fieldCollection) { + if (fieldCollection.getCategoryList().size() > 0) { + populateField(categoryPane, fieldCollection.getCategoryList().get(0)); + } + + populateSeriesValuePane(fieldCollection); + + filterPane.populateMultiCategoryFieldCollection(fieldCollection); + } + + @Override + public MultiCategoryColumnFieldCollection updateBean() { + + MultiCategoryColumnFieldCollection fieldCollection = new MultiCategoryColumnFieldCollection(); + fieldCollection.getCategoryList().add(new ColumnField()); + + updateField(categoryPane, fieldCollection.getCategoryList().get(0)); + + updateSeriesValuePane(fieldCollection); + + filterPane.updateMultiCategoryFieldCollection(fieldCollection); + + return fieldCollection; + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java new file mode 100644 index 0000000000..9eb6d94e2d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/SingleCategoryDataSetFieldsPane.java @@ -0,0 +1,108 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; +import com.fr.design.chartx.component.CategorySeriesFilterPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.extended.chart.UIComboBoxWithNone; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-10-24 + */ +public class SingleCategoryDataSetFieldsPane + extends AbstractDataSetFieldsWithSeriesValuePane { + + private static final int HGAP = 0; + private static final int VGAP = 6; + private static final int TOP = 4; + private static final int LEFT = 24; + private static final int BOTTOM = 0; + private static final int RIGHT = 15; + + private UIComboBox categoryPane; + + private CategorySeriesFilterPane filterPane; + + + public SingleCategoryDataSetFieldsPane() { + } + + public SingleCategoryDataSetFieldsPane(UIComboBox categoryPane, CategorySeriesFilterPane filterPane) { + this.categoryPane = categoryPane; + this.filterPane = filterPane; + } + + @Override + protected void initComponents() { + categoryPane = new UIComboBoxWithNone(); + filterPane = new CategorySeriesFilterPane(); + + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); + label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); + + JPanel northPane = new JPanel(new BorderLayout(HGAP, VGAP)); + northPane.add(GUICoreUtils.createBorderLayoutPane( + new Component[]{categoryPane, null, null, label, null}), + BorderLayout.NORTH + ); + northPane.add(new JSeparator(), BorderLayout.CENTER); + northPane.add(createCenterPane(), BorderLayout.SOUTH); + northPane.setBorder(BorderFactory.createEmptyBorder(TOP, LEFT, BOTTOM, RIGHT)); + + this.setLayout(new BorderLayout(HGAP, VGAP)); + this.add(northPane, BorderLayout.NORTH); + this.add(filterPane, BorderLayout.CENTER); + } + + @Override + protected String[] fieldLabels() { + return new String[0]; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + return new UIComboBox[]{categoryPane}; + } + + + @Override + public void populateBean(MultiCategoryColumnFieldCollection columnFieldCollection) { + if (columnFieldCollection.getCategoryList().size() > 0) { + populateField(categoryPane, columnFieldCollection.getCategoryList().get(0)); + } + + populateSeriesValuePane(columnFieldCollection); + + filterPane.populateMultiCategoryFieldCollection(columnFieldCollection); + } + + @Override + public MultiCategoryColumnFieldCollection updateBean() { + + MultiCategoryColumnFieldCollection columnFieldCollection = new MultiCategoryColumnFieldCollection(); + columnFieldCollection.getCategoryList().add(new ColumnField()); + + updateField(categoryPane, columnFieldCollection.getCategoryList().get(0)); + + updateSeriesValuePane(columnFieldCollection); + + filterPane.updateMultiCategoryFieldCollection(columnFieldCollection); + + return columnFieldCollection; + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java index 87ff4d3954..b9db310625 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/StructureCellDataFieldsPane.java @@ -59,7 +59,7 @@ public class StructureCellDataFieldsPane extends AbstractCellDataFieldsPane { @Override public void populateBean(CellDataDefinition ob) { + + if (ob == null || ob.getColumnFieldCollection() == null) { + return; + } + cellDataFieldsPane.populateBean(ob.getColumnFieldCollection()); } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java b/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java index 98394c31a0..cfb9a2c18a 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java @@ -12,9 +12,9 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.utils.gui.UIComponentUtils; +import java.util.List; import java.awt.BorderLayout; import java.awt.Dimension; -import java.util.List; /** * Created by shine on 2019/5/21. @@ -39,7 +39,7 @@ public class DataSetPane extends FurtherBasicBeanPane { tableDataPane = new DatabaseTableDataPane(label) { @Override protected void userEvent() { - refreshBoxList(); + refreshBoxListAndTableName(); checkBoxUse(); } }; @@ -50,6 +50,7 @@ public class DataSetPane extends FurtherBasicBeanPane { this.setLayout(new BorderLayout()); this.add(tableDataPane, BorderLayout.NORTH); this.add(dataSetFieldsPane, BorderLayout.CENTER); + checkBoxUse(); } /** @@ -66,7 +67,7 @@ public class DataSetPane extends FurtherBasicBeanPane { /** * 刷新字段下拉列表 */ - private void refreshBoxList() { + private void refreshBoxListAndTableName() { TableDataWrapper dataWrap = tableDataPane.getTableDataWrapper(); if (dataWrap == null) { @@ -77,6 +78,7 @@ public class DataSetPane extends FurtherBasicBeanPane { if (dataSetFieldsPane != null) { dataSetFieldsPane.refreshBoxListWithSelectTableData(columnNameList); + dataSetFieldsPane.setTableName(dataWrap.getTableDataName()); } } @@ -97,12 +99,17 @@ public class DataSetPane extends FurtherBasicBeanPane { @Override public void populateBean(DataSetDefinition ob) { - refreshBoxList(); - checkBoxUse(); + if (ob == null || ob.getColumnFieldCollection() == null) { + return; + } + + refreshBoxListAndTableName(); tableDataPane.populateBean(ob.getNameTableData()); dataSetFieldsPane.populateBean(ob.getColumnFieldCollection()); + + checkBoxUse(); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java index a4e6949983..dc4dfc65ad 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java @@ -7,23 +7,24 @@ import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.constants.LayoutConstants; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.i18n.Toolkit; +import com.fr.design.utils.gui.UIComponentUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; import java.util.ArrayList; import java.util.List; +import java.awt.BorderLayout; /** * Created by shine on 2019/5/21. */ public class SingleDataPane extends BasicBeanPane { + private static final int TABLE_DATA_LABEL_LINE_WIDTH = 81; + private UIComboBoxPane comboBoxPane; private DataSetPane dataSetPane; @@ -51,11 +52,13 @@ public class SingleDataPane extends BasicBeanPane { protected void initLayout() { this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6)); JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); + + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Source")); + UIComponentUtils.setPreferedWidth(label, TABLE_DATA_LABEL_LINE_WIDTH); + northPane.add(label,BorderLayout.WEST); northPane.add(jcb, BorderLayout.CENTER); - UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Source")); - label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); - northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); - northPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 8)); + + northPane.setBorder(BorderFactory.createEmptyBorder(5,24,0,15)); this.add(northPane, BorderLayout.NORTH); this.add(cardPane, BorderLayout.CENTER); @@ -70,7 +73,6 @@ public class SingleDataPane extends BasicBeanPane { this.setLayout(new BorderLayout()); this.add(comboBoxPane, BorderLayout.CENTER); - } @Override diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index ecdb1212e9..98ba448d70 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -6,6 +6,7 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.dialog.BasicPane; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index cc8a7db137..3de9aaa09a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -70,7 +71,7 @@ public class ChangeConfigPane extends BasicBeanPane { double[] columnSize = {p, f}; double[] rowSize = {p,p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Style")),configStyleButton}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Change_Style")),configStyleButton}, new Component[]{configPane, null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -107,19 +108,19 @@ public class ChangeConfigPane extends BasicBeanPane { double[] rowSize = {p, p, p}; timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); - switchStyleGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hide")}); + switchStyleGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Show"), Toolkit.i18nText("Fine-Design_Report_Hide")}); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Time_Second"))}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")),colorSelectBox4carousel, null} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Arrow_Style")), switchStyleGroup, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Time_Interval")), timeInterval, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Time_Second"))}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Background")),colorSelectBox4carousel, null} }; return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } private JPanel createTitleStylePane() { - final UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + final UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); styleAttrPane = new ChartTextAttrPane() { protected JPanel getContentPane(JPanel buttonPane) { double p = TableLayout.PREFERRED; @@ -132,7 +133,7 @@ public class ChangeConfigPane extends BasicBeanPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ - new Component[]{text, fontNameComboBox}, + new Component[]{text, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } @@ -143,7 +144,7 @@ public class ChangeConfigPane extends BasicBeanPane { private JPanel createButtonBackgroundColorPane(){ colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Basic_Background"), colorSelectBox4button, EDIT_AREA_WIDTH); } private JPanel createButtonConfigPane() { @@ -160,8 +161,8 @@ public class ChangeConfigPane extends BasicBeanPane { } private void initButtonGroup() { - configStyleButton = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Button_Style"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Carousel_Style")}); + configStyleButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Button_Style"), + Toolkit.i18nText("Fine-Design_Chart_Carousel_Style")}); configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); configStyleButton.addActionListener(new ActionListener() { @Override @@ -227,6 +228,6 @@ public class ChangeConfigPane extends BasicBeanPane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"); + return Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java index 5aed1e47d6..ad549c5afd 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -11,8 +11,8 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.data.DataContentsPane; import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; public class ChartDataPane extends AbstractChartAttrPane { @@ -35,6 +35,7 @@ public class ChartDataPane extends AbstractChartAttrPane { return contentsPane; } + /** * 界面标题 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 766b133979..4d7673b3e7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -440,6 +440,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void changeChartName(String name) { this.setText(name); + this.setToolTipText(name); buttonName = name; } @@ -502,6 +503,13 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (this.isSelected()) { indexList.get(0).setSelected(true); changeCollectionSelected(indexList.get(0).getButtonName()); + } else {//删除的tab非选中状态, 原为选中状态的tab保持选中不变 + for (ChartChangeButton button : indexList) { + if (button.isSelected()) { + changeCollectionSelected(button.getButtonName()); + break; + } + } } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index a4626f737a..9e725917ee 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -294,13 +294,14 @@ public class ChartTypePane extends AbstractChartAttrPane{ * @param collection */ public void reLayoutEditPane(String lastPlotID, ChartCollection collection){ + if (editPane == null) { + return; + } ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class); String plotID = chart.getID(); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ + if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))) { editPane.reLayout(chart); - }else { - throw new IllegalArgumentException("editPane can not be null."); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 1277ae4632..42cf782c35 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -8,16 +8,15 @@ import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.van.chart.designer.AbstractVanChartScrollPane; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.ArrayList; -import java.util.List; /** * 一般数据界面 @@ -133,6 +132,14 @@ public class NormalChartDataPane extends DataContentsPane { tableDataPane.checkBoxUse(); } + /** + * 钻取地图需要同时更新层级 + */ + public void populate(ChartCollection collection, int level) { + populate(collection); + tableDataPane.refreshLevel(level); + } + /** * 保存 数据界面内容 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 7f22a03a6b..8863977740 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -75,6 +75,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ } if(dataContentPane != null) { dataContentPane.onSelectTableData(dataWrap); + dataContentPane.setTableName(dataWrap.getTableDataName()); } } @@ -124,6 +125,11 @@ public class TableDataPane extends FurtherBasicBeanPane{ add(dataContentPane, BorderLayout.CENTER); } } + + public void refreshLevel(int level){ + dataContentPane.refreshLevel(level); + } + /** * 更新界面属性 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java index df5d99fbdb..710b2a4218 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java @@ -6,16 +6,26 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.icombobox.UIComboBox; import javax.swing.JSeparator; +import java.util.List; import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.List; public abstract class AbstractTableDataContentPane extends BasicBeanPane{ protected static final double COMPONENT_WIDTH = 124; private boolean isNeedSummaryCaculateMethod = true; + + public String tableName; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } public abstract void updateBean(ChartCollection ob); @@ -129,4 +139,8 @@ public abstract class AbstractTableDataContentPane extends BasicBeanPane { this.add(cardPane, BorderLayout.CENTER); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); - panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); + panel.setBorder(BorderFactory.createEmptyBorder(0,10,0,10)); dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); this.add(panel, BorderLayout.SOUTH); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java index 820f0c3358..177168cd77 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoColorPane.java @@ -4,19 +4,17 @@ package com.fr.design.mainframe.chart.gui.style; -import com.fr.base.BaseUtils; -import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; /** * Created by IntelliJ IDEA. @@ -25,34 +23,27 @@ import java.awt.*; * Date: 14-9-11 * Time: 上午11:27 */ -public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ +public class ChartTextAttrNoColorPane extends ChartTextAttrPane { - public ChartTextAttrNoColorPane() { - super(); + public ChartTextAttrNoColorPane() { + super(); } protected void initComponents() { - fontColor = new UIColorButton(); - fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(Font_Sizes); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); - double p = TableLayout.PREFERRED; double f = TableLayout.FILL; Component[] components1 = new Component[]{ - italic, bold + getItalic(), getBold() }; JPanel buttonPane = new JPanel(new BorderLayout()); - buttonPane.add(fontSizeComboBox, BorderLayout.CENTER); + buttonPane.add(getFontSizeComboBox(), BorderLayout.CENTER); buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); - double[] columnSize = {f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; @@ -62,20 +53,9 @@ public class ChartTextAttrNoColorPane extends ChartTextAttrPane{ populate(FRFont.getInstance()); } - /** - * 更新字体 - * @return 字体 - */ public FRFont updateFRFont() { - int style = Font.PLAIN; - if (bold.isSelected() && !italic.isSelected()) { - style = Font.BOLD; - } else if (!bold.isSelected() && italic.isSelected()) { - style = Font.ITALIC; - } else if (bold.isSelected() && italic.isSelected()) { - style = 3; - } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, - Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem()))); + String name = GeneralUtils.objectToString(getFontNameComboBox().getSelectedItem()); + + return FRFont.getInstance(name, updateFontStyle(), updateFontSize()); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java index e1b17eb156..d04df2f72a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrNoFontSizePane.java @@ -1,47 +1,36 @@ package com.fr.design.mainframe.chart.gui.style; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.FlowLayout; - -import javax.swing.JPanel; - -import com.fr.base.BaseUtils; -import com.fr.base.Utils; import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.FRFont; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; /** * 字体格式设置, 无字体大小设置. + * * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-1-21 下午03:35:47 */ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { - - private static final long serialVersionUID = 4890526255627852602L; - public ChartTextAttrNoFontSizePane() { - super(); - } - - protected void initComponents() { - fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontColor = new UIColorButton(); - fontSizeComboBox = new UIComboBox(Font_Sizes); - bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + private static final long serialVersionUID = 4890526255627852602L; + + public ChartTextAttrNoFontSizePane() { + super(); + } + protected void initComponents() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; Component[] components1 = new Component[]{ - fontColor, italic, bold + getFontColor(), getItalic(), getBold() }; JPanel buttonPane = new JPanel(new BorderLayout()); buttonPane.add(GUICoreUtils.createFlowPane(components1, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.CENTER); @@ -49,7 +38,7 @@ public class ChartTextAttrNoFontSizePane extends ChartTextAttrPane { double[] columnSize = {f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{fontNameComboBox}, + new Component[]{getFontNameComboBox()}, new Component[]{buttonPane} }; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java index dea30d0c97..a6be91a248 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java @@ -10,10 +10,12 @@ import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -25,25 +27,52 @@ import java.awt.Font; public class ChartTextAttrPane extends BasicPane { private static final long serialVersionUID = 6731679928019436869L; - private static final int FONT_START = 6; - private static final int FONT_END = 72; - protected UIComboBox fontNameComboBox; - protected UIComboBox fontSizeComboBox; - protected UIToggleButton bold; - protected UIToggleButton italic; - protected UIColorButton fontColor; - public static Integer[] Font_Sizes = new Integer[FONT_END-FONT_START+1]; - static{ - for(int i = FONT_START; i <= FONT_END; i++){ - Font_Sizes [i - FONT_START] = new Integer(i); + public static final int FONT_START = 6; + public static final int FONT_END = 72; + private UIComboBox fontNameComboBox; + private UIComboBox fontSizeComboBox; + private UIToggleButton bold; + private UIToggleButton italic; + private UIColorButton fontColor; + public static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1]; + static { + for (int i = FONT_START; i <= FONT_END; i++) { + FONT_SIZES[i - FONT_START] = i; } } + public ChartTextAttrPane() { + initState(); initComponents(); } + public UIComboBox getFontNameComboBox() { + return fontNameComboBox; + } + + public UIComboBox getFontSizeComboBox() { + return fontSizeComboBox; + } + + public UIToggleButton getBold() { + return bold; + } + + public UIToggleButton getItalic() { + return italic; + } + + public UIColorButton getFontColor() { + return fontColor; + } + + public void setFontColor(UIColorButton fontColor) { + this.fontColor = fontColor; + } + /** * 标题 + * * @return 标题 */ public String title4PopupWindow() { @@ -84,9 +113,7 @@ public class ChartTextAttrPane extends BasicPane { fontNameComboBox.setSelectedItem(frFont.getFamily()); bold.setSelected(frFont.isBold()); italic.setSelected(frFont.isItalic()); - if(fontSizeComboBox != null) { - fontSizeComboBox.setSelectedItem(frFont.getSize()); - } + populateFontSize(frFont); if (fontColor != null) { fontColor.setColor(frFont.getForeground()); } @@ -96,6 +123,12 @@ public class ChartTextAttrPane extends BasicPane { registerAllComboBoxListener(listener); } + protected void populateFontSize(FRFont frFont) { + if (fontSizeComboBox != null) { + fontSizeComboBox.setSelectedItem(frFont.getSize()); + } + } + private void removeAllComboBoxListener() { fontNameComboBox.removeChangeListener(); fontSizeComboBox.removeChangeListener(); @@ -108,9 +141,16 @@ public class ChartTextAttrPane extends BasicPane { /** * 更新字 + * * @return 更新字 */ public FRFont updateFRFont() { + String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem()); + + return FRFont.getInstance(name, updateFontStyle(), updateFontSize(), fontColor.getColor()); + } + + protected int updateFontStyle() { int style = Font.PLAIN; if (bold.isSelected() && !italic.isSelected()) { style = Font.BOLD; @@ -119,8 +159,12 @@ public class ChartTextAttrPane extends BasicPane { } else if (bold.isSelected() && italic.isSelected()) { style = 3; } - return FRFont.getInstance(Utils.objectToString(fontNameComboBox.getSelectedItem()), style, - Float.valueOf(Utils.objectToString(fontSizeComboBox.getSelectedItem())), fontColor.getColor()); + + return style; + } + + protected float updateFontSize() { + return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem())); } public void setEnabled(boolean enabled) { @@ -131,13 +175,23 @@ public class ChartTextAttrPane extends BasicPane { this.italic.setEnabled(enabled); } - protected void initComponents() { + protected Object[] getFontSizeComboBoxModel() { + return FONT_SIZES; + } + + protected void initState() { fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); - fontSizeComboBox = new UIComboBox(Font_Sizes); - fontColor = new UIColorButton(); + fontSizeComboBox = new UIComboBox(getFontSizeComboBoxModel()); bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + initFontColorState(); + } + protected void initFontColorState() { + setFontColor(new UIColorButton()); + } + + protected void initComponents() { Component[] components1 = new Component[]{ fontColor, italic, bold }; @@ -151,21 +205,21 @@ public class ChartTextAttrPane extends BasicPane { populate(FRFont.getInstance()); } - protected JPanel getContentPane (JPanel buttonPane) { + protected JPanel getContentPane(JPanel buttonPane) { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] columnSize = {f,e}; + double[] columnSize = {f, e}; return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize); } - protected double[] getRowSize () { + protected double[] getRowSize() { double p = TableLayout.PREFERRED; return new double[]{p, p, p}; } protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{null, null}, new Component[]{text, fontNameComboBox}, diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java new file mode 100644 index 0000000000..292d83c9e7 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithAuto.java @@ -0,0 +1,69 @@ +package com.fr.design.mainframe.chart.gui.style; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.gui.ibutton.UIColorButton; +import com.fr.design.gui.ibutton.UIColorButtonWithAuto; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.type.FontAutoType; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; + +public class ChartTextAttrPaneWithAuto extends ChartTextAttrPane { + + private static final String AUTO = Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto"); + private FontAutoType type; + public static String[] FONT_SIZES_WITH_AUTO = new String[FONT_END - FONT_START + 2]; + + static { + FONT_SIZES_WITH_AUTO[0] = AUTO; + + for (int i = 1; i < FONT_SIZES_WITH_AUTO.length; i++) { + FONT_SIZES_WITH_AUTO[i] = FONT_START + i - 1 + ""; + } + } + + public ChartTextAttrPaneWithAuto(FontAutoType type) { + this.type = type; + initState(); + initComponents(); + } + + private boolean isFontSizeAuto() { + return type == FontAutoType.SIZE || type == FontAutoType.SIZE_AND_COLOR; + } + + private boolean isFontColorAuto() { + return type == FontAutoType.COLOR || type == FontAutoType.SIZE_AND_COLOR; + } + + protected void initFontColorState() { + setFontColor(isFontColorAuto() ? new UIColorButtonWithAuto() : new UIColorButton()); + } + + protected Object[] getFontSizeComboBoxModel() { + return isFontSizeAuto() ? FONT_SIZES_WITH_AUTO : FONT_SIZES; + } + + protected float updateFontSize() { + if (isFontSizeAuto() && ComparatorUtils.equals(getFontSizeComboBox().getSelectedItem(), AUTO)) { + return ChartConstants.AUTO_FONT_SIZE; + } + + return Float.parseFloat(GeneralUtils.objectToString(getFontSizeComboBox().getSelectedItem())); + } + + protected void populateFontSize(FRFont frFont) { + if (getFontSizeComboBox() != null && isFontSizeAuto()) { + if (frFont.getSize() == ChartConstants.AUTO_FONT_SIZE) { + getFontSizeComboBox().setSelectedItem(AUTO); + } else { + getFontSizeComboBox().setSelectedItem(frFont.getSize() + ""); + } + } + + if (getFontSizeComboBox() != null && !isFontSizeAuto()) { + getFontSizeComboBox().setSelectedItem(frFont.getSize()); + } + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java index 77409e4c02..2259389fab 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java @@ -25,7 +25,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { private static final long serialVersionUID = 2595221900000305396L; private static final int GISMAP = 0; - + private UITextField keyInput; public GisMapPlotPane(){ @@ -34,7 +34,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { Component[][] components = null; styleList = createStyleList(); - + checkDemosBackground(); JPanel layoutPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(4); @@ -45,7 +45,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { tmp.setDemoGroup(styleList.toArray(new ChartSelectDemoPane[styleList.size()])); } } - + keyInput = new UITextField(); double[] columnSize = { f }; @@ -58,16 +58,16 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { new Component[]{keyInput}, }; } - + JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); this.setLayout(new BorderLayout()); this.add(panel,BorderLayout.CENTER); - + } @Override public void reLayout(String chartID){ - + //do nothing } @Override @@ -93,7 +93,8 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { return ChartConstants.GIS_CHAER; } - protected String[] getTypeLayoutPath() { + @Override + protected String[] getTypeLayoutPath() { return new String[]{"/com/fr/design/images/chart/GisMapPlot/layout/0.png", "/com/fr/design/images/chart/GisMapPlot/layout/1.png", }; @@ -110,6 +111,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { /** * 保存界面属性 */ + @Override public void updateBean(Chart chart) { if(needsResetChart(chart)){ resetChart(chart); @@ -126,14 +128,14 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { } else { plot = new GisMapPlot(); } - + try { chart.switchPlot((Plot)plot.clone()); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("Error In LineChart"); chart.switchPlot(new GisMapPlot()); } - + plot = (GisMapPlot) chart.getPlot(); boolean index = plot.isGisType(); if(styleList.get(BAIDU).isPressing){ @@ -141,7 +143,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { }else{ plot.setGisType(false); } - + if(index != plot.isGisType()){ if(plot.isGisType()){ this.keyInput.setText(plot.getBaiduKey()); @@ -161,6 +163,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { /** * 更新界面内容 */ + @Override public void populateBean(Chart chart) { GisMapPlot plot = (GisMapPlot) chart.getPlot(); @@ -168,7 +171,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { styleList.get(BAIDU).isPressing = true; styleList.get(GOOGLE).isPressing = false; keyInput.setText(plot.getBaiduKey()); - + }else{ styleList.get(GOOGLE).isPressing = true; styleList.get(BAIDU).isPressing =false; @@ -182,6 +185,7 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { * 界面标题 * @return 标题 */ + @Override public String title4PopupWindow() { return Toolkit.i18nText("Fine-Design_Chart_GIS_Map_OLD"); } @@ -195,7 +199,8 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { } - public Chart getDefaultChart() { + @Override + public Chart getDefaultChart() { return GisMapIndependentChart.gisChartTypes[0]; } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java index 9880739265..a6c78de948 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java @@ -67,6 +67,15 @@ public class MapPlotPane extends AbstractDeprecatedChartTypePane { return new String[0]; } + public void reLayout(String chartID) { + + } + + @Override + public String getPlotID() { + return ChartConstants.MAP_CHART; + } + /** * 界面标题 * @return 界面标题 diff --git a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java index 77347e0fd8..6df855cd70 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java @@ -14,6 +14,11 @@ public class UIComboBoxWithNone extends UIComboBox { return Toolkit.i18nText("Fine-Design_Chart_Use_None"); } + public UIComboBoxWithNone() { + super(); + addDefaultItem(); + } + @Override public void refreshBoxItems(List list) { super.refreshBoxItems(list); diff --git a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java index abf6ca31ce..45beccc7ef 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/area/VanChartAreaSeriesPane.java @@ -15,15 +15,15 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { private static final long serialVersionUID = 5497989595104913025L; - public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } - protected JPanel getContentInPlotType(){ + protected JPanel getContentInPlotType() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p}; + double[] row = {p, p, p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ @@ -32,6 +32,7 @@ public class VanChartAreaSeriesPane extends VanChartLineSeriesPane { new Component[]{createMarkerPane()}, new Component[]{createAreaFillColorPane()}, new Component[]{createStackedAndAxisPane()}, + //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLargeDataModelPane()}, new Component[]{createTrendLinePane()}, }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java index 0321132b32..63a8e7640c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bar/BarIndependentVanChartInterface.java @@ -1,5 +1,6 @@ package com.fr.van.chart.bar; +import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.condition.ConditionAttributesPane; @@ -10,7 +11,9 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.column.VanChartColumnConditionPane; import com.fr.van.chart.column.VanChartColumnSeriesPane; +import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; @@ -57,21 +60,37 @@ public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanCha return new VanChartBarPlotPane(); } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartColumnConditionPane(plot); } - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartColumnSeriesPane(parent, plot); } /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartBarStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(); + VanChartOtherPane otherPane = new VanChartOtherPane() { + @Override + protected BasicBeanPane createInteractivePane() { + return new VanChartInteractivePane() { + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } + }; + } + }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java index 8e732b406e..985e811ac2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/BubbleIndependentVanChartInterface.java @@ -13,9 +13,12 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.report.BubblePlotReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.van.chart.bubble.data.VanChartBubblePlotTableDataContentPane; +import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -63,22 +66,23 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh public String getIconPath() { return "com/fr/design/images/form/toolbar/bubble.png"; } + @Override - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartBubbleSeriesPane(parent, plot); } @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ - if(((VanChartBubblePlot) plot).isForceBubble()){ + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + if (((VanChartBubblePlot) plot).isForceBubble()) { return super.getTableDataSourcePane(plot, parent); } return new VanChartBubblePlotTableDataContentPane(parent); } @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ - if(((VanChartBubblePlot) plot).isForceBubble()){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + if (((VanChartBubblePlot) plot).isForceBubble()) { return super.getReportDataSourcePane(plot, parent); } return new BubblePlotReportDataContentPane(parent); @@ -86,19 +90,66 @@ public class BubbleIndependentVanChartInterface extends AbstractIndependentVanCh /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(){ + VanChartOtherPane otherPane = new VanChartOtherPane() { protected BasicBeanPane createInteractivePane() { - return new VanChartBubbleInteractivePane(); + return new VanChartInteractivePaneWithOutSort() { + + //图表缩放新设计 恢复用注释。删除下面两个方法 getNameArray getValueArray。 + protected String[] getNameArray() { + Plot plot = chart.getPlot(); + if (plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { + return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; + } + return super.getNameArray(); + } + + protected String[] getValueArray() { + Plot plot = chart.getPlot(); + if (plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { + return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; + } + return super.getValueArray(); + } + + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } + }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartBubbleConditionPane(plot); } + + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// VanChartBubblePlot plot = null; +// if (getVanChart() != null) { +// plot = getVanChart().getPlot(); +// } +// if (plot != null && plot.isForceBubble()) { +// return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); +// } +// return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); +// } +// }; +// } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java deleted file mode 100644 index 7dad3847a0..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleInteractivePane.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.fr.van.chart.bubble; - -import com.fr.chart.chartattr.Plot; - -import com.fr.plugin.chart.base.VanChartConstants; -import com.fr.plugin.chart.bubble.VanChartBubblePlot; -import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; - -/** - * Created by Mitisky on 16/3/31. - */ -public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort { - protected String[] getNameArray() { - Plot plot = chart.getPlot(); - if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; - } - return super.getNameArray(); - } - - protected String[] getValueArray() { - Plot plot = chart.getPlot(); - if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { - return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; - } - return super.getValueArray(); - } - -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java index d1f93a19e8..407c7758ba 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubblePlotPane.java @@ -6,7 +6,13 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.bubble.BubbleIndependentVanChart; @@ -33,26 +39,26 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { }; } - private void removeDefaultAttr(ConditionAttr conditionAttr, Class targetClass) { + private void removeDefaultAttr(ConditionAttr conditionAttr, Class targetClass) { DataSeriesCondition attr = conditionAttr.getExisted(targetClass); - if (attr != null){ + if (attr != null) { conditionAttr.remove(targetClass); } } - protected Plot getSelectedClonedPlot(){ + protected Plot getSelectedClonedPlot() { VanChartBubblePlot newPlot = null; Chart[] bubbleChart = BubbleIndependentVanChart.BubbleVanChartTypes; - for(int i = 0, len = bubbleChart.length; i < len; i++){ - if(typeDemo.get(i).isPressing){ - newPlot = (VanChartBubblePlot)bubbleChart[i].getPlot(); + for (int i = 0, len = bubbleChart.length; i < len; i++) { + if (typeDemo.get(i).isPressing) { + newPlot = (VanChartBubblePlot) bubbleChart[i].getPlot(); } } Plot cloned = null; try { - if(newPlot != null) { - cloned = (Plot) newPlot.clone(); - } + if (newPlot != null) { + cloned = (Plot) newPlot.clone(); + } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("Error In BubbleChart"); } @@ -64,16 +70,16 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { } @Override - /** - * 力學氣泡圖切換到其他氣泡圖時,刪除條件屬性 - * 并且将bubbleAttr属性重置 - */ - protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + /** + * 力學氣泡圖切換到其他氣泡圖時,刪除條件屬性 + * 并且将bubbleAttr属性重置 + */ + protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); } @Override - protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { if (oldPlot.getConditionCollection() != null) { ConditionCollection newCondition = new ConditionCollection(); newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); @@ -88,7 +94,7 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { removeDefaultAttr(attrList, ScatterAttrLabel.class); AttrAlpha attrAlpha = new AttrAlpha(); - attrAlpha.setAlpha(((VanChartBubblePlot)newPlot).isForceBubble() ? FORCE_ALPHA : ALPHA); + attrAlpha.setAlpha(((VanChartBubblePlot) newPlot).isForceBubble() ? FORCE_ALPHA : ALPHA); attrList.addDataSeriesCondition(attrAlpha); } @@ -96,8 +102,8 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { @Override protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { - if(oldPlot instanceof VanChartBubblePlot && newPlot instanceof VanChartBubblePlot){ - if(((VanChartBubblePlot) oldPlot).isForceBubble() == ((VanChartBubblePlot) newPlot).isForceBubble()){ + if (oldPlot instanceof VanChartBubblePlot && newPlot instanceof VanChartBubblePlot) { + if (((VanChartBubblePlot) oldPlot).isForceBubble() == ((VanChartBubblePlot) newPlot).isForceBubble()) { super.cloneHotHyperLink(oldPlot, newPlot); } } @@ -112,13 +118,33 @@ public class VanChartBubblePlotPane extends AbstractVanChartTypePane { /** * 气泡图相同图表类型之间切换的时候,chart的部分属性也需要重置 + * * @param chart */ @Override - protected void resetChartAttr4SamePlot(Chart chart){ + protected void resetChartAttr4SamePlot(Chart chart) { + //图表缩放新设计 恢复用注释。下面2行删除。 VanChartZoom vanChartZoom = new VanChartZoom(); - ((VanChart)chart).setVanChartZoom(vanChartZoom); + ((VanChart) chart).setVanChartZoom(vanChartZoom); + + //图表缩放新设计 恢复用注释。下面一行取消注释。 + //((VanChart) chart).setZoomAttribute(new ZoomAttribute()); + //重置监控刷新选项 - resetRefreshMoreLabelAttr((VanChart)chart); + resetRefreshMoreLabelAttr((VanChart) chart); + } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if (definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + boolean isForce = ((VanChartBubblePlot) vanChartPlot).isForceBubble(); + if (isForce) { + return columnFieldCollection instanceof MultiCategoryColumnFieldCollection; + } + return columnFieldCollection instanceof BubbleColumnFieldCollection; + + } + return false; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java index 01c72649d6..44077c0ba7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java @@ -6,7 +6,6 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; import com.fr.van.chart.bubble.component.VanChartBubblePane; @@ -44,7 +43,7 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null} }; - if (!((VanChartBubblePlot)plot).isForceBubble()) { + if (!((VanChartBubblePlot) plot).isForceBubble()) { components[3] = new Component[]{createLargeDataModelPane()}; } @@ -54,25 +53,25 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { //设置色彩面板内容 @Override - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { panel.add(createAlphaPane(), BorderLayout.CENTER); } @Override //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { - stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(){ + stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane() { @Override protected Class getStackAndAxisPaneClass() { return VanChartCustomAxisConditionPane.class; } @Override - public String getPaneTitle(){ + public String getPaneTitle() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Axis"); } }; - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } @@ -81,18 +80,18 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bubble"), bubblePane); } - protected void populateCondition(ConditionAttr defaultAttr){ - super.populateCondition(defaultAttr); - if(bubblePane != null) { - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + protected void populateCondition(ConditionAttr defaultAttr) { + super.populateCondition(defaultAttr); + if (bubblePane != null) { + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); bubblePane.populateBean(attrBubble); } } - protected void updateCondition(ConditionAttr defaultAttr){ + protected void updateCondition(ConditionAttr defaultAttr) { super.updateCondition(defaultAttr); - if(bubblePane != null){ - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + if (bubblePane != null) { + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); if (attrBubble != null) { defaultAttr.remove(attrBubble); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java similarity index 80% rename from designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java rename to designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java index ebecf18caa..0d491f9046 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/ColumnIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/column/VanColumnChartTypeUI.java @@ -11,7 +11,7 @@ import com.fr.van.chart.vanchart.AbstractMultiCategoryVanChartUI; /** * Created by Mitisky on 15/9/24. */ -public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { +public class VanColumnChartTypeUI extends AbstractMultiCategoryVanChartUI { @Override public String getName() { @@ -60,13 +60,4 @@ public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVan return new VanChartColumnSeriesPane(parent, plot); } -// @Override -// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new AbstractDataPane(listener) { -// @Override -// protected SingleDataPane createSingleDataPane() { -// return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); -// } -// }; -// } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java index ffb44ca326..e16151a849 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/CustomIndependentVanChartInterface.java @@ -73,6 +73,9 @@ public class CustomIndependentVanChartInterface extends AbstractIndependentVanCh } public ChartDataPane getChartDataPane(AttributeChangeListener listener){ + //图表数据结构 恢复用注释。下面1行删除。 return new VanChartCustomDataPane(listener); + //图表数据结构 恢复用注释。取消注释。 + //return new CustomChartDataPane(listener); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java index 927fa31485..5e6953746a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java @@ -6,10 +6,14 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.CustomChartDataDefinition; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.custom.CustomDefinition; @@ -24,11 +28,11 @@ import com.fr.van.chart.designer.type.AbstractVanChartTypePane; import javax.swing.JPanel; import javax.swing.JSeparator; +import java.util.HashMap; +import java.util.Map; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.HashMap; -import java.util.Map; /** * Created by Mitisky on 16/2/16. @@ -123,6 +127,7 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { //如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置 if (lastState != chart.getPlot().getDetailType()) { chart.setFilterDefinition(null); + ((VanChart) chart).setChartDataDefinition(null); } Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; @@ -137,6 +142,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { dealCustomDefinition(chart); customSelectPane.updateBean(chart); + + //更新新的数据配置 + dealCustomChartDataDefinition(chart); } else if (isSamePlot()) {//如果是同一个图表切换过来,则重置面板 customSelectPane.populateBean(chart); } @@ -150,6 +158,27 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { } + private void dealCustomChartDataDefinition(Chart chart) { + CustomChartDataDefinition chartDataDefinition = (CustomChartDataDefinition) ((VanChart) chart).getChartDataDefinition(); + + if (chartDataDefinition == null) { + return; + } + + Map customDefinitions = chartDataDefinition.getCustomDefinitions(); + + Map newCustomDefinitions = new HashMap<>(); + + VanChartCustomPlot customPlot = chart.getPlot(); + for (int i = 0; i < customPlot.getCustomPlotList().size(); i++) { + CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)); + AbstractDataDefinition definition = customDefinitions.get(plotType); + newCustomDefinitions.put(plotType, definition); + } + + chartDataDefinition.setCustomDefinitions(newCustomDefinitions); + } + private void dealCustomDefinition(Chart chart) { CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition(); @@ -229,9 +258,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { } Plot cloned = null; try { - if(newPlot != null) { - cloned = (Plot) newPlot.clone(); - } + if (newPlot != null) { + cloned = (Plot) newPlot.clone(); + } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("Error In ScatterChart"); } @@ -268,4 +297,9 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane { } } } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + return definition instanceof CustomDefinition; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java index af11a8b960..b5efad3b66 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java @@ -279,4 +279,4 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane { } -} +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index 7c46b8b085..d3e1adbb90 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -7,7 +7,6 @@ import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.style.FormatPane; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.column.VanChartColumnPlot; @@ -86,14 +85,15 @@ public class PlotFactory { autoAdjustLabelPlots.add(VanChartStructurePlot.class); } - public static boolean plotAutoAdjustLabelPosition(Plot plot){ + public static boolean plotAutoAdjustLabelPosition(Plot plot) { return autoAdjustLabelPlots.contains(plot.getClass()); } + /** - * * 标签Map */ private static Map, Class> labelMap = new HashMap, Class>(); + static { labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); @@ -104,6 +104,7 @@ public class PlotFactory { * 图例Map */ private static Map, Class> legendMap = new HashMap, Class>(); + static { legendMap.put(VanChartGaugePlot.class, VanLegendPaneWidthOutHighlight.class); legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); @@ -119,6 +120,7 @@ public class PlotFactory { * 数据点提示Map */ private static Map, Class> toolTipMap = new HashMap, Class>(); + static { toolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotTooltipPane.class); toolTipMap.put(VanChartScatterPlot.class, VanChartScatterPlotTooltipPane.class); @@ -156,18 +158,19 @@ public class PlotFactory { } - /** * 监控刷新 自动数据点提示Map */ private static Map, Class> refreshToolTipMap = new HashMap, Class>(); + static { refreshToolTipMap.put(VanChartGaugePlot.class, VanChartGaugePlotRefreshTooltipPane.class); refreshToolTipMap.put(VanChartBubblePlot.class, VanChartBubbleRefreshTooltipPane.class); } + private static Map, Class> refreshTooltipContentMap = new HashMap, Class>(); static { @@ -186,18 +189,19 @@ public class PlotFactory { /** * 根据图表类型创建标签界面 - * @param plot 图表 + * + * @param plot 图表 * @param stylePane 样式界面 * @return 标签界面 */ public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane) { Class key = plot.getClass(); - if(labelMap.containsKey(key)){ - try{ + if (labelMap.containsKey(key)) { + try { Class cl = labelMap.get(key); - Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); return constructor.newInstance(plot, stylePane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -206,18 +210,19 @@ public class PlotFactory { /** * 根据图表类型创建图例界面 - * @param plot 图表 + * + * @param plot 图表 * @param stylePane 样式界面 * @return 图例界面 */ public static VanChartPlotLegendPane createPlotLegendPane(Plot plot, VanChartStylePane stylePane) { Class key = plot.getClass(); - if(legendMap.containsKey(key)){ - try{ + if (legendMap.containsKey(key)) { + try { Class cl = legendMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class); return constructor.newInstance(stylePane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -226,18 +231,19 @@ public class PlotFactory { /** * 根据图表类型创建数据点提示界面 - * @param plot 图表 + * + * @param plot 图表 * @param stylePane 样式界面 * @return 数据点提示界面 */ - public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { + public static VanChartPlotTooltipPane createPlotTooltipPane(Plot plot, VanChartStylePane stylePane) { Class key = plot.getClass(); - if(toolTipMap.containsKey(key)){ - try{ + if (toolTipMap.containsKey(key)) { + try { Class cl = toolTipMap.get(key); - Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class); return constructor.newInstance(plot, stylePane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -246,19 +252,20 @@ public class PlotFactory { /** * 根据图表类型创建标签的具体内容界面.分类名系列名等 - * @param plot 图表 - * @param parent 样式界面 + * + * @param plot 图表 + * @param parent 样式界面 * @param showOnPane formatpane用到 * @return 标签的具体内容界面 */ - public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + public static VanChartTooltipContentPane createPlotLabelContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane) { Class key = plot.getClass(); - if(labelContentMap.containsKey(key)){ - try{ + if (labelContentMap.containsKey(key)) { + try { Class cl = labelContentMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); return constructor.newInstance(parent, showOnPane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -267,19 +274,20 @@ public class PlotFactory { /** * 根据图表类型创建数据点提示的具体内容界面.分类名系列名等 - * @param plot 图表 - * @param parent 样式界面 + * + * @param plot 图表 + * @param parent 样式界面 * @param showOnPane formatpane用到 * @return 数据点提示的具体内容界面 */ - public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + public static VanChartTooltipContentPane createPlotTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane) { Class key = plot.getClass(); - if(tooltipContentMap.containsKey(key)){ - try{ + if (tooltipContentMap.containsKey(key)) { + try { Class cl = tooltipContentMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); return constructor.newInstance(parent, showOnPane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -287,56 +295,59 @@ public class PlotFactory { } - /** * 根据图表类型创建数据点提示界面 + * * @param plot 图表 * @return 数据点提示界面 */ public static VanChartPlotTooltipPane createPlotRefreshTooltipPane(Plot plot) { Class key = plot.getClass(); - if(refreshToolTipMap.containsKey(key)){ - try{ + if (refreshToolTipMap.containsKey(key)) { + try { Class cl = refreshToolTipMap.get(key); - Constructor constructor = cl.getConstructor(Plot.class); + Constructor constructor = cl.getConstructor(Plot.class); return constructor.newInstance(plot); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return new VanChartPlotRefreshTooltipPane(plot); } + /** * 根据图表类型创建监控刷新中数据点提示的具体内容界面.分类名系列名等 - * @param plot 图表 - * @param parent 交互属性界面 + * + * @param plot 图表 + * @param parent 交互属性界面 * @param showOnPane formatpane用到 * @return 数据点提示的具体内容界面 */ - public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane){ + public static VanChartTooltipContentPane createPlotRefreshTooltipContentPane(Plot plot, VanChartStylePane parent, JPanel showOnPane) { Class key = plot.getClass(); - if(refreshTooltipContentMap.containsKey(key)){ - try{ + if (refreshTooltipContentMap.containsKey(key)) { + try { Class cl = refreshTooltipContentMap.get(key); - Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); + Constructor constructor = cl.getConstructor(VanChartStylePane.class, JPanel.class); return constructor.newInstance(parent, showOnPane); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } return new VanChartRefreshTooltipContentPane(parent, showOnPane); } - public static FormatPane createAutoFormatPane(){ - FormatPane formatPane = new FormatPane(){ - protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { + public static FormatPane createAutoFormatPane() { + FormatPane formatPane = new FormatPane() { + protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { typePane.setBorder(BorderFactory.createEmptyBorder()); return new Component[][]{ - new Component[]{typePane,null}, + new Component[]{typePane, null}, new Component[]{centerPane, null}, }; } - protected UIComboBoxRenderer createComBoxRender(){ + + protected UIComboBoxRenderer createComBoxRender() { return new UIComboBoxRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -358,14 +369,18 @@ public class PlotFactory { return formatPane; } - /** - * 判断是否为大数据模式 - */ - public static boolean largeDataModel(Plot plot){ + + //大数据模式 恢复用注释。取消注释。 +// public static boolean largeDataModel(Plot plot) { +// return plot != null && plot.convertDataProcessor().getMark() == LargeDataModel.MARK; +// } + + //大数据模式 恢复用注释。删除下面2个方法 largeDataModel lineMapLargeModel。 + public static boolean largeDataModel(Plot plot) { return plot != null && plot.getDataProcessor().getMark() == LargeDataModel.MARK; } - public static boolean lineMapLargeModel(Plot plot){ + public static boolean lineMapLargeModel(Plot plot) { return plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getLineMapDataProcessor().getMark() == LargeDataModel.MARK; } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java new file mode 100644 index 0000000000..0b3bc7571a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java @@ -0,0 +1,85 @@ +package com.fr.van.chart.designer.component; + +import com.fr.base.FRContext; +import com.fr.base.GraphHelper; +import com.fr.base.ScreenResolution; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.i18n.Toolkit; +import com.fr.general.FRFont; +import com.fr.plugin.chart.type.LineType; +import com.fr.stable.Constants; + +import javax.swing.JLabel; +import javax.swing.JList; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; + +/** + * Created by shine on 2019/08/30. + */ +public class LineTypeComboBox extends UIComboBox { + + public LineTypeComboBox(LineType[] lineType) { + super(lineType); + + this.setRenderer(new CellRenderer()); + } + + private static class CellRenderer extends UIComboBoxRenderer { + + private LineType lineType; + + public Component getListCellRendererComponent( + JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + + JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + this.lineType = (LineType) value; + comp.setText(null); + return comp; + } + + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + Dimension d = getSize(); + g2d.setColor(getForeground()); + + switch (this.lineType) { + case NONE: + FRFont font = FRContext.getDefaultValues().getFRFont(); + int resolution = ScreenResolution.getScreenResolution(); + Font rfont = font.applyResolutionNP(resolution); + g2d.setFont(rfont); + FontMetrics fm = GraphHelper.getFontMetrics(rfont); + GraphHelper.drawString(g2d, Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent()); + break; + case NORMAL: + GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2); + break; + case DASH: + GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, Constants.LINE_DASH); + break; + default: + break; + + } + } + + public Dimension getPreferredSize() { + return new Dimension(60, 16); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + } + + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java index 78f93162f8..f5adcf26d1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineTypePane.java @@ -4,12 +4,15 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; - import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.type.LineStyle; +import com.fr.plugin.chart.type.LineType; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -17,6 +20,9 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; /** * line相关设置 @@ -24,64 +30,143 @@ import java.awt.Component; public class VanChartLineTypePane extends BasicPane { private static final long serialVersionUID = -6581862503009962973L; + //线型支持虚线 恢复用注释。下面1行删除。 protected LineComboBox lineWidth;//线型 + + private LineTypeComboBox lineTypeComboBox;//线型 + private UISpinner lineWidthSpinner;//线宽 protected UIButtonGroup lineStyle;//形态 - protected UIButtonGroup nullValueBreak;//空值断开 + private UIButtonGroup nullValueBreak;//空值断开 + + private JPanel lineWidthPane; + private JPanel lineStylePane; public VanChartLineTypePane() { + //线型支持虚线 恢复用注释。下面1行删除。 lineWidth = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); + JPanel typeAndWidthPane = createTypeAndWidthPane(); + createLineStyle(); - nullValueBreak = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); + nullValueBreak = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); - this.setLayout(new BorderLayout()); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - this.add(createContentPane(p, f), BorderLayout.CENTER); + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + Component[] lineStyleComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle}, + nullValueBreakComponent = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak}; + + Component[][] components = createContentComponent(lineStyleComponent, nullValueBreakComponent); + + double[] row = new double[components.length]; + Arrays.fill(row, p); + double[] col = {f, e}; + + lineStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + + this.setLayout(new BorderLayout(0, 6)); + //线型支持虚线 恢复用注释。取消注释。 + //this.add(typeAndWidthPane, BorderLayout.NORTH); + this.add(lineStylePane, BorderLayout.CENTER); + } + + private JPanel createTypeAndWidthPane() { + + lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); + + lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); + + lineTypeComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkLineWidth(); + checkLineStyle(); + } + }); + + Component[][] lineTypeComps = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineTypeComboBox} + }; + Component[][] lineWidthComps = new Component[][]{ + new Component[]{ + FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), + UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)} + }; + + double p = TableLayout.PREFERRED, f = TableLayout.FILL, e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = {p}, col = {f, e}; + + JPanel lineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(lineTypeComps, row, col); + lineWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(lineWidthComps, row, col); + + JPanel contentPane = new JPanel(new BorderLayout(0, 6)); + + contentPane.add(lineTypePane, BorderLayout.CENTER); + contentPane.add(lineWidthPane, BorderLayout.SOUTH); + + return contentPane; } protected void createLineStyle() { - String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_StepLine"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; + String[] textArray = new String[]{Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), + Toolkit.i18nText("Fine-Design_Chart_StepLine"), Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; lineStyle = new UIButtonGroup(textArray, LineStyle.values()); } - protected JPanel createContentPane(double p, double f) { - double[] row = {p, p, p, p}; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = {f, e}; - - Component[][] components = new Component[][]{ - new Component[]{null,null}, + protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + return new Component[][]{ + //线型支持虚线 恢复用注释。下面5行删除。 + new Component[]{null, null}, new Component[]{ - FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), + FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), UIComponentUtils.wrapWithBorderLayoutPane(lineWidth) }, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")),lineStyle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")),nullValueBreak}, + lineStyleComponent, + nullValueBreakComponent }; + } - return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + private void checkLineWidth() { + if (lineWidthPane != null && lineTypeComboBox != null) { + lineWidthPane.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(), LineType.NONE)); + } + } + + private void checkLineStyle() { + if (lineStylePane != null && lineTypeComboBox != null) { + lineStylePane.setVisible(!ComparatorUtils.equals(lineTypeComboBox.getSelectedItem(),LineType.NONE)); + } } - public void checkLarge(boolean large){ - if(large){ + public void checkLarge(boolean large) { + //线型支持虚线 恢复用注释。下面4行删除。 + if (large) { lineWidth.setSelectedLineStyle(Constants.LINE_NONE); } lineWidth.setEnabled(!large); + //线型支持虚线 恢复用注释。取消注释。 +// if (large) { +// lineTypeComboBox.setSelectedItem(LineType.NONE); +// } +// lineTypeComboBox.setEnabled(!large); lineStyle.setEnabled(!large); } protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line"); + return Toolkit.i18nText("Fine-Design_Chart_Line"); } public void populate(VanChartAttrLine line) { if (line == null) { line = initVanChartAttrLine(); } + //线型支持虚线 恢复用注释。下面1行删除。 lineWidth.setSelectedLineStyle(line.getLineWidth()); + //线型支持虚线 恢复用注释。取消注释。 +// lineTypeComboBox.setSelectedItem(line.getLineType()); +// lineWidthSpinner.setValue(line.getLineWidth()); lineStyle.setSelectedItem(line.getLineStyle()); nullValueBreak.setSelectedIndex(line.isNullValueBreak() ? 0 : 1); } @@ -92,7 +177,11 @@ public class VanChartLineTypePane extends BasicPane { public VanChartAttrLine update() { VanChartAttrLine line = new VanChartAttrLine(); + //线型支持虚线 恢复用注释。下面1行删除。 line.setLineWidth(lineWidth.getSelectedLineStyle()); + //线型支持虚线 恢复用注释。取消注释。 +// line.setLineType((LineType) lineTypeComboBox.getSelectedItem()); +// line.setLineWidth(lineWidthSpinner.getValue()); line.setLineStyle(lineStyle.getSelectedItem()); line.setNullValueBreak(nullValueBreak.getSelectedIndex() == 0); return line; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java index 72ee1666ae..ed06b3d4db 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLineWidthPane.java @@ -1,30 +1,23 @@ package com.fr.van.chart.designer.component; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.i18n.Toolkit; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; - -import javax.swing.JPanel; import java.awt.Component; /** - * 线-线型 + * 线型+线宽+空值断开 */ public class VanChartLineWidthPane extends VanChartLineTypePane { private static final long serialVersionUID = 4537158946119294689L; - protected JPanel createContentPane(double p, double f) { - double[] row = {p, p, p}; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = {f, e}; - - Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break")), nullValueBreak}, + @Override + protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + return new Component[][]{ + //线型支持虚线 恢复用注释。下面2行删除。 + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, + nullValueBreakComponent }; - - return TableLayoutHelper.createTableLayoutPane(components, row, col); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java index 134598bd71..de01ab612c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java @@ -9,21 +9,24 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorSelectBox; - import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.base.TrendLineType; import com.fr.plugin.chart.base.VanChartAttrTrendLine; import com.fr.plugin.chart.base.VanChartConstants; +import com.fr.plugin.chart.type.LineType; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; /** * Created by Mitisky on 15/10/19. @@ -33,62 +36,118 @@ public class VanChartTrendLinePane extends BasicPane{ private UITextField trendLineName; private ColorSelectBox trendLineColor; + + //线型支持虚线 恢复用注释。下面1行删除。 private LineComboBox trendLineStyle;//线型 + //线型支持虚线 恢复用注释。取消注释。 +// private LineTypeComboBox trendLineStyle;//线型 +// private UISpinner lineWidthSpinner;//线宽 private UIComboBox trendLineType;//趋势线函数类型 private UISpinner prePeriod; private UISpinner afterPeriod; + private JPanel trendLineHidePane; + public VanChartTrendLinePane() { - this.setLayout(new BorderLayout()); + initComponents(); + } + + private void initComponents(){ + this.setLayout(new BorderLayout(0,6)); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p}; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = {p, p, p, p, p, p}; double[] col = {f, e}; trendLineName = new UITextField(); trendLineColor = new ColorSelectBox(100); + //线型支持虚线 恢复用注释。下面1行删除。 trendLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE); - + //线型支持虚线 恢复用注释。取消注释。 +// trendLineStyle = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); +// lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); trendLineType = new UIComboBox(TYPES); prePeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0); afterPeriod = new UISpinner(0, Integer.MAX_VALUE, 1, 0); + double[] r = {p, p}; double[] c = {f, p, f, p}; Component[][] periodComps = new Component[][]{ - new Component[]{prePeriod, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cycle")), afterPeriod, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cycle"))}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine_Forward")), null, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_After_Period")), null}, + new Component[]{prePeriod, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Cycle")), afterPeriod, new UILabel(Toolkit.i18nText("Fine-Design_Chart_Cycle"))}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_TrendLine_Forward")), null, new UILabel(Toolkit.i18nText("Fine-Design_Chart_After_Period")), null}, }; JPanel periodPane = TableLayoutHelper.createTableLayoutPane(periodComps, r, c); - UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Period")); + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Period")); label.setVerticalAlignment(SwingConstants.TOP); + //线型支持虚线 恢复用注释。开始删除。 Component[][] components = new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName}, new Component[]{ - FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), - UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle) + FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), + UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle) }, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType}, new Component[]{label, periodPane} }; + //线型支持虚线 恢复用注释。结束删除。 + + //线型支持虚线 恢复用注释。取消注释。 +// Component[][] components = new Component[][]{ +// new Component[]{null, null}, +// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Name")), trendLineName}, +// new Component[]{ +// FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), +// UIComponentUtils.wrapWithBorderLayoutPane(trendLineStyle) +// } +// }; +// +// Component[][] componentsMayHide = new Component[][]{ +// new Component[]{ +// FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), +// UIComponentUtils.wrapWithBorderLayoutPane(lineWidthSpinner)}, +// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), trendLineColor}, +// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Type")), trendLineType}, +// new Component[]{label, periodPane} +// }; +// trendLineHidePane = TableLayout4VanChartHelper.createGapTableLayoutPane(componentsMayHide, row, col); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + + trendLineStyle.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkHidePaneVisible(); + } + }); + + checkHidePaneVisible(); + this.add(panel, BorderLayout.CENTER); + //线型支持虚线 恢复用注释。取消注释。 + //this.add(trendLineHidePane, BorderLayout.SOUTH); } + protected String title4PopupWindow(){ - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine"); + return Toolkit.i18nText("Fine-Design_Chart_TrendLine"); } public void populate(VanChartAttrTrendLine trendLine) { + checkHidePaneVisible(); if(trendLine != null){ trendLineName.setText(trendLine.getTrendLineName()); LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); trendLineColor.setSelectObject(lineStyleInfo.getAttrLineColor().getSeriesColor()); + //线型支持虚线 恢复用注释。下面1行删除。 trendLineStyle.setSelectedLineStyle(lineStyleInfo.getAttrLineStyle().getLineStyle()); + //线型支持虚线 恢复用注释。取消注释。 +// trendLineStyle.setSelectedItem(lineStyleInfo.getAttrLineStyle().getLineType()); +// lineWidthSpinner.setValue(lineStyleInfo.getAttrLineStyle().getLineWidth()); trendLineType.setSelectedItem(trendLine.getTrendLineType()); prePeriod.setValue(trendLine.getPrePeriod()); afterPeriod.setValue(trendLine.getAfterPeriod()); @@ -100,7 +159,11 @@ public class VanChartTrendLinePane extends BasicPane{ trendLine.setTrendLineName(trendLineName.getText()); LineStyleInfo lineStyleInfo = trendLine.getLineStyleInfo(); + //线型支持虚线 恢复用注释。下面1行删除。 lineStyleInfo.setAttrLineStyle(new AttrLineStyle(trendLineStyle.getSelectedLineStyle())); + //线型支持虚线 恢复用注释。取消注释。 +// lineStyleInfo.getAttrLineStyle().setLineWidth(lineWidthSpinner.getValue()); +// lineStyleInfo.getAttrLineStyle().setLineType((LineType) trendLineStyle.getSelectedItem()); lineStyleInfo.setAttrLineColor(new AttrColor(trendLineColor.getSelectObject())); trendLine.setTrendLineType((TrendLineType) trendLineType.getSelectedItem()); @@ -110,4 +173,10 @@ public class VanChartTrendLinePane extends BasicPane{ return trendLine; } + private void checkHidePaneVisible(){ + if (trendLineHidePane != null && trendLineStyle != null){ + trendLineHidePane.setVisible(trendLineStyle.getSelectedItem() != LineType.NONE); + } + } + } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 664b3d8cf6..f25cbe9923 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -4,28 +4,38 @@ import com.fr.base.BaseFormula; import com.fr.base.Utils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.attr.LargeDataModeType; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.axis.type.AxisPlotType; +import com.fr.plugin.chart.base.AttrEffect; +import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.RefreshMoreLabel; +import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartZoom; +import com.fr.plugin.chart.map.line.condition.AttrLineEffect; +import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.StableUtils; import com.fr.van.chart.custom.component.VanChartHyperLinkPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.other.zoom.ZoomPane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -46,6 +56,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected UICheckBox fullScreenDisplay; protected UIToggleButton collapse; + protected VanChart chart; + private UIComboBox largeDataMode; + private UISpinner largeModeThresholdNumber; + protected UIButtonGroup isChartAnimation; //坐标轴翻转属性 @@ -53,6 +67,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private AutoRefreshPane autoRefreshPane; + //图表缩放新设计 恢复用注释。删除下面八行代码。 private UIButtonGroup zoomWidget; protected UIButtonGroup zoomGesture;//地图手势缩放 private UIButtonGroup zoomResize; @@ -62,13 +77,16 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private JPanel changeEnablePane; private JPanel zoomTypePane; - protected VanChartHyperLinkPane superLink; + //图表缩放新设计 恢复用注释。取消注释。 + //private ZoomPane zoomPane; - protected Chart chart; + protected VanChartHyperLinkPane superLink; + private JPanel largeModeThresholdNumberPane; protected JPanel interactivePane; /** * 界面标题. + * * @return 返回标题. */ @@ -82,7 +100,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return new JPanel(); } - private void reLayoutContentPane(VanChartPlot plot){ + private void reLayoutContentPane(VanChartPlot plot) { if (interactivePane != null) { interactivePane.removeAll(); } @@ -90,27 +108,75 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { reloaPane(interactivePane); } - protected JPanel getInteractivePane(VanChartPlot plot){ + protected JPanel getInteractivePane(VanChartPlot plot) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p,p,p,p,p,p}; + double[] rowSize = {p, p, p, p, p, p, p}; Component[][] components = new Component[][]{ - new Component[]{createToolBarPane(getToolBarRowSize(), columnSize),null}, - new Component[]{createAnimationPane(),null}, - new Component[]{createAxisRotationPane(new double[]{p,p}, columnSize, plot),null}, - new Component[]{createZoomPane(new double[]{p,p,p}, columnSize, plot),null}, - new Component[]{createAutoRefreshPane(plot),null}, - new Component[]{createHyperlinkPane(),null} + new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, + //大数据模式 恢复用注释。取消注释。 + //new Component[]{createLargeDataModePane(), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createAutoRefreshPane(plot), null}, + new Component[]{createHyperlinkPane(), null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + //大数据模式 恢复用注释。取消注释。 +// private JPanel createLargeDataModePane() { +// if (!isCurrentChartSupportLargeDataMode()) { +// return null; +// } +// largeDataMode = new UIComboBox(new LargeDataModeType[]{LargeDataModeType.CLOSE, LargeDataModeType.OPEN_BEYOND_THRESHOLD}); +// largeModeThresholdNumber = new UISpinner(0, Integer.MAX_VALUE, 100, chart.getPlot().getLargeDataAttribute().getLargeModeThresholdNumber()); +// +// largeDataMode.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// checkLargeDataMode(); +// } +// }); +// +// Component[][] comps1 = new Component[][]{ +// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Large_Model")), largeDataMode} +// }; +// Component[][] comps2 = new Component[][]{ +// new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Threshold_Number")), largeModeThresholdNumber} +// }; +// +// double[] row = {TableLayout.PREFERRED}, col = {TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; +// +// +// JPanel contentPane = new JPanel(new BorderLayout(0, 6)); +// +// contentPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(comps1, row, col), BorderLayout.CENTER); +// largeModeThresholdNumberPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps2, row, col); +// contentPane.add(largeModeThresholdNumberPane, BorderLayout.SOUTH); +// +// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Large_Data"), contentPane); +// } + + protected boolean isCurrentChartSupportLargeDataMode() { + return false; + } + protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { + //图表缩放新设计 恢复用注释。取消注释。 +// zoomPane = createZoomPane(); +// if (zoomPane == null) { +// return null; +// } +// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), zoomPane); + + //图表缩放新设计 恢复用注释。删除下面方法体所有代码。 if (!plot.isSupportZoomDirection()) { return null; } @@ -134,7 +200,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double[] columnSize = {f, e}; changeEnablePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, columnSize); - changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10,12,0,0)); + changeEnablePane.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 0)); zoomTypePane = getzoomTypePane(zoomType); JPanel panel = createZoomPaneContent(zoomWidgetPane, zoomGesturePane, changeEnablePane, zoomTypePane, plot); zoomWidget.addActionListener(new ActionListener() { @@ -146,7 +212,8 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Zoom"), panel); } - + //图表缩放新设计 恢复用注释。删除下面八个方法getzoomTypePane createZoomPaneContent + // checkZoomEnabled getNameArray getValueArray checkZoomPane populateChartZoom updateChartZoom。 protected JPanel getzoomTypePane(UIButtonGroup zoomType) { return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Direction"), zoomType); } @@ -161,26 +228,6 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return panel; } - private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot){ - if (!(plot.getAxisPlotType() == AxisPlotType.RECTANGLE)){ - return null; - } - axisRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); - axisRotation.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkZoomEnabled(); - } - }); - Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")),axisRotation} - }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"), panel); - } - private void checkZoomEnabled() { if (zoomWidget != null && axisRotation != null) { if (axisRotation.getSelectedIndex() == 0) { @@ -195,16 +242,99 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected String[] getNameArray() { return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_X_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Y_Axis") - ,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; + , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; } protected String[] getValueArray() { return new String[]{VanChartConstants.ZOOM_TYPE_X, VanChartConstants.ZOOM_TYPE_Y - ,VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; + , VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; } - protected JPanel createToolBarPane(double[] row, double[] col){ + private void checkZoomPane() { + boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; + changeEnablePane.setVisible(zoomWidgetEnabled); + zoomType.setEnabled(!zoomWidgetEnabled); + } + + private void populateChartZoom(VanChart chart) { + VanChartZoom zoom = chart.getVanChartZoom(); + if (zoom == null) { + zoom = new VanChartZoom(); + } + zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); + zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); + zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); + if (zoom.getFrom() instanceof BaseFormula) { + from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); + } else { + from.populateBean(Utils.objectToString(zoom.getFrom())); + } + if (zoom.getTo() instanceof BaseFormula) { + to.populateBean(((BaseFormula) zoom.getTo()).getContent()); + } else { + to.populateBean(Utils.objectToString(zoom.getTo())); + } + zoomType.setSelectedItem(zoom.getZoomType()); + } + + private void updateChartZoom(VanChart chart) { + VanChartZoom zoom = chart.getVanChartZoom(); + if (zoom == null) { + zoom = new VanChartZoom(); + chart.setVanChartZoom(zoom); + } + zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); + zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); + zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); + String fromString = from.updateBean(); + Object fromObject; + if (StableUtils.maybeFormula(fromString)) { + fromObject = BaseFormula.createFormulaBuilder().build(fromString); + } else { + fromObject = fromString; + } + zoom.setFrom(fromObject); + String toString = to.updateBean(); + Object toObject; + if (StableUtils.maybeFormula(toString)) { + toObject = BaseFormula.createFormulaBuilder().build(toString); + } else { + toObject = toString; + } + zoom.setTo(toObject); + zoom.setZoomType(zoomType.getSelectedItem()); + } + + protected ZoomPane createZoomPane() { + return null; + } + + private JPanel createAxisRotationPane(double[] row, double[] col, VanChartPlot plot) { + if (!(plot.getAxisPlotType() == AxisPlotType.RECTANGLE)) { + return null; + } + axisRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); + + //图表缩放新设计 恢复用注释。删除下面六行代码。 + axisRotation.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkZoomEnabled(); + } + }); + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Reversal")), axisRotation} + }; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis"), panel); + } + + + protected JPanel createToolBarPane(double[] row, double[] col) { isSort = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sort")); exportImages = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Export_Image")); fullScreenDisplay = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_FullScreen_Display")); @@ -216,17 +346,17 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ToolBar"), panel); } - protected double[] getToolBarRowSize () { + protected double[] getToolBarRowSize() { double p = TableLayout.PREFERRED; - return new double[]{p,p,p,p,p}; + return new double[]{p, p, p, p, p}; } protected Component[][] createToolBarComponents() { return new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")),isSort}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), isSort}, new Component[]{null, exportImages}, new Component[]{null, fullScreenDisplay}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),collapse}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse}, }; } @@ -234,18 +364,18 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return new Component[][]{ new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), exportImages}, new Component[]{null, fullScreenDisplay}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")),collapse} + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout")), collapse} }; } - protected JPanel createAnimationPane(){ + protected JPanel createAnimationPane() { isChartAnimation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation_Effects"), isChartAnimation); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), panel); } - protected JPanel createAutoRefreshPane(VanChartPlot plot){ + protected JPanel createAutoRefreshPane(VanChartPlot plot) { autoRefreshPane = getMoreLabelPane(plot); @@ -254,7 +384,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { boolean isLargeModel = largeModel(plot); - return new AutoRefreshPane((VanChart) chart, isLargeModel); + return new AutoRefreshPane(chart, isLargeModel); } protected JPanel createHyperlinkPane() { @@ -262,11 +392,42 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), superLink); } + private void checkLargeDataMode() { + largeModeThresholdNumberPane.setVisible(largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD); - private void checkZoomPane() { - boolean zoomWidgetEnabled = zoomWidget.getSelectedIndex() == 0; - changeEnablePane.setVisible(zoomWidgetEnabled); - zoomType.setEnabled(!zoomWidgetEnabled); + resetAttr(); + } + + private void resetAttr() { + if (largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD) { + VanChartPlot plot = this.chart.getPlot(); + + AttrLabel attrLabel = plot.getAttrLabelFromConditionCollection(); + if (attrLabel == null) { + attrLabel = plot.getDefaultAttrLabel(); + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + defaultAttr.addDataSeriesCondition(attrLabel); + } + attrLabel.setEnable(false); + + resetCustomCondition(plot.getConditionCollection()); + } + } + + + public static void resetCustomCondition(ConditionCollection conditionCollection) { + for (int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++) { + ConditionAttr conditionAttr = conditionCollection.getConditionAttr(i); + conditionAttr.remove(AttrLabel.class); + conditionAttr.remove(ScatterAttrLabel.class); + conditionAttr.remove(AttrEffect.class); + conditionAttr.remove(AttrLineEffect.class); + + VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); + if (attrMarker != null && !attrMarker.isCommon()) { + conditionAttr.remove(VanChartAttrMarker.class); + } + } } @Override @@ -274,28 +435,37 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { if (chart == null || chart.getPlot() == null) { return; } - this.chart = chart; - VanChartPlot plot = (VanChartPlot)chart.getPlot(); + this.chart = (VanChart) chart; + VanChartPlot plot = chart.getPlot(); - if(interactivePane == null){ + if (interactivePane == null) { this.remove(leftcontentPane); reLayoutContentPane(plot); } - if(plot.isSupportZoomDirection()){//支持缩放方向=方向+控件 - populateChartZoom((VanChart)chart); + + //图表缩放新设计 恢复用注释。下面3行取消注释。 +// if (zoomPane != null) { +// zoomPane.populateBean(this.chart.getZoomAttribute()); +// } + + //图表缩放新设计 恢复用注释。删除下面三行代码。 + if (plot.isSupportZoomDirection()) {//支持缩放方向=方向+控件 + populateChartZoom((VanChart) chart); checkZoomPane(); } - if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ + if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { populateChartAxisRotation(plot); } - populateChartTools((VanChart) chart); - populateChartAnimate(chart, plot); - populateAutoRefresh((VanChart)chart); + populateChartTools(this.chart); + populateLargeMode(plot); + populateChartAnimate(this.chart, plot); + populateAutoRefresh(this.chart); populateHyperlink(plot); + //图表缩放新设计 恢复用注释。删除下面一行代码。 checkZoomEnabled(); } @@ -312,25 +482,14 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { collapse.setSelected(vanChartTools.isHidden()); } - private void populateChartZoom(VanChart chart) { - VanChartZoom zoom = chart.getVanChartZoom(); - if(zoom == null){ - zoom = new VanChartZoom(); - } - zoomWidget.setSelectedIndex(zoom.isZoomVisible() ? 0 : 1); - zoomGesture.setSelectedIndex(zoom.isZoomGesture() ? 0 : 1); - zoomResize.setSelectedIndex(zoom.isZoomResize() ? 0 : 1); - if (zoom.getFrom() instanceof BaseFormula) { - from.populateBean(((BaseFormula) zoom.getFrom()).getContent()); - } else { - from.populateBean(Utils.objectToString(zoom.getFrom())); - } - if (zoom.getTo() instanceof BaseFormula) { - to.populateBean(((BaseFormula) zoom.getTo()).getContent()); - } else { - to.populateBean(Utils.objectToString(zoom.getTo())); - } - zoomType.setSelectedItem(zoom.getZoomType()); + private void populateLargeMode(Plot plot) { + //大数据模式 恢复用注释。取消注释。 +// if (largeDataMode != null) { +// LargeDataAttribute attribute = plot.getLargeDataAttribute(); +// +// largeDataMode.setSelectedItem(attribute.getLargeDataModeType()); +// largeModeThresholdNumber.setValue(attribute.getLargeModeThresholdNumber()); +// } } private void populateChartAxisRotation(VanChartPlot plot) { @@ -338,7 +497,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } private void populateChartAnimate(Chart chart, Plot plot) { - if(plot.isSupportAnimate()) { + if (plot.isSupportAnimate()) { isChartAnimation.setSelectedIndex(chart.isJSDraw() ? 0 : 1); isChartAnimation.setEnabled(!largeModel(plot)); } @@ -349,11 +508,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected void populateAutoRefresh(VanChart chart) { - VanChartPlot plot = (VanChartPlot)chart.getPlot(); + VanChartPlot plot = chart.getPlot(); RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); - if(refreshMoreLabel == null) { - refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot)chart.getPlot()).getAutoAttrTooltip()); + if (refreshMoreLabel == null) { + refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot) chart.getPlot()).getAutoAttrTooltip()); } autoRefreshPane.populateBean(refreshMoreLabel); @@ -366,21 +525,29 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { return; } - VanChartPlot plot = (VanChartPlot)chart.getPlot(); + VanChart vanChart = (VanChart) chart; + VanChartPlot plot = chart.getPlot(); - if(plot.isSupportZoomDirection()){ - updateChartZoom((VanChart)chart); + //图表缩放新设计 恢复用注释。下面3行取消注释。 +// if (zoomPane != null) { +// vanChart.setZoomAttribute(zoomPane.updateBean()); +// } + //图表缩放新设计 恢复用注释。下面3行删除。 + if (plot.isSupportZoomDirection()) { + updateChartZoom((VanChart) chart); } - if(plot.getAxisPlotType() == AxisPlotType.RECTANGLE){ - updateChartAxisRotation((VanChart)chart); + + if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { + updateChartAxisRotation(vanChart); } - updateChartTools((VanChart)chart); - updateChartAnimate(chart, plot); - updateAutoRefresh((VanChart)chart); + updateChartTools(vanChart); + updateChartAnimate(vanChart, plot); + updateLargeData(plot); + updateAutoRefresh(vanChart); updateHyperlink(plot); } - protected void updateHyperlink(Plot plot){ + protected void updateHyperlink(Plot plot) { superLink.update(plot); } @@ -393,37 +560,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { chart.setVanChartTools(vanChartTools); } - private void updateChartZoom(VanChart chart) { - VanChartZoom zoom = chart.getVanChartZoom(); - if(zoom == null){ - zoom = new VanChartZoom(); - chart.setVanChartZoom(zoom); - } - zoom.setZoomVisible(zoomWidget.getSelectedIndex() == 0); - zoom.setZoomGesture(zoomGesture.getSelectedIndex() == 0); - zoom.setZoomResize(zoomResize.getSelectedIndex() == 0); - String fromString = from.updateBean(); - Object fromObject; - if (StableUtils.maybeFormula(fromString)) { - fromObject = BaseFormula.createFormulaBuilder().build(fromString); - } else { - fromObject = fromString; - } - zoom.setFrom(fromObject); - String toString = to.updateBean(); - Object toObject; - if (StableUtils.maybeFormula(toString)) { - toObject = BaseFormula.createFormulaBuilder().build(toString); - } else { - toObject = toString; - } - zoom.setTo(toObject); - zoom.setZoomType(zoomType.getSelectedItem()); - } - private void updateChartAxisRotation(VanChart chart) { //坐标轴和plot都需要这个属性,因为坐标轴和plot是分开画的 - VanChartPlot plot = (VanChartPlot) chart.getPlot(); + VanChartPlot plot = chart.getPlot(); plot.setAxisRotation(axisRotation.getSelectedIndex() == 0); //同时更新坐标轴旋转属性 for (VanChartAxis axis : ((VanChartRectanglePlot) plot).getXAxisList()) { @@ -435,14 +574,24 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } //更新数据表属性 - if (plot.isAxisRotation()){ + if (plot.isAxisRotation()) { plot.getDataSheet().setVisible(false); } } + private void updateLargeData(Plot plot) { + //大数据模式 恢复用注释。取消注释。 +// if (largeDataMode != null) { +// LargeDataAttribute attribute = new LargeDataAttribute(); +// attribute.setLargeDataModeType((LargeDataModeType) largeDataMode.getSelectedItem()); +// attribute.setLargeModeThresholdNumber(largeModeThresholdNumber.getValue()); +// plot.setLargeDataAttribute(attribute); +// } + } + private void updateChartAnimate(Chart chart, Plot plot) { - if(plot.isSupportAnimate()) { - chart.setJSDraw(isChartAnimation.getSelectedIndex()==0); + if (plot.isSupportAnimate()) { + chart.setJSDraw(isChartAnimation.getSelectedIndex() == 0); } } @@ -450,15 +599,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { private void updateAutoRefresh(VanChart chart) { RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); - if(refreshMoreLabel == null) { - refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot)chart.getPlot()).getAutoAttrTooltip()); + if (refreshMoreLabel == null) { + refreshMoreLabel = new RefreshMoreLabel(((VanChartPlot) chart.getPlot()).getAutoAttrTooltip()); chart.setRefreshMoreLabel(refreshMoreLabel); } autoRefreshPane.updateBean(refreshMoreLabel); } @Override - public Chart updateBean() { + public VanChart updateBean() { return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java index ec1ed0d9db..7de7ca3d5d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePaneWithMapZoom.java @@ -9,6 +9,8 @@ import java.awt.BorderLayout; * Created by mengao on 2017/4/7. */ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneWithOutSort { + + //图表缩放新设计 恢复用注释。删除下面方法 createZoomPaneContent。 @Override protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { JPanel panel = new JPanel(new BorderLayout(0, 4)); @@ -16,4 +18,10 @@ public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneW panel.add(zoomGesturePane, BorderLayout.CENTER); return panel; } + + //图表缩放新设计 恢复用注释。取消注释。 +// @Override +// protected ZoomPane createZoomPane() { +// return new MapZoomPane(); +// } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java new file mode 100644 index 0000000000..22395cd9e5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/MapZoomPane.java @@ -0,0 +1,47 @@ +package com.fr.van.chart.designer.other.zoom; + +import com.fr.chartx.attr.ZoomAttribute; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; + +import java.awt.Component; + +/** + * Created by shine on 2019/08/28. + */ +public class MapZoomPane extends ZoomPane { + + private UIButtonGroup mapZoomWidget;//地图缩放控件 + private UIButtonGroup gestureZoomGroup;//地图手势缩放 + + @Override + protected Component[][] getSouthComps() { + mapZoomWidget = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") + , Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); + + gestureZoomGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") + , Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); + + + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget")), mapZoomWidget}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture")), gestureZoomGroup} + }; + } + + @Override + public void populateBean(ZoomAttribute ob) { + super.populateBean(ob); + mapZoomWidget.setSelectedItem(ob.isMapZoomWidget()); + gestureZoomGroup.setSelectedItem(ob.isGestureZoom()); + } + + @Override + public ZoomAttribute updateBean() { + ZoomAttribute zoomAttribute = super.updateBean(); + zoomAttribute.setMapZoomWidget(mapZoomWidget.getSelectedItem()); + zoomAttribute.setGestureZoom(gestureZoomGroup.getSelectedItem()); + return zoomAttribute; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java new file mode 100644 index 0000000000..dfbf2d640a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPane.java @@ -0,0 +1,252 @@ +package com.fr.van.chart.designer.other.zoom; + +import com.fr.chartx.attr.ZoomAttribute; +import com.fr.chartx.attr.ZoomInitialDisplayType; +import com.fr.chartx.attr.ZoomModeType; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.extended.chart.StringFormula; +import com.fr.general.ComparatorUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; + +/** + * Created by shine on 2019/08/28. + */ +public class ZoomPane extends BasicBeanPane { + + private UIButtonGroup modeTypeButtonGroup; + + private JPanel customModePane; + private UIComboBox initialDisplayTypeComboBox; + private JPanel initialDisplayCardPane; + private UISpinner topCategorySpinner; + private TinyFormulaPane leftFormulaPane; + private TinyFormulaPane rightFormulaPane; + + private UIButtonGroup selectionZoomGroup; + + public ZoomPane() { + initComponent(); + } + + private void initComponent() { + + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double p = TableLayout.PREFERRED; + double[] columnSize = {f, e}; + + JPanel northPane = createNorthPane(f, p); + + initCustomModePane(columnSize, p); + + JPanel southPane = createSouthPane(f, p); + + this.setLayout(new BorderLayout(0, 6)); + + if (northPane != null) { + this.add(northPane, BorderLayout.NORTH); + } + if (customModePane != null) { + this.add(customModePane, BorderLayout.CENTER); + } + if (southPane != null) { + this.add(southPane, BorderLayout.SOUTH); + } + } + + protected JPanel createNorthPane(double f, double p) { + modeTypeButtonGroup = new UIButtonGroup(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), + Toolkit.i18nText("Fine-Design_Chart_Mode_Custom"), + Toolkit.i18nText("Fine-Design_Chart_Close") + }, new ZoomModeType[]{ZoomModeType.AUTO, ZoomModeType.CUSTOM, ZoomModeType.CLOSE}); + + modeTypeButtonGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCustomModePane(); + } + }); + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Mode_type")), modeTypeButtonGroup} + }; + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p} + , new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}); + } + + private JPanel createSouthPane(double f, double p) { + + Component[][] components = getSouthComps(); + + double[] rows = new double[components.length]; + Arrays.fill(rows, p); + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rows + , new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}); + } + + protected Component[][] getSouthComps() { + selectionZoomGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") + , Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); + + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Selection_Zoom")), selectionZoomGroup} + }; + } + + protected void initCustomModePane(double[] columnSize, double p) { + initialDisplayTypeComboBox = new UIComboBox(new ZoomInitialDisplayType[]{ + ZoomInitialDisplayType.TOP_CATEGORY, + ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY}); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_InitialDisplay")), initialDisplayTypeComboBox} + }; + JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p}, columnSize); + + + initInitialDisplayCardPane(columnSize, p); + + customModePane = new JPanel(new BorderLayout(0, 6)); + customModePane.add(northPane, BorderLayout.NORTH); + customModePane.add(initialDisplayCardPane, BorderLayout.CENTER); + customModePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); + } + + private void initInitialDisplayCardPane(double[] columnSize, double p) { + topCategorySpinner = new UISpinner(1, Integer.MAX_VALUE, 1); + Component[][] components1 = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Number")), topCategorySpinner} + }; + final JPanel topPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components1, new double[]{p}, columnSize); + + + leftFormulaPane = new TinyFormulaPane(); + rightFormulaPane = new TinyFormulaPane(); + Component[][] components2 = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Left_Boundary")), leftFormulaPane}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Right_Boundary")), rightFormulaPane} + }; + final JPanel leftRightPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, new double[]{p, p}, columnSize); + + initialDisplayCardPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + return initialDisplayTypeComboBox.getSelectedIndex() == 0 ? topPane.getPreferredSize() : leftRightPane.getPreferredSize(); + } + }; + initialDisplayCardPane.add(topPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); + initialDisplayCardPane.add(leftRightPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString()); + initialDisplayTypeComboBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkInitialDisplayCardPane(); + } + }); + } + + private void checkCustomModePane() { + if (customModePane == null){ + return; + } + customModePane.setVisible(modeTypeButtonGroup.getSelectedItem() == ZoomModeType.CUSTOM); + } + + private void checkInitialDisplayCardPane() { + if (initialDisplayCardPane == null){ + return; + } + + CardLayout cardLayout = (CardLayout) initialDisplayCardPane.getLayout(); + if (ComparatorUtils.equals(initialDisplayTypeComboBox.getSelectedItem(), ZoomInitialDisplayType.TOP_CATEGORY)) { + cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); + } else { + cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString()); + } + } + + + @Override + public void populateBean(ZoomAttribute ob) { + if (modeTypeButtonGroup != null) { + modeTypeButtonGroup.setSelectedItem(ob.getModeType()); + } + + if (initialDisplayTypeComboBox != null){ + initialDisplayTypeComboBox.setSelectedItem(ob.getInitialDisplayType()); + } + + if (topCategorySpinner != null) { + topCategorySpinner.setValue(ob.getTopCategory()); + } + + if (ob.getLeft() != null && leftFormulaPane != null) { + leftFormulaPane.populateBean(ob.getLeft().getContent()); + } + if (ob.getRight() != null && rightFormulaPane != null) { + rightFormulaPane.populateBean(ob.getRight().getContent()); + } + + if (selectionZoomGroup != null) { + selectionZoomGroup.setSelectedItem(ob.isSelectionZoom()); + } + + checkInitialDisplayCardPane(); + checkCustomModePane(); + } + + @Override + public ZoomAttribute updateBean() { + ZoomAttribute zoomAttribute = new ZoomAttribute(); + + if (modeTypeButtonGroup != null) { + zoomAttribute.setModeType(modeTypeButtonGroup.getSelectedItem()); + } + + if (initialDisplayTypeComboBox != null) { + zoomAttribute.setInitialDisplayType((ZoomInitialDisplayType) initialDisplayTypeComboBox.getSelectedItem()); + } + + if (topCategorySpinner != null){ + zoomAttribute.setTopCategory((int) topCategorySpinner.getValue()); + } + + if (leftFormulaPane != null){ + zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); + } + + if (rightFormulaPane != null){ + zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); + } + + if (selectionZoomGroup != null) { + zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem()); + } + + return zoomAttribute; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java new file mode 100644 index 0000000000..5edda21333 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/zoom/ZoomPaneWithOutMode.java @@ -0,0 +1,18 @@ +package com.fr.van.chart.designer.other.zoom; + +import javax.swing.JPanel; + +/** + * Created by shine on 2019/08/28. + */ +public class ZoomPaneWithOutMode extends ZoomPane { + @Override + protected JPanel createNorthPane(double f, double p) { + return null; + } + + @Override + protected void initCustomModePane(double[] columnSize, double p) { + //do nothing + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index d3a437ef25..f4e1127f24 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java @@ -13,7 +13,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.stable.Constants; @@ -55,11 +54,14 @@ public class VanChartPlotLegendPane extends BasicPane { protected UIButtonGroup location; protected UIToggleButton customFloatPositionButton; protected VanChartFloatPositionPane customFloatPositionPane; + + //区域显示策略 恢复用注释。下面4行删除。 protected UIButtonGroup limitSize; protected UISpinner maxProportion; private UILabel limitSizeTitle; private JPanel maxProportionPane; - + //区域显示策略 恢复用注释。取消注释。 + //private LimitPane limitPane; //高亮显示的按钮 protected UIButtonGroup highlightButton; @@ -180,7 +182,7 @@ public class VanChartPlotLegendPane extends BasicPane { initPositionListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } private void initPositionListener(){ @@ -232,14 +234,15 @@ public class VanChartPlotLegendPane extends BasicPane { } protected JPanel createDisplayStrategy(){ - maxProportion = new UISpinner(0,100,1,30); - limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); + //区域显示策略 恢复用注释。开始删除。 + maxProportion = new UISpinner(0, 100, 1, 30); + limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); limitSizeTitle = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion")); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion,TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); + maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(limitSizePane, BorderLayout.NORTH); panel.add(maxProportionPane, BorderLayout.CENTER); @@ -251,6 +254,11 @@ public class VanChartPlotLegendPane extends BasicPane { } }); return panel; + //区域显示策略 恢复用注释。结束删除。 + + //区域显示策略 恢复用注释。取消注释。 +// limitPane = new LimitPane(false); +// return limitPane; } private JPanel createHighlightPane(){ @@ -276,15 +284,19 @@ public class VanChartPlotLegendPane extends BasicPane { //检查显示策略界面是否可用 protected void checkDisplayStrategyUse() { + //区域显示策略 恢复用注释。下面2行删除。 limitSize.setEnabled(!customFloatPositionButton.isSelected()); checkMaxProPortionUse(); + //区域显示策略 恢复用注释。取消注释。 +// GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); +// limitPane.checkMaxProPortionUse(); } + //区域显示策略 恢复用注释。删除下面方法。 //检查最大显示占比是否可用 private void checkMaxProPortionUse() { maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); maxProportionPane.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); - } protected void checkBoxUse() { @@ -315,8 +327,11 @@ public class VanChartPlotLegendPane extends BasicPane { legend.setPosition(-1); } legend.setFloating(customFloatPositionButton.isSelected()); + //区域显示策略 恢复用注释。下面2行删除。 legend.setLimitSize(limitSize.getSelectedIndex() == 0); legend.setMaxHeight(maxProportion.getValue()); + //区域显示策略 恢复用注释。取消注释。 + //legend.setLimitAttribute(limitPane.updateBean()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); if(highlightButton != null && highlightButton.getSelectedItem() != null){ @@ -336,8 +351,11 @@ public class VanChartPlotLegendPane extends BasicPane { customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionPane.setFloatPosition_x(legend.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(legend.getFloatPercentY()); + //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(legend.isLimitSize() ? 0 : 1); maxProportion.setValue(legend.getMaxHeight()); + //区域显示策略 恢复用注释。取消注释。 + //limitPane.populateBean(legend.getLimitAttribute()); if(highlightButton != null){ highlightButton.setSelectedItem(legend.isHighlight()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 39d0b8f1bd..2e7ae32781 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -192,26 +192,12 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { public void populateBean(VanChartLegend legend) { VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; if (scatterLegend != null) { - isLegendVisible.setSelected(scatterLegend.isLegendVisible()); - textAttrPane.populate(scatterLegend.getFRFont()); - borderPane.populate(scatterLegend); - backgroundPane.populate(scatterLegend); - if(!scatterLegend.isFloating()){ - location.setSelectedItem(scatterLegend.getPosition()); - } - customFloatPositionButton.setSelected(scatterLegend.isFloating()); - customFloatPositionPane.setFloatPosition_x(scatterLegend.getFloatPercentX()); - customFloatPositionPane.setFloatPosition_y(scatterLegend.getFloatPercentY()); - limitSize.setSelectedIndex(scatterLegend.isLimitSize() ? 0 : 1); - maxProportion.setValue(scatterLegend.getMaxHeight()); + //范围图例部分 legendTypeButton.setSelectedItem(scatterLegend.getLegendType()); gradualLegendPane.populate(scatterLegend.getGradualLegend()); sectionLegendPane.populate(scatterLegend.getSectionLegend()); - - if(highlightButton != null){ - highlightButton.setSelectedItem(legend.isHighlight()); - } + super.populateBean(scatterLegend); } checkAllUse(); this.checkHighlightVisible(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index c99dccace9..6a7987bcdb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java @@ -16,7 +16,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - import com.fr.design.utils.gui.UIComponentUtils; import com.fr.plugin.chart.attr.VanChartTitle; import com.fr.plugin.chart.vanchart.VanChart; @@ -60,9 +59,13 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { private UIToggleButton useHtml; private UIToggleButton customFloatPositionButton; private VanChartFloatPositionPane customFloatPositionPane; + + //区域显示策略 恢复用注释。下面3行删除。 private UIButtonGroup limitSize; private UISpinner maxProportion; private JPanel maxProportionPane; + //区域显示策略 恢复用注释。取消注释。 + //private LimitPane limitPane; protected VanChartStylePane parent; @@ -162,7 +165,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { initPositionListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); } private JPanel createTitleStylePane(){ @@ -171,12 +174,13 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } private JPanel createDisplayStrategy(){ - maxProportion = new UISpinner(0,100,1,30); - limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); + //区域显示策略 恢复用注释。开始删除。 + maxProportion = new UISpinner(0, 100, 1, 30); + limitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),limitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), limitSize); + maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(limitSizePane, BorderLayout.NORTH); panel.add(maxProportionPane, BorderLayout.CENTER); @@ -189,6 +193,12 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { }); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + + //区域显示策略 恢复用注释。结束删除。 + + //区域显示策略 恢复用注释。取消注释。 +// limitPane = new LimitPane(); +// return limitPane; } private void initPositionListener(){ @@ -250,10 +260,15 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { //检查显示策略界面是否可用 private void checkDisplayStrategyUse() { + //区域显示策略 恢复用注释。下面2行删除。 limitSize.setEnabled(!customFloatPositionButton.isSelected()); checkMaxProPortionUse(); + //区域显示策略 恢复用注释。取消注释。 +// GUICoreUtils.setEnabled(limitPane, !customFloatPositionButton.isSelected()); +// limitPane.checkMaxProPortionUse(); } + //区域显示策略 恢复用注释。删除下面方法。 //检查最大显示占比是否可用 private void checkMaxProPortionUse() { maxProportion.setVisible(limitSize.getSelectedIndex() == 0 && limitSize.isEnabled()); @@ -301,8 +316,11 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { customFloatPositionButton.setSelected(title.isFloating()); customFloatPositionPane.setFloatPosition_x(title.getFloatPercentX()); customFloatPositionPane.setFloatPosition_y(title.getFloatPercentY()); + //区域显示策略 恢复用注释。下面2行删除。 limitSize.setSelectedIndex(title.isLimitSize() ? 0 : 1); maxProportion.setValue(title.getMaxHeight()); + //区域显示策略 恢复用注释。取消注释。 + //limitPane.populateBean(title.getLimitAttribute()); checkAllUse(); } @@ -335,8 +353,11 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } title.setUseHtml(useHtml.isSelected()); title.setFloating(customFloatPositionButton.isSelected()); + //区域显示策略 恢复用注释。下面2行删除。 title.setLimitSize(limitSize.getSelectedIndex() == 0); title.setMaxHeight(maxProportion.getValue()); + //区域显示策略 恢复用注释。取消注释。 + //title.setLimitAttribute(limitPane.updateBean()); title.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); title.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); textAttrPane.update(textAttr); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index ac88b9be4d..064a7156bd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -15,6 +15,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.style.FormatPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; @@ -23,11 +24,13 @@ import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.base.OverlapHandleType; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.type.AxisTickLineType; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -36,6 +39,8 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; @@ -58,10 +63,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected UIButtonGroup showLabel; protected ChartTextAttrPane labelTextAttrPane; protected UINumberDragPane labelTextRotation; - protected UIButtonGroup labelGapStyle; + + //轴标签缩略间隔显示 恢复用注释。下面6行删除。 protected UITextField labelGapValue; - protected JPanel labelPanel; + private UIButtonGroup overlapHandleTypeGroup; + protected UIButtonGroup labelGapStyle; + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //protected UISpinner labelGapValue; + + protected JPanel labelPanel; + private JPanel labelGapStylePane; + private JPanel labelGapValuePane; protected LineComboBox axisLineStyle; protected ColorSelectBox axisLineColor; @@ -71,15 +84,17 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected UIButtonGroup position; protected UIButtonGroup reversed; + //区域显示策略 恢复用注释。下面3行删除。 protected UIButtonGroup axisLimitSize; protected UISpinner maxProportion; protected JPanel maxProportionPane; + //区域显示策略 恢复用注释。取消注释。 + //private LimitPane limitPane; protected UIButtonGroup valueFormatStyle; protected FormatPane valueFormat; protected JPanel centerPane; private VanChartHtmlLabelPane htmlLabelPane; - private JPanel labelGapValuePane; public VanChartBaseAxisPane(){ this(true); @@ -112,7 +127,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { new Component[]{createLabelPane(new double[]{p, p}, column), null}, new Component[]{createLineStylePane(new double[]{p, p, p, p, p}, columnSize), null}, new Component[]{createAxisPositionPane(new double[]{p, p, p}, columnSize, isXAxis), null}, - new Component[]{createDisplayStrategy(new double[]{p, p, p}, columnSize), null}, + new Component[]{createDisplayStrategy(), null}, new Component[]{createValueStylePane(), null}, }; @@ -169,8 +184,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); labelTextAttrPane = getChartTextAttrPane(); - labelTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); - labelGapStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); + labelGapStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); labelGapValue = new UITextField(); Component[][] gapComponents = new Component[][]{ new Component[]{ @@ -180,14 +195,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle}, }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col); - labelGapValuePane= TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText(""),labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText(""), labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); JPanel gapPanel = new JPanel(new BorderLayout()); gapPanel.add(panel, BorderLayout.CENTER); gapPanel.add(labelGapValuePane, BorderLayout.SOUTH); - Component[][] components = new Component[][]{ + Component[][] components = new Component[][]{ new Component[]{labelTextAttrPane, null}, - new Component[]{gapPanel,null}, + new Component[]{gapPanel, null}, }; JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); @@ -211,6 +226,88 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); } +// protected JPanel createLabelPane(double[] row, double[] col){ +// double p = TableLayout.PREFERRED; +// showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); +// labelTextAttrPane = getChartTextAttrPane(); +// +// JPanel rotationPane = createLabelRotationPane(col); +// JPanel overlapPane = createLabelOverlapPane(); +// +// +// Component[][] components = new Component[][]{ +// new Component[]{labelTextAttrPane, null}, +// new Component[]{rotationPane, null}, +// new Component[]{overlapPane, null}, +// }; +// +// JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); +// labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, col); +// labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); +// showLabel.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// checkLabelPane(); +// } +// }); +// JPanel jPanel = new JPanel(new BorderLayout()); +// jPanel.add(showLabelPane, BorderLayout.NORTH); +// jPanel.add(labelPanel, BorderLayout.CENTER); +// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); +// } + + private JPanel createLabelRotationPane(double[] col) { + labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); + + Component[][] gapComponents = new Component[][]{ + new Component[]{ + FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), + UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) + } + }; + return TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, new double[]{TableLayout.PREFERRED}, col); + } + + private JPanel createLabelOverlapPane() { + + labelGapStyle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); + labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1); + labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + JPanel panel = new JPanel(new BorderLayout(0, 0)); + addOverlapGroupButton(panel); + panel.add(labelGapStylePane, BorderLayout.CENTER); + panel.add(labelGapValuePane, BorderLayout.SOUTH); + + labelGapStyle.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkLabelGapValuePane(); + } + }); + + return panel; + } + + protected void addOverlapGroupButton(JPanel panel) { + overlapHandleTypeGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAbbreviate"), Toolkit.i18nText("Fine-Design_Chart_Label_OverlapInterval")}, + new OverlapHandleType[]{OverlapHandleType.ABBREVIATE, OverlapHandleType.INTERVAL}); + JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_WhenOverlap"), overlapHandleTypeGroup, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + + panel.add(north, BorderLayout.NORTH); + + overlapHandleTypeGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkLabelGapAndStylePane(); + } + }); + + } + protected ChartTextAttrPane getChartTextAttrPane(){ return new ChartTextAttrPane(){ @@ -285,13 +382,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } } - protected JPanel createDisplayStrategy(double[] row, double[] col){ - maxProportion = new UISpinner(0,100,1,30); - axisLimitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); + protected JPanel createDisplayStrategy(){ + //区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。 + maxProportion = new UISpinner(0, 100, 1, 30); + axisLimitSize = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); - JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"),axisLimitSize); - maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"),maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); - maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Size"), axisLimitSize); + maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); JPanel panel = new JPanel(new BorderLayout()); panel.add(limitSizePane, BorderLayout.NORTH); panel.add(maxProportionPane, BorderLayout.CENTER); @@ -304,6 +402,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { }); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + + //区域显示策略 恢复用注释。取消注释。 +// limitPane = new LimitPane(); +// return limitPane; } protected JPanel createValueStylePane(){ @@ -360,7 +462,21 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { protected void checkAllUse() { checkCardPane(); checkLabelPane(); + //区域显示策略 恢复用注释。删除下面一行。 checkMaxProPortionUse(); + + //区域显示策略 恢复用注释。取消注释。 +// if (limitPane != null){ +// limitPane.checkMaxProPortionUse(); +// } + } + + //区域显示策略 恢复用注释。删除此方法。 + //检查最大显示占比是否可用 + private void checkMaxProPortionUse() { + if (maxProportionPane != null && axisLimitSize != null) { + maxProportionPane.setVisible(axisLimitSize.getSelectedIndex() == 0 && axisLimitSize.isEnabled()); + } } protected void checkCardPane() { @@ -381,24 +497,35 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { labelPanel.setVisible(enabled); } if(enabled){ + //轴标签缩略间隔显示 恢复用注释。下面1行删除。 checkLabelGapValuePane(); + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //checkLabelGapAndStylePane(); } } } - protected void checkLabelGapValuePane() { - if(labelGapValuePane != null && labelGapStyle != null){ - labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); + private void checkLabelGapAndStylePane() { + if (overlapHandleTypeGroup != null && labelGapStylePane != null) { + boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; + + labelGapStylePane.setVisible(visible); } + checkLabelGapValuePane(); } - //检查最大显示占比是否可用 - private void checkMaxProPortionUse() { - if(maxProportionPane != null && axisLimitSize != null){ - maxProportionPane.setVisible(axisLimitSize.getSelectedIndex() == 0 && axisLimitSize.isEnabled()); + protected void checkLabelGapValuePane() { + if (labelGapValuePane != null && labelGapStyle != null) { + boolean visible = labelGapStyle.getSelectedIndex() == 1; + //轴标签缩略间隔显示 恢复用注释。取消注释。 +// if (overlapHandleTypeGroup != null) { +// visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; +// } + labelGapValuePane.setVisible(visible); } } + /** * 是否是指定类型 * @param ob 对象 @@ -477,11 +604,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if(labelTextRotation != null){ labelTextRotation.populateBean((double)labelTextAttr.getRotation()); } + //轴标签缩略间隔显示 恢复用注释。取消注释。 +// if (overlapHandleTypeGroup != null) { +// overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); +// } if(labelGapStyle != null){ labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); } if(labelGapValue != null){ + //轴标签缩略间隔显示 恢复用注释。下面1行删除。 labelGapValue.setText(axis.getLabelNumber().getContent()); + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //labelGapValue.setValue(axis.getIntervalNumber()); } } @@ -516,13 +650,18 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //显示策略 private void populateDisplayStrategy(VanChartAxis axis) { - if(axisLimitSize != null){ + //区域显示策略 恢复用注释。下面6行删除。 + if (axisLimitSize != null) { axisLimitSize.setSelectedIndex(axis.isLimitSize() ? 0 : 1); } - if(maxProportion != null){ + if (maxProportion != null) { maxProportion.setValue(axis.getMaxHeight()); } + //区域显示策略 恢复用注释。取消注释。 +// if (limitPane != null) { +// limitPane.populateBean(axis.getLimitAttribute()); +// } } //格式 @@ -597,15 +736,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { if(labelTextRotation != null){ labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); } + //轴标签缩略间隔显示 恢复用注释。取消注释。 +// if (overlapHandleTypeGroup != null) { +// axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); +// } if(labelGapStyle != null){ axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); } if(labelGapValue != null){ - if(axis.isAutoLabelGap()){ + //轴标签缩略间隔显示 恢复用注释。下面5行删除。 + if (axis.isAutoLabelGap()) { axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); } else { axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText())); } + //轴标签缩略间隔显示 恢复用注释。取消注释。 + //axis.setIntervalNumber((int) labelGapValue.getValue()); } } @@ -637,12 +783,17 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { //显示策略 private void updateDisplayStrategy(VanChartAxis axis){ - if(axisLimitSize != null){ + //区域显示策略 恢复用注释。下面6行删除。 + if (axisLimitSize != null) { axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); } - if(maxProportion != null){ + if (maxProportion != null) { axis.setMaxHeight(maxProportion.getValue()); } + //区域显示策略 恢复用注释。取消注释。 +// if (limitPane != null) { +// axis.setLimitAttribute(limitPane.updateBean()); +// } } protected void updateFormat(VanChartAxis axis) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java index 3a43866a23..2d408c9050 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java @@ -17,7 +17,6 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.DateUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartTimeAxis; import com.fr.plugin.chart.base.VanChartConstants; @@ -58,6 +57,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { super(isXAxis); } + @Override protected JPanel createContentPane(boolean isXAxis){ double p = TableLayout.PREFERRED; @@ -73,13 +73,18 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { new Component[]{createValueDefinition(),null}, new Component[]{createLineStylePane(new double[]{p, p,p,p,p}, columnSize),null}, new Component[]{createAxisPositionPane(new double[]{p, p, p}, columnSize, isXAxis),null}, - new Component[]{createDisplayStrategy(new double[]{p, p,p}, columnSize),null}, + new Component[]{createDisplayStrategy(),null}, new Component[]{createValueStylePane(),null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + @Override + protected void addOverlapGroupButton(JPanel panel) { + //do nothing + } + private JPanel createValueDefinition(){ timeMinMaxValuePane = new TimeMinMaxValuePane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), timeMinMaxValuePane); @@ -90,6 +95,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { return PlotFactory.createAutoFormatPane(); } + @Override protected void checkFormatType() { valueFormat.setComboBoxModel(true); } @@ -101,6 +107,7 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane { timeMinMaxValuePane.update(timeAxis); } + @Override public VanChartTimeAxis updateBean(String axisName, int position) { VanChartTimeAxis axis = new VanChartTimeAxis(axisName, VanChartConstants.AXIS_BOTTOM); updateBean(axis); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java index 39ae32372f..2b90633e67 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartValueAxisPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.stable.StringUtils; @@ -39,6 +38,7 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane { super(isXAxis); } + @Override protected JPanel createContentPane(boolean isXAxis){ double p = TableLayout.PREFERRED; @@ -54,13 +54,18 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane { new Component[]{createMinMaxValuePane(new double[]{p, p}, columnSize), null}, new Component[]{createLineStylePane(new double[]{p, p, p, p, p}, columnSize), null}, new Component[]{createAxisPositionPane(new double[]{p, p, p}, columnSize, isXAxis), null}, - new Component[]{createDisplayStrategy(new double[]{p, p, p}, columnSize), null}, + new Component[]{createDisplayStrategy(), null}, new Component[]{createValueStylePane(), null}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + @Override + protected void addOverlapGroupButton(JPanel panel) { + //do nothing + } + protected JPanel createMinMaxValuePane(double[] row, double[] col){ JPanel panel = createCommenValuePane(row,col); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), panel); @@ -123,6 +128,7 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Axis"); } + @Override public void populateBean(VanChartAxis axis){ VanChartValueAxis valueAxis = (VanChartValueAxis)axis; super.populateBean(valueAxis); @@ -150,6 +156,7 @@ public class VanChartValueAxisPane extends VanChartBaseAxisPane { } } + @Override public VanChartValueAxis updateBean(String axisName, int position){ VanChartValueAxis axis = new VanChartValueAxis(axisName, position); updateBean(axis); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeAxisPane.java index ac1a0a0f7f..b1f516e342 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeAxisPane.java @@ -24,6 +24,8 @@ public class VanChartGaugeAxisPane extends VanChartAxisPane { this.setLayout(new BorderLayout()); gaugeAxisPane = new VanChartAxisScrollPaneWithGauge(); this.add(gaugeAxisPane, BorderLayout.CENTER); + + gaugeAxisPane.setParentPane(parent); } @Override diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index e047830291..cdb6b04b4c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java @@ -2,14 +2,18 @@ package com.fr.van.chart.designer.style.axis.gauge; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.style.color.ColorSelectBox; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis; import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.type.FontAutoType; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -77,13 +81,13 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { } protected JPanel createLabelPane(double[] row, double[] col){ - showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); + showLabel = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")}); labelTextAttrPane = getChartTextAttrPane(); labelPanel = new JPanel(new BorderLayout()); labelPanel.add(labelTextAttrPane); labelPanel.setBorder(BorderFactory.createEmptyBorder(0,15,0,0)); JPanel panel = new JPanel(new BorderLayout(0, 6)); - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); + panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel), BorderLayout.NORTH); panel.add(labelPanel, BorderLayout.CENTER); showLabel.addActionListener(new ActionListener() { @Override @@ -96,11 +100,17 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { return jPanel; } + protected ChartTextAttrPane getChartTextAttrPane() { + if (isMulti(gaugeStyle)) { + return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR); + } else { + return new ChartTextAttrPane(); + } + } + private JPanel createValueDefinition(){ switch (gaugeStyle){ case RING: - minMaxValuePane = new MinMaxValuePaneWithOutTick(); - break; case SLOT: minMaxValuePane = new MinMaxValuePaneWithOutTick(); break; @@ -108,18 +118,18 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane { minMaxValuePane = new VanChartMinMaxValuePane(); break; } - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Definition"), minMaxValuePane); } private JPanel createTickColorPane(double[] row, double[] col){ mainTickColor = new ColorSelectBox(100); secTickColor = new ColorSelectBox(100); Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTickColor}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secTickColor}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); - JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel); + JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TickColor"), panel); panel.setBorder(BorderFactory.createEmptyBorder(10,10,0,15)); return jPanel; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java index f7567ed211..d30d245731 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java @@ -54,6 +54,7 @@ public class VanChartRadarYAxisPane extends VanChartValueAxisPane { return new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); } + @Override protected JPanel createMinMaxValuePane(double[] row, double[] col) { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java index 282ad45129..27336baf0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java @@ -16,7 +16,6 @@ import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.GeneralUtils; - import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.axis.VanChartAlertValue; import com.fr.plugin.chart.base.VanChartConstants; @@ -42,7 +41,11 @@ public class VanChartAlertValuePane extends BasicBeanPane { private static final long serialVersionUID = -1208941770684286439L; private UIButtonGroup alertAxis; protected TinyFormulaPane alertValue; + //线型支持虚线 恢复用注释。下面1行删除。 protected LineComboBox alertLineStyle; + //线型支持虚线 恢复用注释。取消注释。 +// protected LineTypeComboBox alertLineStyle;//线型 +// private UISpinner lineWidthSpinner;//线宽 protected ColorSelectBox alertLineColor; private UIButtonGroup alertTextPosition; @@ -63,7 +66,11 @@ public class VanChartAlertValuePane extends BasicBeanPane { //設置大小,防止文本過長導致界面“變形” alertValue.setPreferredSize(new Dimension(VALUE_WD, HT)); + //线型支持虚线 恢复用注释。下面1行删除。 alertLineStyle = new LineComboBox(VanChartConstants.ALERT_LINE_STYLE); + //线型支持虚线 恢复用注释。取消注释。 +// alertLineStyle = new LineTypeComboBox(new LineType[]{LineType.NORMAL, LineType.DASH}); +// lineWidthSpinner = new UISpinner(0.5, Integer.MAX_VALUE, 0.5, 2); alertLineColor = new ColorSelectBox(100); alertTextPosition = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom")}); alertText = new TinyFormulaPane(); @@ -95,7 +102,7 @@ public class VanChartAlertValuePane extends BasicBeanPane { { double p = TableLayout.PREFERRED; double[] columnSize = {p,p}; - double[] rowSize = {p,p,p,p}; + double[] rowSize = {p,p,p,p,p}; Component[][] components = getTopPaneComponents(); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -106,6 +113,8 @@ public class VanChartAlertValuePane extends BasicBeanPane { new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),alertAxis}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")),alertValue}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),alertLineStyle}, + //线型支持虚线 恢复用注释。取消注释。 + //new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Width")), lineWidthSpinner}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),alertLineColor}, }; } @@ -154,7 +163,11 @@ public class VanChartAlertValuePane extends BasicBeanPane { checkPositionPane(); alertValue.populateBean(Utils.objectToString(chartAlertValue.getAlertValueFormula())); + //线型支持虚线 恢复用注释。下面1行删除。 alertLineStyle.setSelectedLineStyle(chartAlertValue.getLineStyle().getLineStyle()); + //线型支持虚线 恢复用注释。取消注释。 +// alertLineStyle.setSelectedItem(chartAlertValue.getLineStyle().getLineType()); +// lineWidthSpinner.setValue(chartAlertValue.getLineStyle().getLineWidth()); alertLineColor.setSelectObject(chartAlertValue.getLineColor().getSeriesColor()); if(VanChartAttrHelper.isXAxis(chartAlertValue.getAxisName())){ @@ -178,7 +191,11 @@ public class VanChartAlertValuePane extends BasicBeanPane { chartAlertValue.setAlertValueFormula(BaseFormula.createFormulaBuilder().build(alertValue.updateBean())); chartAlertValue.getLineColor().setSeriesColor(alertLineColor.getSelectObject()); + //线型支持虚线 恢复用注释。下面1行删除。 chartAlertValue.getLineStyle().setLineStyle(alertLineStyle.getSelectedLineStyle()); + //线型支持虚线 恢复用注释。取消注释。 +// chartAlertValue.getLineStyle().setLineType((LineType) alertLineStyle.getSelectedItem()); +// chartAlertValue.getLineStyle().setLineWidth(lineWidthSpinner.getValue()); String contentString = alertText.updateBean(); Object contentObj; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java index 08c474c3ed..7e09e987ce 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java @@ -4,11 +4,11 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorSelectBox; import com.fr.general.ComparatorUtils; - import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -20,6 +20,7 @@ import java.awt.CardLayout; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.Arrays; /** * 样式-背景-绘图区背景-坐标轴图表特有(间隔背景、网格线、警戒线) @@ -39,11 +40,23 @@ public class VanChartAxisAreaPane extends BasicBeanPane { private ColorSelectBox verticalColorBackground; protected BackgroundListControlPane customIntervalBackground; + //线型支持虚线 恢复用注释。取消注释。 +// private LineTypeComboBox horizonLineType;//横向线型 +// private LineTypeComboBox verticalLineType;//纵向线型 +// private JPanel horizontalColorPane; +// private JPanel verticalColorPane; + public VanChartAxisAreaPane() { initComponents(); } protected void initComponents() { + horizontalGridLine = new ColorSelectBox(100); + verticalGridLine = new ColorSelectBox(100); + //线型支持虚线 恢复用注释。取消注释。 +// horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); +// verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.NORMAL, LineType.DASH}); + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -52,7 +65,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane { double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{createGridLinePane(new double[]{p, p, p}, new double[]{f, e})}, + new Component[]{createGridLinePane()}, new Component[]{createAlertLinePane()}, new Component[]{createIntervalPane(new double[]{p, p, p, p}, new double[]{f, s})}, }; @@ -61,25 +74,82 @@ public class VanChartAxisAreaPane extends BasicBeanPane { this.add(panel, BorderLayout.CENTER); } - private JPanel createGridLinePane(double[] row, double[] col) { + //线型支持虚线 恢复用注释。删除下面方法。 + protected JPanel createGridLinePane() { horizontalGridLine = new ColorSelectBox(100); verticalGridLine = new ColorSelectBox(100); - Component[][] components = getGridLinePaneComponents(); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel); - } - - protected Component[][] getGridLinePaneComponents() { - return new Component[][]{ + Component[][] components = new Component[][]{ new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalGridLine}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalGridLine}, }; + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = new double[components.length]; + Arrays.fill(row, p); + double[] col = {f, e}; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel); } + //线型支持虚线 恢复用注释。取消注释。 +// protected JPanel createGridLinePane() { +// +// Component[][] upComponent = new Component[][]{ +// new Component[]{null, null}, +// new Component[]{null, horizontalGridLine} +// }; +// horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent); +// +// Component[][] downComponent = new Component[][]{ +// new Component[]{null,null}, +// new Component[]{null, verticalGridLine} +// }; +// verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent); +// +// horizonLineType.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// if (horizontalGridLine == null || horizonLineType == null){ +// return; +// } +// horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE); +// } +// }); +// +// verticalLineType.addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// if (verticalGridLine == null || verticalLineType == null){ +// return; +// } +// verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE); +// } +// }); +// +// checkColorBoxVisible(); +// +// JPanel horizonLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), horizonLineType); +// JPanel horizontal = new JPanel(new BorderLayout()); +// horizontal.add(horizonLineTypePane, BorderLayout.NORTH); +// horizontal.add(horizontalColorPane, BorderLayout.CENTER); +// +// JPanel verticalLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), verticalLineType); +// JPanel vertical = new JPanel(new BorderLayout()); +// vertical.add(verticalLineTypePane, BorderLayout.NORTH); +// vertical.add(verticalColorPane, BorderLayout.CENTER); +// +// JPanel panel = new JPanel(new BorderLayout(0, 4)); +// panel.add(horizontal, BorderLayout.NORTH); +// panel.add(vertical, BorderLayout.CENTER); +// +// return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel); +// } + protected JPanel createAlertLinePane() { alertLine = getAlertLinePane(); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Alert_Line"), alertLine); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Alert_Line"), alertLine); alertLine.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel; } @@ -89,7 +159,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane { } protected JPanel createIntervalPane(double[] row, double[] col) { - isDefaultIntervalBackground = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Interval"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")}); + isDefaultIntervalBackground = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Interval"), Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")}); horizontalColorBackground = new ColorSelectBox(100); verticalColorBackground = new ColorSelectBox(100); Component[][] components = getIntervalPaneComponents(); @@ -99,8 +169,8 @@ public class VanChartAxisAreaPane extends BasicBeanPane { cardLayout = new CardLayout(); centerPane = new JPanel(cardLayout); - centerPane.add(defaultPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Interval")); - centerPane.add(customIntervalBackground, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")); + centerPane.add(defaultPane, Toolkit.i18nText("Fine-Design_Chart_Default_Interval")); + centerPane.add(customIntervalBackground, Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")); isDefaultIntervalBackground.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -108,10 +178,10 @@ public class VanChartAxisAreaPane extends BasicBeanPane { } }); JPanel intervalPane = new JPanel(new BorderLayout(0, 6)); - JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), isDefaultIntervalBackground); + JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), isDefaultIntervalBackground); intervalPane.add(panel1, BorderLayout.NORTH); intervalPane.add(centerPane, BorderLayout.CENTER); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), intervalPane); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Interval_Background"), intervalPane); intervalPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel; } @@ -123,16 +193,16 @@ public class VanChartAxisAreaPane extends BasicBeanPane { protected Component[][] getIntervalPaneComponents() { return new Component[][]{ new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalColorBackground}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalColorBackground}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal")), horizontalColorBackground}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")), verticalColorBackground}, }; } private void checkCardPane() { if (isDefaultIntervalBackground.getSelectedIndex() == 0) { - cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Interval")); + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Default_Interval")); } else { - cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")); + cardLayout.show(centerPane, Toolkit.i18nText("Fine-Design_Chart_Custom_Interval_Background")); } } @@ -142,6 +212,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane { public void populateBean(Plot plot) { VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; + checkColorBoxVisible(); populateGridLine(rectanglePlot); @@ -155,9 +226,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane { checkCardPane(); } - protected void populateGridLine(VanChartRectanglePlot rectanglePlot) { + private void populateGridLine(VanChartRectanglePlot rectanglePlot) { horizontalGridLine.setSelectObject(rectanglePlot.getDefaultYAxis().getMainGridColor()); verticalGridLine.setSelectObject(rectanglePlot.getDefaultXAxis().getMainGridColor()); +//线型支持虚线 恢复用注释。取消注释。 +// horizonLineType.setSelectedItem(rectanglePlot.getDefaultYAxis().getGridLineType()); +// verticalLineType.setSelectedItem(rectanglePlot.getDefaultXAxis().getGridLineType()); } @@ -179,9 +253,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane { customIntervalBackground.update(plot, isDefaultIntervalBackground.getSelectedIndex() == 0); } - protected void updateGirdLine(VanChartRectanglePlot rectanglePlot) { + private void updateGirdLine(VanChartRectanglePlot rectanglePlot) { rectanglePlot.getDefaultYAxis().setMainGridColor(horizontalGridLine.getSelectObject()); rectanglePlot.getDefaultXAxis().setMainGridColor(verticalGridLine.getSelectObject()); + //线型支持虚线 恢复用注释。取消注释。 +// rectanglePlot.getDefaultYAxis().setGridLineType((LineType)horizonLineType.getSelectedItem()); +// rectanglePlot.getDefaultXAxis().setGridLineType((LineType)verticalLineType.getSelectedItem()); } /** @@ -199,4 +276,15 @@ public class VanChartAxisAreaPane extends BasicBeanPane { public Plot updateBean() { return null; } + + private void checkColorBoxVisible() { +//线型支持虚线 恢复用注释。取消注释。 +// if (horizontalColorPane != null && horizonLineType != null){ +// horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE); +// } +// +// if (verticalColorPane != null && verticalLineType != null){ +// verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE); +// } + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java index a304b0a59d..687516c357 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java @@ -2,12 +2,16 @@ package com.fr.van.chart.designer.style.background.radar; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ilable.UILabel; - +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.background.AlertLineListControlPane; import com.fr.van.chart.designer.style.background.BackgroundListControlPane; import com.fr.van.chart.designer.style.background.VanChartAxisAreaPane; +import javax.swing.JPanel; import java.awt.Component; +import java.util.Arrays; /** * 样式-背景-绘图区背景-雷达图只有Y轴的配置(间隔背景、网格线、警戒线) @@ -17,11 +21,21 @@ public class VanChartRadarAxisAreaPane extends VanChartAxisAreaPane { private static final long serialVersionUID = 2459614679918546393L; //雷达图只有横向的y轴的网格线配置 - protected Component[][] getGridLinePaneComponents() { - return new Component[][]{ + @Override + protected JPanel createGridLinePane() { + + Component[][] components = new Component[][]{ new Component[]{null,null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),horizontalGridLine}, }; + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = new double[components.length]; + Arrays.fill(row, p); + double[] col = {f, e}; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel); } protected Component[][] getIntervalPaneComponents() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java new file mode 100644 index 0000000000..4fd8c77d4b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/component/LimitPane.java @@ -0,0 +1,85 @@ +package com.fr.van.chart.designer.style.component; + +import com.fr.chartx.attr.LimitAttribute; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by shine on 2019/08/28. + */ +public class LimitPane extends BasicBeanPane { + + private UIButtonGroup autoCustomTypeGroup; + private UISpinner maxProportion; + private JPanel maxProportionPane; + + public LimitPane() { + this(true); + } + + public LimitPane(boolean hasTitle) { + initComponent(hasTitle); + } + + private void initComponent(boolean hasTitle) { + maxProportion = new UISpinner(0, 100, 1, 30); + autoCustomTypeGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto") + , Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}, new Boolean[]{true, false}); + + JPanel limitSizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Area_Size"), autoCustomTypeGroup); + maxProportionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Max_Proportion"), maxProportion, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); + maxProportionPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(limitSizePane, BorderLayout.NORTH); + panel.add(maxProportionPane, BorderLayout.CENTER); + + autoCustomTypeGroup.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkMaxProPortionUse(); + } + }); + + this.setLayout(new BorderLayout()); + if (hasTitle) { + JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + this.add(contentPane); + } else { + this.add(panel); + } + } + + //检查最大显示占比是否可用 + public void checkMaxProPortionUse() { + maxProportion.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled()); + maxProportionPane.setVisible(!autoCustomTypeGroup.getSelectedItem() && autoCustomTypeGroup.isEnabled()); + } + + @Override + public void populateBean(LimitAttribute ob) { + autoCustomTypeGroup.setSelectedItem(ob.isAuto()); + maxProportion.setValue(ob.getMaxSize()); + } + + @Override + public LimitAttribute updateBean() { + LimitAttribute attribute = new LimitAttribute(); + attribute.setAuto(autoCustomTypeGroup.getSelectedItem()); + attribute.setMaxSize(maxProportion.getValue()); + return attribute; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index 4199e8f7c3..64187f89b9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java @@ -1,11 +1,6 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayout; -import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCate; @@ -13,39 +8,34 @@ import com.fr.van.chart.designer.component.label.LabelContentPaneWithPercent; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; -import javax.swing.SwingConstants; import java.awt.Component; /** * 仪表盘的分类(多指针时)或者百分比标签 */ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabelDetailPane { - //todo 重新整理这个面板 private static final long serialVersionUID = 5176535960949074945L; - private GaugeStyle gaugeStyle; - public VanChartGaugeCateOrPercentLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } protected double[] getLabelPaneRowSize(Plot plot, double p) { - return hasLabelPosition(plot) ? new double[]{p,p,p} : new double[]{p,p}; - } + if (hasLabelAlign(plot)) { + return new double[]{p, p, p, p}; + } - private void initGaugeStyle(Plot plot) { - if(gaugeStyle == null){ - gaugeStyle = ((VanChartGaugePlot)plot).getGaugeStyle(); + if (hasLabelPosition(plot)) { + return new double[]{p, p, p}; } + + return new double[]{p, p}; } protected void initToolTipContentPane(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); - break; case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithCate(parent, VanChartGaugeCateOrPercentLabelDetailPane.this); break; @@ -55,13 +45,17 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } } + protected boolean isFontSizeAuto() { + return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; + } + protected boolean isFontColorAuto() { + return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; + } protected boolean hasLabelPosition(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case RING: - return false; case SLOT: return false; default: @@ -70,67 +64,10 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe } protected double[] getLabelStyleRowSize(double p) { - switch (gaugeStyle){ - case RING: - return new double[] {p, p}; - case SLOT: - return new double[] {p, p}; - default: - return new double[] {p}; - } + return new double[]{p, p}; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); } - - - protected Component[][] getLabelStyleComponents(Plot plot) { - initGaugeStyle(plot); - if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{text,style}, - new Component[]{textFontPane,null}, - }; - } else { - return new Component[][]{ - new Component[]{textFontPane, null}, - }; - } - } - - protected ChartTextAttrPane initTextFontPane () { - //todo 需要再整理下 - if (gaugeStyle == GaugeStyle.RING || gaugeStyle == GaugeStyle.SLOT){ - return new ChartTextAttrPane(){ - protected double[] getRowSize () { - double p = TableLayout.PREFERRED; - return new double[]{p, p}; - } - - protected Component[][] getComponents(JPanel buttonPane) { - return new Component[][]{ - new Component[]{null, fontNameComboBox}, - new Component[]{null, buttonPane} - }; - } - }; - } else { - return new ChartTextAttrPane(){ - protected double[] getRowSize () { - double p = TableLayout.PREFERRED; - return new double[]{p, p}; - } - - protected Component[][] getComponents(JPanel buttonPane) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); - return new Component[][]{ - new Component[]{text, fontNameComboBox}, - new Component[]{null, buttonPane} - }; - } - }; - } - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index 3cf057df59..bbdb6acb3d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -1,28 +1,61 @@ package com.fr.van.chart.designer.style.label; +import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.TwoTuple; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; - +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.base.AttrLabelDetail; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.type.FontAutoType; +import com.fr.plugin.chart.type.GaugeStyle; +import com.fr.stable.Constants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dimension; /** * Created by mengao on 2017/8/13. */ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { + private static final int TEXT_FONT_PANE_HEIGHT = 50; + private GaugeStyle gaugeStyle; + private UIButtonGroup align; + private JPanel alignPane; + private Integer[] oldAlignValues; + public VanChartGaugeLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } + protected void initLabelDetailPane(Plot plot) { + setGaugeStyle(((VanChartGaugePlot) plot).getGaugeStyle()); + super.initLabelDetailPane(plot); + } + + public GaugeStyle getGaugeStyle() { + return ((VanChartGaugePlot)this.getPlot()).getGaugeStyle(); + } + + public void setGaugeStyle(GaugeStyle gaugeStyle) { + this.gaugeStyle = gaugeStyle; + } + protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane = initTextFontPane(); initStyleListener(); @@ -30,16 +63,168 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { return TableLayoutHelper.createTableLayoutPane(getLabelStyleComponents(plot), row, col); } + protected boolean isFontSizeAuto() { + return false; + } + + protected boolean isFontColorAuto() { + return false; + } - protected ChartTextAttrPane initTextFontPane () { - return new ChartTextAttrPane(); + private FontAutoType getFontAutoType() { + if (isFontSizeAuto() && isFontColorAuto()) { + return FontAutoType.SIZE_AND_COLOR; + } + if (isFontSizeAuto()) { + return FontAutoType.SIZE; + } + if (isFontColorAuto()) { + return FontAutoType.COLOR; + } + return FontAutoType.NONE; } - protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ - return TableLayoutHelper.createTableLayoutPane(comps,row,col); + protected ChartTextAttrPane initTextFontPane() { + return new ChartTextAttrPaneWithAuto(getFontAutoType()) { + protected double[] getRowSize() { + double p = TableLayout.PREFERRED; + return new double[]{p, p}; + } + + protected Component[][] getComponents(JPanel buttonPane) { + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + return new Component[][]{ + new Component[]{text, getFontNameComboBox()}, + new Component[]{null, buttonPane} + }; + } + }; + } + + protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { + return TableLayoutHelper.createTableLayoutPane(comps, row, col); } protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { return TableLayout4VanChartHelper.createGapTableLayoutPane(title, panel); } + + protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { + if (hasLabelAlign(plot)) { + + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical"), plot), null}, + new Component[]{createLabelAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")), null}, + new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, + }; + } else { + + return super.getLabelPaneComponents(plot, p, columnSize); + } + } + + private JPanel createLabelAlignPane(String title) { + JPanel panel = new JPanel(new BorderLayout()); + + alignPane = new JPanel(); + checkAlignPane(title); + panel.add(alignPane, BorderLayout.CENTER); + + return panel; + } + + protected void checkAlignPane(String title) { + if (alignPane == null && !hasLabelAlign(getPlot())) { + return; + } + if (alignPane != null && !hasLabelAlign(getPlot())) { + oldAlignValues = null; + alignPane.removeAll(); + return; + } + if (alignPane == null && hasLabelAlign(getPlot())) { + alignPane = new JPanel(); + } + TwoTuple result = getAlignNamesAndValues(); + + String[] names = result.getFirst(); + Integer[] values = result.getSecond(); + if (ComparatorUtils.equals(values, oldAlignValues)) { + return; + } + + oldAlignValues = values; + + align = new UIButtonGroup(names, values); + + Component[][] comps = new Component[2][2]; + + comps[0] = new Component[]{null, null}; + comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), align}; + + double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + + alignPane.removeAll(); + alignPane.setLayout(new BorderLayout()); + alignPane.add(getLabelPositionPane(comps, row, col), BorderLayout.CENTER); + + if (parent != null) { + parent.initListener(alignPane); + } + } + + private TwoTuple getAlignNamesAndValues() { + String[] names = new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow"), Toolkit.i18nText("Fine-Design_Chart_Align_Left"), Toolkit.i18nText("Fine-Design_Chart_Align_Right")}; + Integer[] values = new Integer[]{ChartConstants.AUTO_LABEL_POSITION, Constants.LEFT, Constants.RIGHT}; + + return new TwoTuple<>(names, values); + } + + protected Component[][] getLabelStyleComponents(Plot plot) { + return new Component[][]{ + new Component[]{textFontPane, null}, + }; + } + + protected void checkPane() { + String verticalTitle = hasLabelAlign(getPlot()) + ? Toolkit.i18nText("Fine-Design_Chart_Layout_Vertical") + : Toolkit.i18nText("Fine-Design_Chart_Layout_Position"); + + checkPositionPane(verticalTitle); + checkAlignPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Horizontal")); + } + + protected void checkStyleUse() { + textFontPane.setVisible(true); + textFontPane.setPreferredSize(new Dimension(0, TEXT_FONT_PANE_HEIGHT)); + } + + protected boolean hasLabelAlign(Plot plot) { + return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); + } + + public void populate(AttrLabelDetail detail) { + super.populate(detail); + + style.setSelectedIndex(1); + if (hasLabelAlign(this.getPlot()) && align != null) { + align.setSelectedItem(detail.getAlign()); + } + } + + public void update(AttrLabelDetail detail) { + super.update(detail); + + detail.setCustom(true); + if (align != null) { + if (align.getSelectedItem() != null) { + detail.setAlign(align.getSelectedItem()); + } else { + align.setSelectedItem(detail.getAlign()); + } + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java index 42e6909e9f..0f81deefca 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java @@ -7,6 +7,7 @@ import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.design.i18n.Toolkit; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -28,16 +29,14 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { labelDetailPane = new VanChartGaugeCateOrPercentLabelDetailPane(this.plot, this.parent); gaugeValueLabelPane = new VanChartGaugeValueLabelDetailPane(this.plot, this.parent); GaugeStyle gaugeStyle = ((VanChartGaugePlot)this.plot).getGaugeStyle(); - String cateTitle, valueTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Label"); + String cateTitle, valueTitle = Toolkit.i18nText("Fine-Design_Chart_Value_Label"); switch (gaugeStyle){ case POINTER: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Label"); - break; case POINTER_SEMI: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Label"); + cateTitle = Toolkit.i18nText("Fine-Design_Chart_Category_Label"); break; default: - cateTitle = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); + cateTitle = Toolkit.i18nText("Fine-Design_Chart_Percent_Label"); break; } JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, labelDetailPane); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java index 1d66925554..01a21d3823 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeValueLabelDetailPane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.designer.style.label; import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.label.LabelContentPaneWithCateValue; @@ -17,24 +16,13 @@ import java.awt.Component; public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailPane { private static final long serialVersionUID = 2601073419430634281L; - private GaugeStyle gaugeStyle; - public VanChartGaugeValueLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } - private void initGaugeStyle(Plot plot) { - if(gaugeStyle == null){ - gaugeStyle = ((VanChartGaugePlot)plot).getGaugeStyle(); - } - } - protected void initToolTipContentPane(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); - break; case POINTER_SEMI: dataLabelContentPane = new LabelContentPaneWithOutCate(parent, VanChartGaugeValueLabelDetailPane.this); break; @@ -45,10 +33,8 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - return getLabelPaneComponentsWithBackground(plot, p, columnSize); case POINTER_SEMI: return getLabelPaneComponentsWithBackground(plot, p, columnSize); default: @@ -57,43 +43,32 @@ public class VanChartGaugeValueLabelDetailPane extends VanChartGaugeLabelDetailP } private Component[][] getLabelPaneComponentsWithBackground(Plot plot, double p, double[] columnSize) { - return new Component[][]{ - new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot),null}, - new Component[]{createBackgroundColorPane(),null}, + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelStylePane(new double[]{p}, columnSize, plot), null}, + new Component[]{createBackgroundColorPane(), null}, }; } protected double[] getLabelPaneRowSize(Plot plot, double p) { - initGaugeStyle(plot); - switch (gaugeStyle){ + switch (getGaugeStyle()) { case POINTER: - return new double[]{p,p,p,p,p}; case POINTER_SEMI: - return new double[]{p,p,p,p,p}; + return new double[]{p, p, p, p, p}; default: return super.getLabelPaneRowSize(plot, p); } } + protected boolean isFontSizeAuto() { + return getGaugeStyle() != GaugeStyle.THERMOMETER; + } + protected boolean hasLabelPosition(Plot plot) { - initGaugeStyle(plot); - switch (gaugeStyle){ - case THERMOMETER: - return true; - default: - return false; - } + return getGaugeStyle() == GaugeStyle.THERMOMETER; } protected JPanel createTableLayoutPaneWithTitle(String title, Component component) { return TableLayout4VanChartHelper.createTableLayoutPaneWithSmallTitle(title, component); } - - protected Component[][] getLabelStyleComponents(Plot plot) { - return new Component[][]{ - new Component[]{textFontPane,null}, - }; - } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index b774de89ea..c506d89ea1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -11,6 +11,7 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; @@ -58,13 +59,20 @@ public class VanChartPlotLabelDetailPane extends BasicPane { public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { this.parent = parent; this.plot = plot; + initLabelDetailPane(plot); + } + protected void initLabelDetailPane (Plot plot) { this.setLayout(new BorderLayout()); initToolTipContentPane(plot); JPanel contentPane = createLabelPane(plot); this.add(contentPane,BorderLayout.CENTER); } + public Plot getPlot() { + return plot; + } + //默认从factory中取 protected void initToolTipContentPane(Plot plot) { dataLabelContentPane = PlotFactory.createPlotLabelContentPane(plot, parent, VanChartPlotLabelDetailPane.this); @@ -85,7 +93,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(hasLabelPosition(plot)){ return new Component[][]{ new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelPositionPane(new double[]{p,p,p}, columnSize, plot),null}, + new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}, new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, }; } else { @@ -112,7 +120,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); } - private TwoTuple getPositionNamesAndValues() { + protected TwoTuple getPositionNamesAndValues() { if (plot instanceof VanChartLabelPositionPlot) { String[] names = ((VanChartLabelPositionPlot) plot).getLabelLocationNameArray(); @@ -130,33 +138,33 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return null; } - private JPanel createLabelPositionPane(double[] row, double[] col, Plot plot) { + protected JPanel createLabelPositionPane(String title, Plot plot) { if (getPositionNamesAndValues() == null) { return new JPanel(); } - autoAdjust = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + autoAdjust = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); JPanel panel = new JPanel(new BorderLayout()); positionPane = new JPanel(); - checkPositionPane(); + checkPositionPane(title); panel.add(positionPane, BorderLayout.CENTER); if (plot.isSupportLeadLine()) { - tractionLine = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); + tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("", tractionLine); panel.add(tractionLinePane, BorderLayout.SOUTH); initPositionListener(); } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { - panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); + panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); } return panel; } - private void checkPositionPane() { + protected void checkPositionPane(String title) { if (positionPane == null) { return; } @@ -176,7 +184,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { Component[][] comps = new Component[2][2]; comps[0] = new Component[]{null, null}; - comps[1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), SwingConstants.LEFT), position}; + comps[1] = new Component[]{new UILabel(title, SwingConstants.LEFT), position}; double[] row = new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] col = new double[]{TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; @@ -193,7 +201,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); } @@ -207,14 +215,14 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), + Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane =initTextFontPane(); initStyleListener(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot),row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } protected ChartTextAttrPane initTextFontPane () { @@ -222,7 +230,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{null, fontNameComboBox}, + new Component[]{null, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } @@ -230,7 +238,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected Component[][] getLabelStyleComponents(Plot plot) { - UILabel text = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ new Component[]{null,null}, new Component[]{text,style}, @@ -249,7 +257,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel createBackgroundColorPane() { backgroundColor = new ColorSelectBox(100); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); + return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundColor); } protected String title4PopupWindow() { @@ -264,7 +272,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { checkPositionEnabled(); } - private void checkStyleUse() { + protected void checkStyleUse() { textFontPane.setVisible(style.getSelectedIndex() == 1); textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); } @@ -277,9 +285,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane { tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); } - public void populate(AttrLabelDetail detail) { - checkPositionPane(); + protected void checkPane(){ + checkPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")); + } + public void populate(AttrLabelDetail detail) { + checkPane(); dataLabelContentPane.populateBean(detail.getContent()); if(position != null){ position.setSelectedItem(detail.getPosition()); @@ -306,7 +317,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if(position != null && position.getSelectedItem() != null){ detail.setPosition(position.getSelectedItem()); - + } else if(position != null){ position.setSelectedItem(detail.getPosition()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index efc91258a0..9b912ee9f7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java @@ -8,26 +8,22 @@ import com.fr.chart.base.AttrBorder; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; -import com.fr.chart.chartglyph.ConditionCollection; import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.style.ChartFillStylePane; import com.fr.design.mainframe.chart.gui.style.series.AbstractPlotSeriesPane; - import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.attr.radius.VanChartRadiusPlot; import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; -import com.fr.plugin.chart.base.AttrEffect; import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrTrendLine; -import com.fr.plugin.chart.map.line.condition.AttrLineEffect; -import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; import com.fr.van.chart.custom.style.VanChartCustomStylePane; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane; import com.fr.van.chart.designer.component.VanChartBeautyPane; @@ -36,6 +32,7 @@ import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.VanChartTrendLinePane; import com.fr.van.chart.designer.component.border.VanChartBorderPane; +import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.pie.RadiusCardLayoutPane; import javax.swing.BorderFactory; @@ -73,11 +70,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP private RadiusCardLayoutPane radiusPane;//半径设置界面 private JPanel radiusPaneWithTitle; + //大数据模式 恢复用注释。下面1行删除。 private UIButtonGroup largeDataModelGroup;//大数据模式 protected JPanel contentPane; - public VanChartAbstractPlotSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartAbstractPlotSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -110,17 +108,17 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } //获取颜色面板 - protected JPanel getColorPane () { + protected JPanel getColorPane() { JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); setColorPaneContent(panel); - JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"), panel); - panel.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); + JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + panel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); return panel.getComponentCount() == 0 ? null : colorPane; } //设置色彩面板内容 - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { if (stylePane != null) { panel.add(stylePane, BorderLayout.CENTER); } @@ -129,13 +127,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //趋势线 protected JPanel createTrendLinePane() { trendLinePane = new VanChartTrendLinePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TrendLine"), trendLinePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_TrendLine"), trendLinePane); } //线 protected JPanel createLineTypePane() { lineTypePane = getLineTypePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line"), lineTypePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Line"), lineTypePane); } protected VanChartLineTypePane getLineTypePane() { @@ -145,29 +143,30 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //标记点类型 protected JPanel createMarkerPane() { markerPane = new VanChartMarkerPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); } //填充颜色 protected JPanel createAreaFillColorPane() { areaSeriesFillColorPane = new VanChartAreaSeriesFillColorPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area"), areaSeriesFillColorPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Area"), areaSeriesFillColorPane); } //边框(默认没有圆角) protected JPanel createBorderPane() { borderPane = createDiffBorderPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); } //半径界面 - protected JPanel createRadiusPane() { + protected JPanel createRadiusPane(String title) { radiusPane = initRadiusPane(); - radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radius_Set"), radiusPane); - return ((VanChartPlot)plot).isInCustom() ? null : radiusPaneWithTitle; + radiusPaneWithTitle = TableLayout4VanChartHelper.createGapTableLayoutPane(title, radiusPane); + return ((VanChartPlot) plot).isInCustom() ? null : radiusPaneWithTitle; } + //大数据模式 恢复用注释。删除下面4个方法 createLargeDataModelPane checkLarge createLargeDataModelPane createLargeDataModelGroup。 protected JPanel createLargeDataModelPane() { largeDataModelGroup = createLargeDataModelGroup(); largeDataModelGroup.addChangeListener(new ChangeListener() { @@ -176,12 +175,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkLarge(); } }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Large_Model"), largeDataModelGroup); return createLargeDataModelPane(panel); } protected void checkLarge() { - if(largeModel()) { + if (largeModel(plot)) { AttrLabel attrLabel = ((VanChartPlot) plot).getAttrLabelFromConditionCollection(); if (attrLabel == null) { attrLabel = ((VanChartPlot) this.plot).getDefaultAttrLabel(); @@ -190,56 +189,45 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } attrLabel.setEnable(false); - resetCustomCondition(plot.getConditionCollection()); + VanChartInteractivePane.resetCustomCondition(plot.getConditionCollection()); } - checkCompsEnabledWithLarge(); + checkCompsEnabledWithLarge(plot); } - protected void checkCompsEnabledWithLarge() { - if(markerPane != null && largeDataModelGroup != null){ - markerPane.checkLargePlot(largeModel()); - } + protected JPanel createLargeDataModelPane(JPanel jPanel) { + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); + return panel; } - protected void checkLinePane() { - if(lineTypePane != null && largeDataModelGroup != null){ - lineTypePane.checkLarge(largeModel()); - } + protected UIButtonGroup createLargeDataModelGroup() { + String[] strings = new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}; + DataProcessor[] values = new DataProcessor[]{new LargeDataModel(), new NormalDataModel()}; + return new UIButtonGroup(strings, values); } - - protected boolean largeModel() { - return largeDataModelGroup != null && largeDataModelGroup.getSelectedIndex() == 0; + protected void checkCompsEnabledWithLarge(Plot plot) { + if (markerPane != null) { + markerPane.checkLargePlot(largeModel(plot)); + } } - protected void resetCustomCondition(ConditionCollection conditionCollection) { - for(int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++){ - ConditionAttr conditionAttr = conditionCollection.getConditionAttr(i); - conditionAttr.remove(AttrLabel.class); - conditionAttr.remove(ScatterAttrLabel.class); - conditionAttr.remove(AttrEffect.class); - conditionAttr.remove(AttrLineEffect.class); - - VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); - if(attrMarker != null && !attrMarker.isCommon()){ - conditionAttr.remove(VanChartAttrMarker.class); - } + protected void checkLinePane() { + if (lineTypePane != null) { + lineTypePane.checkLarge(largeModel(plot)); } } - protected JPanel createLargeDataModelPane(JPanel jPanel) { - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Data"), jPanel); - return panel; - } - protected UIButtonGroup createLargeDataModelGroup() { - String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; - DataProcessor[] values = new DataProcessor[]{new LargeDataModel(), new NormalDataModel()}; - return new UIButtonGroup(strings, values); + protected boolean largeModel(Plot plot) { + //大数据模式 恢复用注释。下面1行删除。 + return largeDataModelGroup != null && largeDataModelGroup.getSelectedIndex() == 0; + //大数据模式 恢复用注释。取消注释。 + //return PlotFactory.largeDataModel(plot); } + protected RadiusCardLayoutPane initRadiusPane() { return new RadiusCardLayoutPane(); } @@ -252,13 +240,13 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP //不透明度 protected JPanel createAlphaPane() { transparent = new UINumberDragPane(0, 100); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), transparent); } //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(); - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } @@ -272,7 +260,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP * 更新Plot的属性到系列界面 */ public void populateBean(Plot plot) { - if(plot == null) { + if (plot == null) { return; } @@ -280,24 +268,25 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP super.populateBean(plot);//配色 - if(stylePane != null){//风格 + if (stylePane != null) {//风格 stylePane.populateBean(plot.getPlotStyle()); } - if(largeDataModelGroup != null){ + //大数据模式 恢复用注释。下面3行删除。 + if (largeDataModelGroup != null) { largeDataModelGroup.setSelectedItem(plot.getDataProcessor()); } - if(stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot){//堆积和坐标轴 - VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot; - if(rectanglePlot.isCustomChart()){ + if (stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot) {//堆积和坐标轴 + VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; + if (rectanglePlot.isCustomChart()) { stackAndAxisEditPane.populate(rectanglePlot); } else { removeStackWholePane(); } } - if(radiusPane != null && plot instanceof VanChartRadiusPlot){ + if (radiusPane != null && plot instanceof VanChartRadiusPlot) { radiusPane.populateBean(plot); checkRadiusPane(plot); } @@ -306,17 +295,18 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkAreaSeriesFillColorPane(plot.getPlotStyle()); - checkCompsEnabledWithLarge(); + checkCompsEnabledWithLarge(plot); } /** * radius界面是否显示 + * * @param plot */ private void checkRadiusPane(Plot plot) { radiusPaneWithTitle.setVisible(true); - if (plot instanceof VanChartPlot){ - if (((VanChartPlot) plot).isInCustom()){ + if (plot instanceof VanChartPlot) { + if (((VanChartPlot) plot).isInCustom()) { radiusPaneWithTitle.setVisible(false); } } @@ -326,7 +316,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP * 保存 系列界面的属性到Plot */ public void updateBean(Plot plot) { - if(plot == null) { + if (plot == null) { return; } @@ -335,22 +325,23 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP super.updateBean(plot);//配色 - if(stylePane != null){//风格 + if (stylePane != null) {//风格 plot.setPlotStyle(stylePane.updateBean()); } - if(largeDataModelGroup != null){ + //大数据模式 恢复用注释。下面3行删除。 + if (largeDataModelGroup != null) { plot.setDataProcessor(largeDataModelGroup.getSelectedItem()); } - if(stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot){//堆积和坐标轴 - VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)plot; - if(rectanglePlot.isCustomChart()){ + if (stackAndAxisEditPane != null && plot instanceof VanChartRectanglePlot) {//堆积和坐标轴 + VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; + if (rectanglePlot.isCustomChart()) { stackAndAxisEditPane.update(rectanglePlot); } } - if (radiusPane != null && plot instanceof VanChartRadiusPlot){ + if (radiusPane != null && plot instanceof VanChartRadiusPlot) { radiusPane.updateBean(plot); checkRadiusPane(plot); } @@ -360,47 +351,47 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP checkAreaSeriesFillColorPane(plot.getPlotStyle()); } - protected void checkoutMapType(Plot plot){ + protected void checkoutMapType(Plot plot) { } - protected void checkAreaSeriesFillColorPane(int plotStyle){ + protected void checkAreaSeriesFillColorPane(int plotStyle) { if (areaSeriesFillColorPane != null) { areaSeriesFillColorPane.checkoutAlpha(plotStyle == ChartConstants.STYLE_NONE); } } - protected void populateCondition(ConditionAttr defaultAttr){ - if(trendLinePane != null){//趋势线 - VanChartAttrTrendLine attrTrendLine =(VanChartAttrTrendLine)defaultAttr.getExisted(VanChartAttrTrendLine.class); + protected void populateCondition(ConditionAttr defaultAttr) { + if (trendLinePane != null) {//趋势线 + VanChartAttrTrendLine attrTrendLine = defaultAttr.getExisted(VanChartAttrTrendLine.class); trendLinePane.populate(attrTrendLine); } - if(lineTypePane != null){//线-线型、控制断开等 - VanChartAttrLine attrLine = (VanChartAttrLine)defaultAttr.getExisted(VanChartAttrLine.class); + if (lineTypePane != null) {//线-线型、控制断开等 + VanChartAttrLine attrLine = defaultAttr.getExisted(VanChartAttrLine.class); lineTypePane.populate(attrLine); } - if(markerPane != null){//标记点 - VanChartAttrMarker attrMarker = (VanChartAttrMarker)defaultAttr.getExisted(VanChartAttrMarker.class); + if (markerPane != null) {//标记点 + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); markerPane.populate(attrMarker); } - if(areaSeriesFillColorPane != null){//填充颜色 - AttrAreaSeriesFillColorBackground seriesFillColorBackground = (AttrAreaSeriesFillColorBackground)defaultAttr.getExisted(AttrAreaSeriesFillColorBackground.class); + if (areaSeriesFillColorPane != null) {//填充颜色 + AttrAreaSeriesFillColorBackground seriesFillColorBackground = defaultAttr.getExisted(AttrAreaSeriesFillColorBackground.class); areaSeriesFillColorPane.populate(seriesFillColorBackground); } - if(borderPane != null){//边框 - AttrBorder attrBorder = (AttrBorder)defaultAttr.getExisted(AttrBorder.class); - if(attrBorder != null){ + if (borderPane != null) {//边框 + AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); + if (attrBorder != null) { borderPane.populate(attrBorder); } } populateAlpha(defaultAttr); } - protected void populateAlpha(ConditionAttr defaultAttr){ - if(transparent != null){//不透明度 - AttrAlpha attrAlpha = (AttrAlpha)defaultAttr.getExisted(AttrAlpha.class); - if(attrAlpha != null){ + protected void populateAlpha(ConditionAttr defaultAttr) { + if (transparent != null) {//不透明度 + AttrAlpha attrAlpha = defaultAttr.getExisted(AttrAlpha.class); + if (attrAlpha != null) { transparent.populateBean(attrAlpha.getAlpha() * VanChartAttrHelper.PERCENT); } else { //初始值为100 @@ -409,35 +400,35 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } } - protected void updateCondition(ConditionAttr defaultAttr){ - if(trendLinePane != null){ + protected void updateCondition(ConditionAttr defaultAttr) { + if (trendLinePane != null) { VanChartAttrTrendLine newTrendLine = trendLinePane.update(); - VanChartAttrTrendLine attrTrendLine =(VanChartAttrTrendLine)defaultAttr.getExisted(VanChartAttrTrendLine.class); + VanChartAttrTrendLine attrTrendLine = defaultAttr.getExisted(VanChartAttrTrendLine.class); defaultAttr.remove(attrTrendLine); defaultAttr.addDataSeriesCondition(newTrendLine); } - if(lineTypePane != null){ - VanChartAttrLine attrLine = (VanChartAttrLine)defaultAttr.getExisted(VanChartAttrLine.class); + if (lineTypePane != null) { + VanChartAttrLine attrLine = defaultAttr.getExisted(VanChartAttrLine.class); defaultAttr.remove(attrLine); defaultAttr.addDataSeriesCondition(lineTypePane.update()); } - if(markerPane != null){ + if (markerPane != null) { VanChartAttrMarker newMarker = markerPane.update(); - VanChartAttrMarker attrMarker = (VanChartAttrMarker)defaultAttr.getExisted(VanChartAttrMarker.class); + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); defaultAttr.remove(attrMarker); defaultAttr.addDataSeriesCondition(newMarker); } - if(areaSeriesFillColorPane != null){ + if (areaSeriesFillColorPane != null) { AttrAreaSeriesFillColorBackground newFillColorBackground = areaSeriesFillColorPane.update(); AttrAreaSeriesFillColorBackground oldFillColorBackground = defaultAttr.getExisted(AttrAreaSeriesFillColorBackground.class); - if(oldFillColorBackground != null){ + if (oldFillColorBackground != null) { defaultAttr.remove(oldFillColorBackground); } defaultAttr.addDataSeriesCondition(newFillColorBackground); } - if(borderPane != null){ - AttrBorder attrBorder = (AttrBorder)defaultAttr.getExisted(AttrBorder.class); - if(attrBorder == null){ + if (borderPane != null) { + AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); + if (attrBorder == null) { attrBorder = new AttrBorder(); defaultAttr.addDataSeriesCondition(attrBorder); } @@ -446,14 +437,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP updateAlpha(defaultAttr); } - protected void updateAlpha(ConditionAttr defaultAttr){ - if(transparent != null){ - AttrAlpha attrAlpha = (AttrAlpha)defaultAttr.getExisted(AttrAlpha.class); - if(attrAlpha == null){ + protected void updateAlpha(ConditionAttr defaultAttr) { + if (transparent != null) { + AttrAlpha attrAlpha = defaultAttr.getExisted(AttrAlpha.class); + if (attrAlpha == null) { attrAlpha = new AttrAlpha(); defaultAttr.addDataSeriesCondition(attrAlpha); } - attrAlpha.setAlpha((float)(transparent.updateBean()/VanChartAttrHelper.PERCENT)); + attrAlpha.setAlpha((float) (transparent.updateBean() / VanChartAttrHelper.PERCENT)); } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java index e3f45a9c0a..1c3ed4aa53 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartPlotTooltipPane.java @@ -4,7 +4,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; @@ -52,7 +52,7 @@ public class VanChartPlotTooltipPane extends BasicPane { } protected void addComponents(Plot plot) { - isTooltipShow = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); + isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip")); tooltipPane = createTooltipPane(plot); double p = TableLayout.PREFERRED; @@ -96,8 +96,8 @@ public class VanChartPlotTooltipPane extends BasicPane { Component[][] components = new Component[][]{ new Component[]{tooltipContentPane,null}, new Component[]{createLabelStylePane(),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{createDisplayStrategy(plot),null}, }; return components; @@ -109,25 +109,25 @@ public class VanChartPlotTooltipPane extends BasicPane { } protected JPanel createLabelStylePane() { - style = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); + style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),Toolkit.i18nText("Fine-Design_Chart_Custom")}); textFontPane = new ChartTextAttrPane() { protected Component[][] getComponents(JPanel buttonPane) { return new Component[][]{ new Component[]{null, null}, - new Component[]{null, fontNameComboBox}, + new Component[]{null, getFontNameComboBox()}, new Component[]{null, buttonPane} }; } }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Character"), style); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Character"), style); JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(panel, BorderLayout.CENTER); panel1.add(textFontPane, BorderLayout.SOUTH); initStyleListener(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel1); } @@ -142,8 +142,8 @@ public class VanChartPlotTooltipPane extends BasicPane { protected JPanel createDisplayStrategy(Plot plot) { showAllSeries = new UICheckBox(getShowAllSeriesLabelText()); - followMouse = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Follow_Mouse")}); + followMouse = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Follow_Mouse"), + Toolkit.i18nText("Fine-Design_Chart_Not_Follow_Mouse")}); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -151,17 +151,17 @@ public class VanChartPlotTooltipPane extends BasicPane { double[] rowSize = { p,p,p}; Component[][] components = new Component[3][2]; components[0] = new Component[]{null,null}; - components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; + components[1] = new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Prompt_Box")), UIComponentUtils.wrapWithBorderLayoutPane(followMouse)}; if(plot.isSupportTooltipSeriesType() && hasTooltipSeriesType()){ components[2] = new Component[]{showAllSeries,null}; } JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel); } protected String getShowAllSeriesLabelText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"); + return Toolkit.i18nText("Fine-Design_Chart_Show_All_Series"); }; protected boolean hasTooltipSeriesType() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index 1a0953266f..36f34c9953 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -7,6 +7,10 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.chartglyph.DataSheet; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.MultilineLabel; @@ -110,6 +114,18 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane initPaneList() { List paneList = new ArrayList(); - if(layerPane != null) { + if (layerPane != null) { paneList.add(layerPane); } - if(dataPane != null) { + if (dataPane != null) { paneList.add(dataPane); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java index 4f5ab5e21d..322d46972a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java @@ -7,14 +7,14 @@ import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; - import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.map.designer.data.MapDataPaneHelper; -import java.awt.*; import java.util.ArrayList; import java.util.List; +import java.awt.BorderLayout; /** * Created by Mitisky on 16/6/20. @@ -28,7 +28,7 @@ public class DrillMapDataPane extends BasicBeanPane { private ChartDataPane parent; - public DrillMapDataPane(final AttributeChangeListener listener,final ChartDataPane parent) { + public DrillMapDataPane(final AttributeChangeListener listener, final ChartDataPane parent) { this.parent = parent; bottomDataDefinitionPane = new SingleLayerDataDefinitionPane(listener, parent); eachLayerDataDefinitionPane = new EachLayerDataDefinitionPane(listener, parent); @@ -78,7 +78,8 @@ public class DrillMapDataPane extends BasicBeanPane { dataDefinitionType.setSelectedIndex(MapDataPaneHelper.isFromBottomData(ob) ? 0 : 1); ChartCollection bottomDataChartCollection = MapDataPaneHelper.getBottomDataDrillMapChartCollection(ob); - bottomDataDefinitionPane.populateBean(bottomDataChartCollection); + + bottomDataDefinitionPane.populateBean(bottomDataChartCollection, ChartGEOJSONHelper.BOTTOM_LEVEL); eachLayerDataDefinitionPane.populateBean(ob); parent.initAllListeners(); @@ -95,11 +96,11 @@ public class DrillMapDataPane extends BasicBeanPane { @Override public void updateBean(ChartCollection ob) { DrillMapDefinition drillMapDefinition = MapDataPaneHelper.getDrillMapDefinition(ob); - if(drillMapDefinition == null){ + if (drillMapDefinition == null) { drillMapDefinition = new DrillMapDefinition(); ob.getSelectedChart().setFilterDefinition(drillMapDefinition); } - if(dataDefinitionType.getSelectedIndex() == 0){ + if (dataDefinitionType.getSelectedIndex() == 0) { drillMapDefinition.setFromBottomData(true); ChartCollection temp = new ChartCollection(new Chart()); bottomDataDefinitionPane.updateBean(temp); diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java index 6fd6ecabbc..0c6fcc1e4c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java @@ -7,9 +7,9 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; - import com.fr.plugin.chart.drillmap.DrillMapHelper; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; @@ -19,10 +19,11 @@ import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.tree.DefaultMutableTreeNode; -import java.awt.BorderLayout; -import java.awt.Component; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by Mitisky on 16/6/20. @@ -125,6 +126,7 @@ public class DrillMapLayerPane extends BasicScrollPane { if (drillMapPlot != null) { java.util.List levelList = drillMapPlot.getLayerLevelList(); java.util.List mapTypeList = drillMapPlot.getLayerMapTypeList(); + List matchResultList = drillMapPlot.getMatchResultList(); if (detailComps == null || drillMapPlot.getMapType() != oldMapType || !ComparatorUtils.equals(drillMapPlot.getGeoUrl(), oldGeoUrl)) { oldMapType = drillMapPlot.getMapType(); @@ -151,6 +153,11 @@ public class DrillMapLayerPane extends BasicScrollPane { mapTypeList.add(mapType); } + int matchSize = matchResultList.size(); + for (int k = matchSize; k < depth; k++) { + matchResultList.add(new MapMatchResult()); + } + for (int i = 0; i < depth; i++) { Component[] components = detailComps[i + 1]; if (components != null) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java index 3a688dcfb7..37e7f823f0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java @@ -8,7 +8,6 @@ import com.fr.design.dialog.MultiTabPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.general.ComparatorUtils; - import com.fr.plugin.chart.drillmap.DrillMapHelper; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; @@ -17,9 +16,9 @@ import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.map.designer.data.MapDataPaneHelper; import javax.swing.tree.DefaultMutableTreeNode; -import java.awt.*; import java.util.ArrayList; import java.util.List; +import java.awt.CardLayout; /** * Created by Mitisky on 16/6/20. @@ -38,7 +37,7 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { cardLayout = new CardLayout(); } - private void initComponents(){ + private void initComponents() { super.relayoutWhenListChange(); } @@ -56,7 +55,7 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { protected List initPaneList() { List paneList = new ArrayList(); - for(int i = 1; i < depth + 1; i++){ + for (int i = 1; i < depth + 1; i++) { String tile = String.format("%s%d%s", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Article"), i, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Layer")); SingleLayerDataDefinitionPane pane = new SingleLayerDataDefinitionPane(tile, this.listener, this.parent); @@ -70,10 +69,10 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { @Override public void populateBean(ChartCollection ob) { VanChartDrillMapPlot drillMapPlot = DrillMapHelper.getDrillMapPlot(ob); - if(drillMapPlot == null){ + if (drillMapPlot == null) { return; } - if(!ComparatorUtils.equals(oldGeoUrl, drillMapPlot.getGeoUrl())) { + if (!ComparatorUtils.equals(oldGeoUrl, drillMapPlot.getGeoUrl())) { oldGeoUrl = drillMapPlot.getGeoUrl(); DefaultMutableTreeNode root = CompatibleGeoJSONTreeHelper.getNodeByJSONPath(oldGeoUrl); if (root == null) { @@ -90,13 +89,13 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { populatePaneList(ob); } - private void populatePaneList(ChartCollection chartCollection){ - for(int i = 0, len = paneList.size(); i < len; i++){ + private void populatePaneList(ChartCollection chartCollection) { + for (int i = 0, len = paneList.size(); i < len; i++) { BasicPane basicPane = paneList.get(i); MapType mapType = oldMapList.get(i); - if(basicPane instanceof SingleLayerDataDefinitionPane){ + if (basicPane instanceof SingleLayerDataDefinitionPane) { ChartCollection clone = MapDataPaneHelper.getLayerChartCollection(chartCollection, i, mapType); - ((SingleLayerDataDefinitionPane) basicPane).populateBean(clone); + ((SingleLayerDataDefinitionPane) basicPane).populateBean(clone, i); } } } @@ -113,8 +112,8 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { public void updateBean(ChartCollection ob) { DrillMapDefinition drillMapDefinition = MapDataPaneHelper.getDrillMapDefinition(ob); List eachLayerDataDefinitionList = new ArrayList(); - for(BasicPane basicPane : paneList){ - if(basicPane instanceof SingleLayerDataDefinitionPane){ + for (BasicPane basicPane : paneList) { + if (basicPane instanceof SingleLayerDataDefinitionPane) { ChartCollection temp = new ChartCollection(new Chart()); ((SingleLayerDataDefinitionPane) basicPane).updateBean(temp); eachLayerDataDefinitionList.add(temp.getSelectedChart().getFilterDefinition()); @@ -159,11 +158,11 @@ public class EachLayerDataDefinitionPane extends MultiTabPane { * @param supportCellData */ public void setSupportCellData(boolean supportCellData) { - if(paneList == null){ + if (paneList == null) { return; } - for(BasicPane basicPane : paneList){ - if(basicPane instanceof SingleLayerDataDefinitionPane){ + for (BasicPane basicPane : paneList) { + if (basicPane instanceof SingleLayerDataDefinitionPane) { ((SingleLayerDataDefinitionPane) basicPane).setSupportCellData(supportCellData); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java index 5ec0e1f4a4..16906845e7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java @@ -6,7 +6,6 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; - import java.awt.BorderLayout; /** @@ -79,6 +78,11 @@ public class SingleLayerDataDefinitionPane extends FurtherBasicBeanPane()); drillMapPlot.setLayerMapTypeList(new ArrayList()); } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + return definition instanceof DrillMapDefinition; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java index 5496959700..2899a9e117 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/FunnelIndependentVanChartInterface.java @@ -90,4 +90,15 @@ public class FunnelIndependentVanChartInterface extends AbstractIndependentVanCh return "com/fr/design/images/form/toolbar/funnel.png"; } + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new FunnelDataSetFieldsPane(), new FunnelCellDataFieldsPane()); +// } +// }; +// +// } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/type/VanChartFunnelTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/type/VanChartFunnelTypePane.java index 884f211002..444f9a4d80 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/type/VanChartFunnelTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/type/VanChartFunnelTypePane.java @@ -2,7 +2,12 @@ package com.fr.van.chart.funnel.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.funnel.FunnelIndependentVanChart; import com.fr.plugin.chart.funnel.VanChartFunnelPlot; @@ -43,4 +48,13 @@ public class VanChartFunnelTypePane extends AbstractVanChartTypePane { public Chart getDefaultChart() { return FunnelIndependentVanChart.FunnelVanChartTypes[0]; } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if (definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + return columnFieldCollection.getClass().equals(ColumnFieldCollectionWithSeriesValue.class); + } + return false; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/type/VanChartGanttPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/type/VanChartGanttPlotPane.java index 367041ae0c..5e63dab7ae 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/type/VanChartGanttPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/type/VanChartGanttPlotPane.java @@ -2,7 +2,10 @@ package com.fr.van.chart.gantt.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.GanttChartDataDefinition; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.gantt.GanttIndependentVanChart; import com.fr.plugin.chart.gantt.VanChartGanttPlot; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; @@ -21,16 +24,21 @@ public class VanChartGanttPlotPane extends AbstractVanChartTypePane { return GanttIndependentVanChart.ganttVanChartTypes[0]; } - protected Plot getSelectedClonedPlot(){ + protected Plot getSelectedClonedPlot() { Chart chart = getDefaultChart(); VanChartGanttPlot newPlot = (VanChartGanttPlot) chart.getPlot(); Plot cloned = null; try { - cloned = (Plot)newPlot.clone(); + cloned = (Plot) newPlot.clone(); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return cloned; } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + return definition instanceof GanttChartDataDefinition; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java index af4aa2c8ff..1e7a6fb322 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/GaugeIndependentVanChartInterface.java @@ -64,10 +64,10 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha return new VanChartGaugePlotPane(); } - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ - if(plot instanceof VanChartGaugePlot){ - VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot; - switch (gaugePlot.getGaugeStyle()){ + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + if (plot instanceof VanChartGaugePlot) { + VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot; + switch (gaugePlot.getGaugeStyle()) { case POINTER: return gaugePlot.isInCustom() ? new CategoryCustomPlotTableDataContentPane(parent) : new CategoryPlotTableDataContentPane(parent); case POINTER_SEMI: @@ -76,13 +76,13 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha break; } } - return ((VanChartGaugePlot)plot).isInCustom() ? new MeterCustomPlotTableDataContentPane(parent) : new MeterPlotTableDataContentPane(parent); + return ((VanChartGaugePlot) plot).isInCustom() ? new MeterCustomPlotTableDataContentPane(parent) : new MeterPlotTableDataContentPane(parent); } - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ - if(plot instanceof VanChartGaugePlot){ - VanChartGaugePlot gaugePlot = (VanChartGaugePlot)plot; - switch (gaugePlot.getGaugeStyle()){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + if (plot instanceof VanChartGaugePlot) { + VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot; + switch (gaugePlot.getGaugeStyle()) { case POINTER: return new CategoryPlotReportDataContentPane(parent); case POINTER_SEMI: @@ -96,15 +96,34 @@ public class GaugeIndependentVanChartInterface extends AbstractIndependentVanCha /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartGaugeStylePane(listener); VanChartOtherPane otherPane = new VanChartOtherPane(); return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartGaugeSeriesPane(parent, plot); } + + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// VanChartGaugePlot gaugePlot = null; +// if (getVanChart() != null) { +// gaugePlot = getVanChart().getPlot(); +// } +// if (gaugePlot != null && !gaugePlot.isMultiPointer()) { +// return new SingleDataPane(new GaugeDataSetFieldsPane(), new GaugeCellDataFieldsPane()); +// } +// return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); +// } +// }; +// } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java index 4ae8606693..1ede3efb39 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugePlotPane.java @@ -2,9 +2,16 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.GaugeColumnFieldCollection; +import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.gauge.GaugeIndependentVanChart; import com.fr.plugin.chart.gauge.VanChartGaugePlot; +import com.fr.plugin.chart.type.GaugeStyle; import com.fr.van.chart.designer.type.AbstractVanChartTypePane; /** @@ -73,4 +80,23 @@ public class VanChartGaugePlotPane extends AbstractVanChartTypePane { } } } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if(definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + GaugeStyle gaugeStyle = ((VanChartGaugePlot) vanChartPlot).getGaugeStyle(); + switch (gaugeStyle) { + case RING: + case SLOT: + case THERMOMETER: + return columnFieldCollection instanceof GaugeColumnFieldCollection; + case POINTER: + case POINTER_SEMI: + default: + return columnFieldCollection instanceof MultiCategoryColumnFieldCollection; + } + } + return false; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index 79509aee25..c4ce90edc7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java @@ -2,8 +2,10 @@ package com.fr.van.chart.gauge; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -11,9 +13,11 @@ import com.fr.design.mainframe.chart.gui.style.series.ColorPickerPaneWithFormula import com.fr.design.mainframe.chart.gui.style.series.UIColorPickerPane; import com.fr.design.style.color.ColorSelectBox; import com.fr.general.ComparatorUtils; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.attr.GaugeDetailStyle; import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.stable.Constants; @@ -46,6 +50,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { private UIColorPickerPane colorPickerPane; + private UISpinner thermometerWidth; + private UINumberDragPane chutePercent; + public VanChartGaugeSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -66,15 +73,26 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { } private JPanel createGaugeLayoutPane() { - gaugeLayout = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"),gaugeLayout); + gaugeLayout = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical")}); + + String title = Toolkit.i18nText("Fine-Design_Report_Page_Setup_Orientation"); + + if (plot instanceof VanChartGaugePlot) { + VanChartGaugePlot gaugePlot = (VanChartGaugePlot) plot; + + if (gaugePlot.getGaugeStyle() == GaugeStyle.THERMOMETER) { + title = Toolkit.i18nText("Fine-Design_Report_Page_Setup_Sort_Orientation"); + } + } + + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(title, gaugeLayout); gaugeLayout.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { changeLabelPosition(); } }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); } private void changeLabelPosition() { @@ -86,13 +104,16 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(attrLabel == null){ return; } + AttrLabelDetail attrLabelDetail = attrLabel.getAttrLabelDetail(); + if(attrLabelDetail == null || attrLabelDetail.getTextAttr() == null){ + return; + } + attrLabelDetail.getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_LABEL_FONT); if(gaugeLayout.getSelectedIndex() == 0){ attrLabel.getAttrLabelDetail().setPosition(Constants.LEFT); - attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_VERTICAL_PERCENT_LABEL_FONT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.LEFT); } else { attrLabel.getAttrLabelDetail().setPosition(Constants.BOTTOM); - attrLabel.getAttrLabelDetail().getTextAttr().setFRFont(VanChartGaugePlot.THERMOMETER_PERCENT_LABEL_FONT); attrLabel.getGaugeValueLabelDetail().setPosition(Constants.BOTTOM); } } @@ -104,10 +125,10 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel centerPanel = TableLayoutHelper.createTableLayoutPane(getDiffComponentsWithGaugeStyle(), row, col); panel.add(centerPanel, BorderLayout.CENTER); if(rotate != null){ - JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); + JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Rotation_Direction"), rotate); panel.add(panel1, BorderLayout.NORTH); } - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } private Component[][] getDiffComponentsWithGaugeStyle() { @@ -119,21 +140,24 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{null, null}, getPaneBackgroundColor(), getInnerPaneBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + getChutePercent() }; case SLOT: return new Component[][]{ new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, + getChutePercent() }; case THERMOMETER: return new Component[][]{ new Component[]{null, null}, getNeedleColor(), getSlotBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null}, + getThermometerWidth() }; default: return new Component[][]{ @@ -142,48 +166,58 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { getHingeBackgroundColor(), getNeedleColor(), getPaneBackgroundColor(), - new Component[]{createRadiusPane(), null} + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} }; } } private Component[] getHingeColor() { hingeColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; } private Component[] getHingeBackgroundColor() { hingeBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge_Background")),hingeBackgroundColor}; } private Component[] getNeedleColor() { needleColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; } private Component[] getPaneBackgroundColor() { paneBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; } private Component[] getSlotBackgroundColor() { slotBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; + } + + private Component[] getThermometerWidth() { + thermometerWidth = new UISpinner(0, Double.MAX_VALUE, 0.1, 10); + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Thermometer_Width")),thermometerWidth}; + } + + private Component[] getChutePercent() { + chutePercent = new UINumberDragPane(0, 100, 1); + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Chute_Percent")),chutePercent}; } private void initRotate() { - rotate = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); + rotate = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_AntiClockWise"), Toolkit.i18nText("Fine-Design_Chart_ClockWise")}); } private Component[] getInnerPaneBackgroundColor() { innerPaneBackgroundColor = new ColorSelectBox(120); - return new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; + return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Pane_Background")),innerPaneBackgroundColor}; } private JPanel createGaugeBandsPane() { colorPickerPane = new ColorPickerPaneWithFormula(parentPane, "meterString"); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); } @@ -218,6 +252,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(innerPaneBackgroundColor != null){ innerPaneBackgroundColor.setSelectObject(detailStyle.getInnerPaneBackgroundColor()); } + if(thermometerWidth != null){ + thermometerWidth.setValue(detailStyle.getThermometerWidth()); + } + if(chutePercent != null){ + chutePercent.populateBean(detailStyle.getChutePercent()); + } colorPickerPane.populateBean(detailStyle.getHotAreaColor()); } @@ -256,6 +296,12 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane { if(innerPaneBackgroundColor != null){ detailStyle.setInnerPaneBackgroundColor(innerPaneBackgroundColor.getSelectObject()); } + if(thermometerWidth != null){ + detailStyle.setThermometerWidth(thermometerWidth.getValue()); + } + if(chutePercent != null){ + detailStyle.setChutePercent(chutePercent.updateBean()); + } colorPickerPane.updateBean(detailStyle.getHotAreaColor()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java similarity index 66% rename from designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java rename to designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java index b4e49606e3..712d3a3b76 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/HeatMapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java @@ -15,13 +15,13 @@ import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.heatmap.designer.other.VanChartHeatMapConditionPane; import com.fr.van.chart.heatmap.designer.style.VanChartHeatMapSeriesPane; import com.fr.van.chart.heatmap.designer.type.VanChartHeatMapTypePane; -import com.fr.van.chart.map.MapIndependentVanChartInterface; +import com.fr.van.chart.map.VanMapChartTypeUI; import com.fr.van.chart.map.designer.style.VanChartMapStylePane; /** * Created by Mitisky on 16/10/20. */ -public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartInterface { +public class VanHeatMapChartTypeUI extends VanMapChartTypeUI { /** * 图标路径 @@ -56,28 +56,48 @@ public class HeatMapIndependentVanChartInterface extends MapIndependentVanChartI return new VanChartHeatMapTypePane(); } + //图表数据结构 恢复用注释。删除下面方法。 @Override - protected boolean areaPlot(Plot plot){ + protected boolean areaPlot(Plot plot) { return false; } - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// PointMapDataSetFieldsPane pointMapDataSetFieldsPane = new PointMapDataSetFieldsPane(); +// pointMapDataSetFieldsPane.setChart(getVanChart()); +// return new SingleDataPane(pointMapDataSetFieldsPane, new PointMapCellDataFieldsPane()); +// } +// }; +// } + + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartHeatMapSeriesPane(parent, plot); } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartHeatMapConditionPane(plot); } /** * 图表的属性界面数组 + * * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartMapStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(){ + VanChartOtherPane otherPane = new VanChartOtherPane() { protected BasicBeanPane createInteractivePane() { - return new VanChartInteractivePaneWithMapZoom(); + return new VanChartInteractivePaneWithMapZoom() { + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } + }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java index 6ffd80055a..43f03a13d3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java @@ -2,8 +2,10 @@ package com.fr.van.chart.heatmap.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.heatmap.HeatMapIndependentVanChart; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; @@ -70,4 +72,9 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane { public Chart getDefaultChart() { return HeatMapIndependentVanChart.HeatMapVanCharts[0]; } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + return false; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java index 21d5b60d37..aea7ace9e5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/line/VanChartLineSeriesPane.java @@ -12,23 +12,24 @@ import java.awt.Component; /** * 折线图的系列界面 */ -public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane{ +public class VanChartLineSeriesPane extends VanChartAbstractPlotSeriesPane { private static final long serialVersionUID = 5595016643808487932L; - public VanChartLineSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartLineSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } - protected JPanel getContentInPlotType(){ + protected JPanel getContentInPlotType() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p,p}; + double[] row = {p, p, p, p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ new Component[]{createLineTypePane()}, new Component[]{createMarkerPane()}, new Component[]{createStackedAndAxisPane()}, + //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLargeDataModelPane()}, new Component[]{createTrendLinePane()}, }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index df23244ccb..fd00a87c87 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -12,7 +12,6 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; - import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.base.AttrBorderWithAlpha; import com.fr.plugin.chart.base.AttrEffect; @@ -30,6 +29,7 @@ import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane; import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane; +import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartEffectPane; import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; @@ -79,6 +79,8 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { //line private VanChartCurvePane curvePane; private VanChartLineMapEffectPane lineMapEffectPane; + + //大数据模式 恢复用注释。下面1行删除。 private UIButtonGroup lineMapLargeDataModelGroup;//大数据模式 private MapType mapType = MapType.AREA; @@ -87,53 +89,71 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { super(parent, plot); } + //大数据模式 恢复用注释。删除下面4个方法 checkLarge lineMapLargeModel checkLineMapLarge createLineMapLargeDataModelPane。 @Override protected void checkLarge() { - if(largeModel()) { - if(plot instanceof VanChartMapPlot) { + if (largeModel(plot)) { + if (plot instanceof VanChartMapPlot) { ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); - AttrMapLabel attrMapLabel = defaultAttr.getExisted(AttrMapLabel.class); - if(attrMapLabel == null){ + AttrMapLabel attrMapLabel = defaultAttr.getExisted(AttrMapLabel.class); + if (attrMapLabel == null) { attrMapLabel = new AttrMapLabel(); defaultAttr.addDataSeriesCondition(attrMapLabel); } attrMapLabel.getPointLabel().setEnable(false); - resetCustomCondition(((VanChartMapPlot) plot).getPointConditionCollection()); + VanChartInteractivePane.resetCustomCondition(((VanChartMapPlot) plot).getPointConditionCollection()); } } - checkPointCompsEnabledWithLarge(); + checkPointCompsEnabledWithLarge(plot); } - protected void checkCompsEnabledWithLarge() { - checkPointCompsEnabledWithLarge(); - checkLineCompsEnabledWithLarge(); - } - - private void checkPointCompsEnabledWithLarge() { - if(pointEffectPane != null) { - GUICoreUtils.setEnabled(pointEffectPane, !largeModel()); - } - } private boolean lineMapLargeModel() { return lineMapLargeDataModelGroup != null && lineMapLargeDataModelGroup.getSelectedIndex() == 0; } private void checkLineMapLarge() { - if(lineMapLargeModel()) { - if(plot instanceof VanChartMapPlot) { - resetCustomCondition(((VanChartMapPlot) plot).getLineConditionCollection()); + if (lineMapLargeModel()) { + if (plot instanceof VanChartMapPlot) { + VanChartInteractivePane.resetCustomCondition(((VanChartMapPlot) plot).getLineConditionCollection()); } } - checkLineCompsEnabledWithLarge(); + checkLineCompsEnabledWithLarge(plot); } - private void checkLineCompsEnabledWithLarge() { - if(lineMapEffectPane != null) { + private JPanel createLineMapLargeDataModelPane() { + lineMapLargeDataModelGroup = createLargeDataModelGroup(); + lineMapLargeDataModelGroup.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkLineMapLarge(); + } + }); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); + return createLargeDataModelPane(panel); + } + + + protected void checkCompsEnabledWithLarge(Plot plot) { + checkPointCompsEnabledWithLarge(plot); + checkLineCompsEnabledWithLarge(plot); + } + + private void checkPointCompsEnabledWithLarge(Plot plot) { + if (pointEffectPane != null) { + GUICoreUtils.setEnabled(pointEffectPane, !largeModel(plot)); + } + } + + private void checkLineCompsEnabledWithLarge(Plot plot) { + if (lineMapEffectPane != null) { + //大数据模式 恢复用注释。下面1行删除。 GUICoreUtils.setEnabled(lineMapEffectPane, !lineMapLargeModel()); + //大数据模式 恢复用注释。取消注释。 + //GUICoreUtils.setEnabled(lineMapEffectPane, !largeModel(plot)); } } @@ -195,6 +215,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { Component[][] components = new Component[][]{ new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle((com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), createPointAlphaPane())}, new Component[]{createMarkerComPane()}, + //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLargeDataModelPane()}, new Component[]{createPointEffectPane()}, }; @@ -212,6 +233,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { Component[][] components = new Component[][]{ new Component[]{createCurvePane()}, + //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLineMapLargeDataModelPane()}, new Component[]{createAnimationPane()} }; @@ -219,18 +241,6 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { return TableLayoutHelper.createTableLayoutPane(components, row, col); } - private JPanel createLineMapLargeDataModelPane() { - lineMapLargeDataModelGroup = createLargeDataModelGroup(); - lineMapLargeDataModelGroup.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - checkLineMapLarge(); - } - }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); - return createLargeDataModelPane(panel); - } - private Component createCurvePane() { curvePane = new VanChartCurvePane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane); @@ -257,8 +267,8 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { commonMarkerPane = new VanChartMapScatterMarkerPane(); commonMarkerPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); - bubblePane = new VanChartBubblePane(){ - protected JPanel getContentPane () { + bubblePane = new VanChartBubblePane() { + protected JPanel getContentPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; @@ -304,7 +314,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel pointPane = createPointPane(); JPanel linePane = createLinePane(); - JPanel panel = createGroupPane(plot, areaPane, pointPane, linePane); + JPanel panel = createGroupPane(plot, areaPane, pointPane, linePane); return panel; } @@ -313,7 +323,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel panel; if (ComparatorUtils.equals(plot.getClass(), VanChartDrillMapPlot.class)) { panel = createDrillMapCustomGroupPane(areaPane, pointPane); - }else { + } else { panel = createMapCustomGroupPane(areaPane, pointPane, linePane); } return panel; @@ -334,7 +344,7 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { public void stateChanged(ChangeEvent e) { if (areaPointAndLineGroup.getSelectedIndex() == 0) { cardLayout.show(centerPane, AREA_STRING); - } else if (areaPointAndLineGroup.getSelectedIndex() == 1){ + } else if (areaPointAndLineGroup.getSelectedIndex() == 1) { cardLayout.show(centerPane, POINT_STRING); } else { cardLayout.show(centerPane, LINE_STRING); @@ -375,14 +385,15 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } public void populateBean(Plot plot) { - if(plot != null && plot instanceof VanChartMapPlot){ - if(markerTypeCom != null){ + if (plot != null && plot instanceof VanChartMapPlot) { + if (markerTypeCom != null) { markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString()); } - if(nullValueColorBox != null){ + if (nullValueColorBox != null) { nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); } - if(lineMapLargeDataModelGroup != null){ + //大数据模式 恢复用注释。下面3行删除。 + if (lineMapLargeDataModelGroup != null) { lineMapLargeDataModelGroup.setSelectedItem(((VanChartMapPlot) plot).getLineMapDataProcessor()); } } @@ -390,21 +401,22 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } public void updateBean(Plot plot) { - if(plot != null && plot instanceof VanChartMapPlot){ - if(markerTypeCom != null){ + if (plot != null && plot instanceof VanChartMapPlot) { + if (markerTypeCom != null) { ((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex())); } - if(nullValueColorBox != null){ + if (nullValueColorBox != null) { ((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject()); } - if(lineMapLargeDataModelGroup != null){ + //大数据模式 恢复用注释。下面3行删除。 + if (lineMapLargeDataModelGroup != null) { ((VanChartMapPlot) plot).setLineMapDataProcessor(lineMapLargeDataModelGroup.getSelectedItem()); } } super.updateBean(plot); } - @Override + @Override protected void populateCondition(ConditionAttr defaultAttr) { switch (mapType) { case AREA: @@ -427,50 +439,50 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { protected void populateArea(ConditionAttr defaultAttr) { populateAlpha(defaultAttr); if (borderWithAlphaPane != null) { - AttrBorderWithAlpha attrBorderWithAlpha = (AttrBorderWithAlpha) defaultAttr.getExisted(AttrBorderWithAlpha.class); + AttrBorderWithAlpha attrBorderWithAlpha = defaultAttr.getExisted(AttrBorderWithAlpha.class); borderWithAlphaPane.populate(attrBorderWithAlpha); } } private void populatePoint(ConditionAttr defaultAttr) { - if(pointAlphaPane != null){ - AttrMarkerAlpha attrAlpha = (AttrMarkerAlpha)defaultAttr.getExisted(AttrMarkerAlpha.class); + if (pointAlphaPane != null) { + AttrMarkerAlpha attrAlpha = defaultAttr.getExisted(AttrMarkerAlpha.class); double alpha = VanChartAttrHelper.PERCENT * (attrAlpha == null ? 1 : attrAlpha.getAlpha()); pointAlphaPane.populateBean(alpha); } - if(pointEffectPane != null){ + if (pointEffectPane != null) { AttrEffect attrEffect = defaultAttr.getExisted(AttrEffect.class); - if(attrEffect == null){//老的模板做界面上的兼容 + if (attrEffect == null) {//老的模板做界面上的兼容 attrEffect = new AttrEffect(3.2); attrEffect.setEnabled(false); } pointEffectPane.populateBean(attrEffect); } - VanChartAttrMarker attrMarker = (VanChartAttrMarker) defaultAttr.getExisted(VanChartAttrMarker.class); - if(commonMarkerPane != null) { + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); + if (commonMarkerPane != null) { commonMarkerPane.populateBean(attrMarker); } - if(imageMarkerPane != null) { + if (imageMarkerPane != null) { imageMarkerPane.populateBean(attrMarker); } - if(bubblePane != null) { - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + if (bubblePane != null) { + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); bubblePane.populateBean(attrBubble); } } private void populateLine(ConditionAttr defaultAttr) { - if (curvePane != null){ - if (defaultAttr.getExisted(AttrCurve.class) == null){ + if (curvePane != null) { + if (defaultAttr.getExisted(AttrCurve.class) == null) { defaultAttr.addDataSeriesCondition(new AttrCurve()); } - curvePane.populateBean((AttrCurve) defaultAttr.getExisted(AttrCurve.class)); + curvePane.populateBean(defaultAttr.getExisted(AttrCurve.class)); } - if (lineMapEffectPane != null){ - if (defaultAttr.getExisted(AttrLineEffect.class) == null){ + if (lineMapEffectPane != null) { + if (defaultAttr.getExisted(AttrLineEffect.class) == null) { defaultAttr.addDataSeriesCondition(new AttrLineEffect()); } AttrLineEffect attrLineEffect = defaultAttr.getExisted(AttrLineEffect.class); @@ -498,40 +510,40 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } } - protected void checkoutMapType(Plot plot){ - this.mapType = ((VanChartMapPlot)plot).getMapType(); + protected void checkoutMapType(Plot plot) { + this.mapType = ((VanChartMapPlot) plot).getMapType(); } protected void updateArea(ConditionAttr defaultAttr) { updateAlpha(defaultAttr); if (borderWithAlphaPane != null) { - AttrBorderWithAlpha attrBorderWithAlpha = (AttrBorderWithAlpha) defaultAttr.getExisted(AttrBorderWithAlpha.class); + AttrBorderWithAlpha attrBorderWithAlpha = defaultAttr.getExisted(AttrBorderWithAlpha.class); defaultAttr.remove(attrBorderWithAlpha); defaultAttr.addDataSeriesCondition(borderWithAlphaPane.update()); } } private void updatePoint(ConditionAttr defaultAttr) { - if(pointAlphaPane != null){ - AttrMarkerAlpha attrAlpha = (AttrMarkerAlpha)defaultAttr.getExisted(AttrMarkerAlpha.class); - if(attrAlpha == null){ + if (pointAlphaPane != null) { + AttrMarkerAlpha attrAlpha = defaultAttr.getExisted(AttrMarkerAlpha.class); + if (attrAlpha == null) { attrAlpha = new AttrMarkerAlpha(); defaultAttr.addDataSeriesCondition(attrAlpha); } - attrAlpha.setAlpha((float)(pointAlphaPane.updateBean()/VanChartAttrHelper.PERCENT)); + attrAlpha.setAlpha((float) (pointAlphaPane.updateBean() / VanChartAttrHelper.PERCENT)); } - if(pointEffectPane != null){ + if (pointEffectPane != null) { AttrEffect attrEffect = defaultAttr.getExisted(AttrEffect.class); defaultAttr.remove(attrEffect); defaultAttr.addDataSeriesCondition(pointEffectPane.updateBean()); } - VanChartAttrMarker attrMarker = (VanChartAttrMarker) defaultAttr.getExisted(VanChartAttrMarker.class); + VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); defaultAttr.remove(attrMarker); - VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); + VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); defaultAttr.remove(attrBubble); - if(markerTypeCom != null) { + if (markerTypeCom != null) { if (markerTypeCom.getSelectedIndex() == 1) { defaultAttr.addDataSeriesCondition(commonMarkerPane.updateBean()); } else if (markerTypeCom.getSelectedIndex() == 2) { @@ -543,17 +555,17 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { } private void updateLine(ConditionAttr defaultAttr) { - if(curvePane != null){ + if (curvePane != null) { AttrCurve attrCurve = defaultAttr.getExisted(AttrCurve.class); - if(attrCurve != null){ + if (attrCurve != null) { defaultAttr.remove(AttrCurve.class); } attrCurve = curvePane.updateBean(); defaultAttr.addDataSeriesCondition(attrCurve); } - if (lineMapEffectPane != null){ + if (lineMapEffectPane != null) { AttrLineEffect attrLineEffect = defaultAttr.getExisted(AttrLineEffect.class); - if (attrLineEffect != null){ + if (attrLineEffect != null) { defaultAttr.remove(AttrLineEffect.class); } attrLineEffect = (AttrLineEffect) lineMapEffectPane.updateBean(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java similarity index 81% rename from designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java rename to designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java index 76deff2d3f..50636ad28f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/MapIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java @@ -21,6 +21,7 @@ import com.fr.van.chart.map.designer.data.contentpane.report.VanLineMapPlotRepor import com.fr.van.chart.map.designer.data.contentpane.report.VanPointMapPlotReportDataContentPane; import com.fr.van.chart.map.designer.data.contentpane.table.VanAreaMapPlotTableDataContentPane; import com.fr.van.chart.map.designer.data.contentpane.table.VanLineMapPlotTableDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.table.VanMapTableDataContentPane; import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; import com.fr.van.chart.map.designer.other.VanChartMapOtherPane; import com.fr.van.chart.map.designer.other.condition.pane.VanChartMapConditionPane; @@ -31,7 +32,7 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; /** * Created by Mitisky on 16/5/4. */ -public class MapIndependentVanChartInterface extends AbstractIndependentVanChartUI { +public class VanMapChartTypeUI extends AbstractIndependentVanChartUI { @Override public String getName() { @@ -70,27 +71,36 @@ public class MapIndependentVanChartInterface extends AbstractIndependentVanChart return new VanChartMapPlotPane(); } - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ - return areaPlot(plot) ? new VanAreaMapPlotTableDataContentPane(parent) +//图表数据结构 恢复用注释。取消注释。 +// public ChartDataPane getChartDataPane(AttributeChangeListener listener){ +// return new MapChartDataPane(listener); +// } + + //图表数据结构 恢复用注释。删除下面5个方法 getTableDataSourcePane getReportDataSourcePane getChartDataPane areaPlot linePlot。 + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + VanMapTableDataContentPane vanMapTableDataContentPane = areaPlot(plot) ? new VanAreaMapPlotTableDataContentPane(parent) : linePlot(plot) ? new VanLineMapPlotTableDataContentPane(parent) - : new VanPointMapPlotTableDataContentPane(parent); + : new VanPointMapPlotTableDataContentPane(parent); + + vanMapTableDataContentPane.setPlot((VanChartMapPlot)plot); + return vanMapTableDataContentPane; } - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { return areaPlot(plot) ? new VanAreaMapPlotReportDataContentPane(parent) : linePlot(plot) ? new VanLineMapPlotReportDataContentPane(parent) - : new VanPointMapPlotReportDataContentPane(parent); + : new VanPointMapPlotReportDataContentPane(parent); } public ChartDataPane getChartDataPane(AttributeChangeListener listener){ return new VanChartMapDataPane(listener); } - protected boolean areaPlot(Plot plot){ + protected boolean areaPlot(Plot plot) { return plot != null && plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getMapType() == MapType.AREA; } - protected boolean linePlot(Plot plot){ + protected boolean linePlot(Plot plot) { return plot != null && plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getMapType() == MapType.LINE; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/VanChartGroupPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/VanChartGroupPane.java index d086a70314..bc84b001d9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/VanChartGroupPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/VanChartGroupPane.java @@ -35,6 +35,7 @@ public abstract class VanChartGroupPane extends JPanel{ @Override public void stateChanged(ChangeEvent e) { cardLayout.show(centerPane, nameList[buttonGroup.getSelectedIndex()]); + tabChanged(buttonGroup.getSelectedIndex()); } }); buttonGroup.setBorder(getButtonGroupBorder()); @@ -43,6 +44,9 @@ public abstract class VanChartGroupPane extends JPanel{ this.add(centerPane, BorderLayout.CENTER); } + protected void tabChanged(int index) { + } + protected Border getButtonGroupBorder () { return null; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java index 4cfb35d704..ef9dd00d51 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java @@ -12,7 +12,7 @@ import javax.swing.JPanel; /** * Created by Mitisky on 16/5/17. */ -public class CustomMapChartDataContentsPane extends DataContentsPane{ +public class CustomMapChartDataContentsPane extends DataContentsPane { private NormalChartDataPane areaMapChartDataPane; private NormalChartDataPane pointMapChartDataPane; private NormalChartDataPane lineMapChartDataPane; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java index 158f9dbf1b..3c4f6f976a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java @@ -18,42 +18,42 @@ import java.util.List; */ public class MapDataPaneHelper { public static ChartCollection getPointMapChartCollection(ChartCollection chartCollection) { - try{ + try { ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); Chart chart = cloneCollection.getSelectedChart(); TopDefinitionProvider definition = chart.getFilterDefinition(); - if(definition != null && definition instanceof VanMapDefinition) { + if (definition != null && definition instanceof VanMapDefinition) { chart.setFilterDefinition(((VanMapDefinition) definition).getPointDefinition()); } Plot plot = chart.getPlot(); - if(plot != null && plot instanceof VanChartMapPlot){ + if (plot != null && plot instanceof VanChartMapPlot) { ((VanChartMapPlot) plot).setMapType(MapType.POINT); } return cloneCollection; - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } public static ChartCollection getLineMapChartCollection(ChartCollection chartCollection) { - try{ + try { ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); Chart chart = cloneCollection.getSelectedChart(); TopDefinitionProvider definition = chart.getFilterDefinition(); - if(definition != null && definition instanceof VanMapDefinition) { + if (definition != null && definition instanceof VanMapDefinition) { chart.setFilterDefinition(((VanMapDefinition) definition).getLineDefinition()); } Plot plot = chart.getPlot(); - if(plot != null && plot instanceof VanChartMapPlot){ + if (plot != null && plot instanceof VanChartMapPlot) { ((VanChartMapPlot) plot).setMapType(MapType.LINE); } return cloneCollection; - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } @@ -61,71 +61,71 @@ public class MapDataPaneHelper { public static ChartCollection getAreaMapChartCollection(ChartCollection chartCollection) { - try{ + try { ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); Chart chart = cloneCollection.getSelectedChart(); TopDefinitionProvider definition = chart.getFilterDefinition(); - if(definition != null && definition instanceof VanMapDefinition) { + if (definition != null && definition instanceof VanMapDefinition) { chart.setFilterDefinition(((VanMapDefinition) definition).getAreaDefinition()); } Plot plot = chart.getPlot(); - if(plot != null && plot instanceof VanChartMapPlot){ + if (plot != null && plot instanceof VanChartMapPlot) { ((VanChartMapPlot) plot).setMapType(MapType.AREA); } return cloneCollection; - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } public static ChartCollection getBottomDataDrillMapChartCollection(ChartCollection chartCollection) { - try{ + try { ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); Chart chart = cloneCollection.getSelectedChart(); TopDefinitionProvider definition = chart.getFilterDefinition(); - if(definition != null && definition instanceof DrillMapDefinition) { + if (definition != null && definition instanceof DrillMapDefinition) { chart.setFilterDefinition(((DrillMapDefinition) definition).getBottomDataDefinition()); } Plot plot = chart.getPlot(); - if(plot != null && plot instanceof VanChartDrillMapPlot){ + if (plot != null && plot instanceof VanChartDrillMapPlot) { List list = ((VanChartDrillMapPlot) plot).getLayerMapTypeList(); MapType mapType = (list != null && list.size() > 0) ? list.get(list.size() - 1) : MapType.AREA; ((VanChartMapPlot) plot).setMapType(mapType); } return cloneCollection; - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } } - public static ChartCollection getLayerChartCollection(ChartCollection chartCollection, int level, MapType mapType){ - if(mapType == null){ + public static ChartCollection getLayerChartCollection(ChartCollection chartCollection, int level, MapType mapType) { + if (mapType == null) { mapType = MapType.AREA; } - try{ + try { ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); Chart chart = cloneCollection.getSelectedChart(); TopDefinitionProvider definition = chart.getFilterDefinition(); - if(definition != null && definition instanceof DrillMapDefinition) { + if (definition != null && definition instanceof DrillMapDefinition) { List list = ((DrillMapDefinition) definition).getEachLayerDataDefinitionList(); - if(list.size() > level){ + if (list.size() > level) { chart.setFilterDefinition(list.get(level)); } } Plot plot = chart.getPlot(); - if(plot != null && plot instanceof VanChartMapPlot){ + if (plot != null && plot instanceof VanChartMapPlot) { ((VanChartMapPlot) plot).setMapType(mapType); } return cloneCollection; - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return chartCollection; } @@ -138,11 +138,11 @@ public class MapDataPaneHelper { } public static DrillMapDefinition getDrillMapDefinition(ChartCollection chartCollection) { - if(chartCollection != null){ + if (chartCollection != null) { Chart chart = chartCollection.getSelectedChart(); - if(chart != null){ + if (chart != null) { TopDefinitionProvider definitionProvider = chart.getFilterDefinition(); - if(definitionProvider instanceof DrillMapDefinition){ + if (definitionProvider instanceof DrillMapDefinition) { return (DrillMapDefinition) definitionProvider; } } @@ -151,25 +151,25 @@ public class MapDataPaneHelper { } public static List getDrillMapLayerMapTypeList(ChartCollection chartCollection) { - if(chartCollection != null){ + if (chartCollection != null) { Chart chart = chartCollection.getSelectedChart(); - if(chart != null){ + if (chart != null) { Plot plot = chart.getPlot(); - if(plot instanceof VanChartDrillMapPlot){ - return((VanChartDrillMapPlot) plot).getLayerMapTypeList(); + if (plot instanceof VanChartDrillMapPlot) { + return ((VanChartDrillMapPlot) plot).getLayerMapTypeList(); } } } return null; } - public static MapType getPlotMapType(ChartCollection chartCollection){ + public static MapType getPlotMapType(ChartCollection chartCollection) { Plot plot = chartCollection.getSelectedChart().getPlot(); return getPlotMapType(plot); } - public static MapType getPlotMapType(Plot plot){ - if(plot != null && plot instanceof VanChartMapPlot){ + public static MapType getPlotMapType(Plot plot) { + if (plot != null && plot instanceof VanChartMapPlot) { return ((VanChartMapPlot) plot).getMapType(); } return MapType.AREA; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java index 5ebe14ed0a..a6fdd49ce6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java @@ -27,12 +27,12 @@ public class VanChartMapDataPane extends ChartDataPane { } protected void repeatLayout(ChartCollection collection) { - if(contentsPane != null) { + if (contentsPane != null) { this.remove(contentsPane); } this.setLayout(new BorderLayout(0, 0)); - switch (mapType){ + switch (mapType) { case CUSTOM: contentsPane = new CustomMapChartDataContentsPane(listener, VanChartMapDataPane.this); break; @@ -54,7 +54,7 @@ public class VanChartMapDataPane extends ChartDataPane { repeatLayout(collection); - switch (mapType){ + switch (mapType) { case AREA: ChartCollection areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); contentsPane.populate(areaClone); @@ -71,8 +71,8 @@ public class VanChartMapDataPane extends ChartDataPane { ChartCollection areaClone1 = MapDataPaneHelper.getAreaMapChartCollection(collection); ChartCollection pointClone1 = MapDataPaneHelper.getPointMapChartCollection(collection); ChartCollection lineClone1 = MapDataPaneHelper.getLineMapChartCollection(collection); - ((CustomMapChartDataContentsPane)contentsPane).populateAreaMap(areaClone1); - ((CustomMapChartDataContentsPane)contentsPane).populatePointMap(pointClone1); + ((CustomMapChartDataContentsPane) contentsPane).populateAreaMap(areaClone1); + ((CustomMapChartDataContentsPane) contentsPane).populatePointMap(pointClone1); ((CustomMapChartDataContentsPane) contentsPane).populateLineMap(lineClone1); } @@ -82,14 +82,14 @@ public class VanChartMapDataPane extends ChartDataPane { * 保存 数据界面内容 */ public void update(ChartCollection collection) { - if(contentsPane != null) { + if (contentsPane != null) { VanMapDefinition vanMapDefinition = new VanMapDefinition(); ChartCollection pointClone = MapDataPaneHelper.getPointMapChartCollection(collection); ChartCollection areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); ChartCollection lineClone = MapDataPaneHelper.getLineMapChartCollection(collection); - switch (mapType){ + switch (mapType) { case AREA: contentsPane.update(areaClone); pointClone.getSelectedChart().setFilterDefinition(null); @@ -106,8 +106,8 @@ public class VanChartMapDataPane extends ChartDataPane { pointClone.getSelectedChart().setFilterDefinition(null); break; case CUSTOM: - ((CustomMapChartDataContentsPane)contentsPane).updateAreaMap(areaClone); - ((CustomMapChartDataContentsPane)contentsPane).updatePointMap(pointClone); + ((CustomMapChartDataContentsPane) contentsPane).updateAreaMap(areaClone); + ((CustomMapChartDataContentsPane) contentsPane).updatePointMap(pointClone); ((CustomMapChartDataContentsPane) contentsPane).updateLineMap(lineClone); break; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java index 2415e99bc8..abf098dded 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java @@ -9,5 +9,6 @@ import javax.swing.JPanel; */ public abstract class AbstractLongLatAreaPane extends JPanel { public abstract void populate(VanMapReportDefinition vanMapReportDefinition); + public abstract void update(VanMapReportDefinition vanMapReportDefinition); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java index 8517e64fb8..dc5df28f30 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java @@ -6,7 +6,6 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; - import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; import javax.swing.JPanel; @@ -31,12 +30,12 @@ public class AreaPane extends AbstractReportDataContentPane { double f = TableLayout.FILL; double[] columnSize = {f, COMPONENT_WIDTH}; double[] rowSize = {p}; - Component[][] components = getComponent (); - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + Component[][] components = getComponent(); + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } - protected Component[][] getComponent () { - return new Component[][]{ + protected Component[][] getComponent() { + return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), areaName} }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java index 79a4a433ca..0f7e047e9b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.map.designer.data.component.report; import com.fr.design.gui.ilable.BoldFontTextLabel; - import com.fr.plugin.chart.map.data.VanMapReportDefinition; import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; @@ -27,18 +26,19 @@ public class LineMapAreaPane extends PointMapAreaPane { } protected void initEndAreaPane() { - endAreaPane = new AreaPane(){ - protected Component[][] getComponent () { + endAreaPane = new AreaPane() { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), areaName} }; } }; } + @Override protected void initAreaPane() { - areaPane =new AreaPane(){ - protected Component[][] getComponent () { + areaPane = new AreaPane() { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), areaName} }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java index f8fc771828..1fd653dc70 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java @@ -3,7 +3,6 @@ package com.fr.van.chart.map.designer.data.component.report; import com.fr.design.gui.ilable.BoldFontTextLabel; - import java.awt.Component; /** @@ -12,8 +11,8 @@ import java.awt.Component; public class LineMapLongLatAreaPane extends LineMapAreaPane { protected void initEndAreaPane() { - endAreaPane = new LongLatAreaPane(){ - protected Component[][] getComponent () { + endAreaPane = new LongLatAreaPane() { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Longitude")), longitude}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Latitude")), latitude}, @@ -24,8 +23,8 @@ public class LineMapLongLatAreaPane extends LineMapAreaPane { } protected void initAreaPane() { - areaPane = new LongLatAreaPane(){ - protected Component[][] getComponent () { + areaPane = new LongLatAreaPane() { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Longitude")), longitude}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Latitude")), latitude}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java index f03cda28ac..af6b100661 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java @@ -5,7 +5,6 @@ import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; import javax.swing.JPanel; @@ -35,10 +34,10 @@ public class LongLatAreaPane extends AreaPane { double[] columnSize = {f, COMPONENT_WIDTH}; double[] rowSize = {p, p, p}; Component[][] components = getComponent(); - return TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,12,6); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); } - protected Component[][] getComponent () { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitude}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitude}, @@ -62,7 +61,7 @@ public class LongLatAreaPane extends AreaPane { if (longLatArea.getLongitude() != null) { longitude.getUITextField().setText(longLatArea.getLongitude().toString()); } - if (longLatArea.getLatitude() != null){ + if (longLatArea.getLatitude() != null) { latitude.getUITextField().setText(longLatArea.getLatitude().toString()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java index 29cb4930a9..f47e2623ac 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java @@ -28,6 +28,7 @@ public class PointMapAreaPane extends AbstractLongLatAreaPane { protected void initAreaPane() { areaPane = new AreaPane(); } + @Override public void populate(VanMapReportDefinition vanMapReportDefinition) { LongitudeLatitudeAndArea longLatArea = new LongitudeLatitudeAndArea(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java index 585b42de1c..9d2603f136 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java @@ -8,7 +8,7 @@ import java.util.List; /** * Created by hufan on 2016/12/21. */ -public abstract class AbstractLongLatAreaPane extends JPanel{ +public abstract class AbstractLongLatAreaPane extends JPanel { public abstract boolean isSelectedItem(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java index d765ed425f..d7934dc294 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java @@ -6,7 +6,6 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; - import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; @@ -23,6 +22,7 @@ import java.util.List; public class AreaPane extends AbstractTableDataContentPane { protected VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane listener; protected UIComboBox areaNameCom; + public AreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { this.listener = parentPane; this.setLayout(new BorderLayout()); @@ -47,10 +47,10 @@ public class AreaPane extends AbstractTableDataContentPane { double[] columnSize = {f, COMPONENT_WIDTH}; double[] rowSize = {p}; Component[][] components = getComponent(); - return TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,12,6); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); } - protected Component[][] getComponent () { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), areaNameCom} }; @@ -86,7 +86,7 @@ public class AreaPane extends AbstractTableDataContentPane { } public void populate(LongitudeLatitudeAndArea longLatArea) { - if (longLatArea.getArea() != null){ + if (longLatArea.getArea() != null) { areaNameCom.setSelectedItem(longLatArea.getArea()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java index 4d2f2d86ce..200ae1e513 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.map.designer.data.component.table; import com.fr.design.gui.ilable.BoldFontTextLabel; - import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; @@ -18,6 +17,7 @@ import java.util.List; public class LineMapAreaPane extends PointMapAreaPane { private static final int V_GAP = 10; protected AreaPane endAreaPane; + public LineMapAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { super(parentPane); } @@ -33,8 +33,8 @@ public class LineMapAreaPane extends PointMapAreaPane { } protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { - areaPane = new AreaPane(parentPane){ - protected Component[][] getComponent () { + areaPane = new AreaPane(parentPane) { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), areaNameCom} }; @@ -43,8 +43,8 @@ public class LineMapAreaPane extends PointMapAreaPane { } protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { - endAreaPane = new AreaPane(parentPane){ - protected Component[][] getComponent () { + endAreaPane = new AreaPane(parentPane) { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), areaNameCom} }; diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java index bb0f7a5bbe..8e6fc3c905 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java @@ -2,7 +2,6 @@ package com.fr.van.chart.map.designer.data.component.table; import com.fr.design.gui.ilable.BoldFontTextLabel; - import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; import java.awt.Component; @@ -17,8 +16,8 @@ public class LineMapLongLatAreaPane extends LineMapAreaPane { } protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { - endAreaPane = new LongLatAreaPane(parentPane){ - protected Component[][] getComponent () { + endAreaPane = new LongLatAreaPane(parentPane) { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Longitude")), longitudeCom}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Latitude")), latitudeCom}, @@ -29,8 +28,8 @@ public class LineMapLongLatAreaPane extends LineMapAreaPane { } protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { - areaPane = new LongLatAreaPane(parentPane){ - protected Component[][] getComponent () { + areaPane = new LongLatAreaPane(parentPane) { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Longitude")), longitudeCom}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Latitude")), latitudeCom}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java index 68e71f7e3e..b3e3dbd114 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java @@ -4,7 +4,6 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; @@ -37,10 +36,10 @@ public class LongLatAreaPane extends AreaPane { double[] rowSize = {p, p, p}; Component[][] components = getComponent(); - return TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,12,6); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); } - protected Component[][] getComponent () { + protected Component[][] getComponent() { return new Component[][]{ new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitudeCom}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitudeCom}, @@ -69,10 +68,10 @@ public class LongLatAreaPane extends AreaPane { @Override public void populate(LongitudeLatitudeAndArea longLatArea) { super.populate(longLatArea); - if(longLatArea.getLongitude() != null){ + if (longLatArea.getLongitude() != null) { longitudeCom.setSelectedItem(longLatArea.getLongitude()); } - if(longLatArea.getLatitude() != null){ + if (longLatArea.getLatitude() != null) { latitudeCom.setSelectedItem(longLatArea.getLatitude()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java index 3de16e047a..d19ad82df5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java @@ -7,7 +7,6 @@ import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; - import com.fr.plugin.chart.map.data.VanMapReportDefinition; import javax.swing.BorderFactory; @@ -26,7 +25,7 @@ public class VanAreaMapPlotReportDataContentPane extends AbstractReportDataConte initEveryPane(); initAreaName(); JPanel panel = getContent(); - panel.setBorder(BorderFactory.createEmptyBorder(0,24,0,15)); + panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); this.add(panel, "0,0,2,0"); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java index 3f82744eab..00e4d67182 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java @@ -6,7 +6,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; - import com.fr.plugin.chart.map.data.VanMapReportDefinition; import com.fr.van.chart.map.designer.data.component.report.AbstractLongLatAreaPane; import com.fr.van.chart.map.designer.data.component.report.PointMapAreaPane; @@ -67,12 +66,12 @@ public class VanPointMapPlotReportDataContentPane extends VanAreaMapPlotReportDa public LongLatReportFormulaPane() { this.setLayout(new BorderLayout(0, 5)); - centerPane = new JPanel(new CardLayout()){ + centerPane = new JPanel(new CardLayout()) { @Override public Dimension getPreferredSize() { - if (locationType.getSelectedIndex() == 0){ + if (locationType.getSelectedIndex() == 0) { return areaPane.getPreferredSize(); - }else { + } else { return longLatAreaPane.getPreferredSize(); } } @@ -99,10 +98,10 @@ public class VanPointMapPlotReportDataContentPane extends VanAreaMapPlotReportDa double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")),locationType}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")), locationType}, }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,12,6); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); this.add(panel, BorderLayout.NORTH); @@ -114,7 +113,7 @@ public class VanPointMapPlotReportDataContentPane extends VanAreaMapPlotReportDa CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (locationType.getSelectedIndex() == 0) { cardLayout.show(centerPane, "area"); - }else { + } else { cardLayout.show(centerPane, "longLat"); } } @@ -124,7 +123,7 @@ public class VanPointMapPlotReportDataContentPane extends VanAreaMapPlotReportDa if (locationType.getSelectedIndex() == 0) { areaPane.populate(mapReportDefinition); - }else { + } else { longLatAreaPane.populate(mapReportDefinition); } @@ -137,7 +136,7 @@ public class VanPointMapPlotReportDataContentPane extends VanAreaMapPlotReportDa mapReportDefinition.setUseAreaName(useAreaName); if (useAreaName) { areaPane.update(mapReportDefinition); - }else { + } else { longLatAreaPane.update(mapReportDefinition); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java index 331b7a843c..284320cebc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java @@ -8,26 +8,25 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; - import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; import com.fr.van.chart.map.designer.data.component.SeriesTypeUseComboxPaneWithOutFilter; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JSeparator; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.List; /** * Created by Mitisky on 16/5/16. */ -public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContentPane { +public class VanAreaMapPlotTableDataContentPane extends VanMapTableDataContentPane { private UIComboBox areaNameCom; protected SeriesTypeUseComboxPaneWithOutFilter seriesTypeUseComboxPane; @@ -39,8 +38,8 @@ public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContent JPanel areaNamePane = createAreaNamePane(); JSeparator jSeparator = new JSeparator(); - areaNamePane.setBorder(BorderFactory.createEmptyBorder(0,24,0,15)); - jSeparator.setPreferredSize(new Dimension(246,2)); + areaNamePane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); + jSeparator.setPreferredSize(new Dimension(246, 2)); this.add(areaNamePane, BorderLayout.NORTH); this.add(jSeparator, BorderLayout.CENTER); @@ -73,7 +72,7 @@ public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContent double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{label, areaNameCom}, + new Component[]{label, createAreaPanel(areaNameCom)}, }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -108,7 +107,7 @@ public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContent } } - protected boolean isAreaSelectedItem(){ + protected boolean isAreaSelectedItem() { return areaNameCom.getSelectedItem() != null; } @@ -139,13 +138,14 @@ public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContent public void updateBean(ChartCollection collection) { seriesTypeUseComboxPane.updateBean(collection); TopDefinitionProvider topDefinitionProvider = collection.getSelectedChart().getFilterDefinition(); - if(topDefinitionProvider instanceof VanMapTableDefinitionProvider){ - VanMapTableDefinitionProvider mapTableDefinitionProvider = (VanMapTableDefinitionProvider)topDefinitionProvider; + if (topDefinitionProvider instanceof VanMapTableDefinitionProvider) { + VanMapTableDefinitionProvider mapTableDefinitionProvider = (VanMapTableDefinitionProvider) topDefinitionProvider; + mapTableDefinitionProvider.setMatchResult((MapMatchResult) this.getMatchResult().clone()); updateDefinition(mapTableDefinitionProvider); } } - protected void updateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider){ + protected void updateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider) { Object o = areaNameCom.getSelectedItem(); mapTableDefinitionProvider.setCategoryName(o == null ? null : o.toString()); } @@ -156,13 +156,14 @@ public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContent public void populateBean(ChartCollection collection) { seriesTypeUseComboxPane.populateBean(collection, this.isNeedSummaryCaculateMethod()); TopDefinitionProvider topDefinitionProvider = collection.getSelectedChart().getFilterDefinition(); - if(topDefinitionProvider instanceof VanMapTableDefinitionProvider){ - VanMapTableDefinitionProvider mapTableDefinitionProvider = (VanMapTableDefinitionProvider)topDefinitionProvider; + if (topDefinitionProvider instanceof VanMapTableDefinitionProvider) { + VanMapTableDefinitionProvider mapTableDefinitionProvider = (VanMapTableDefinitionProvider) topDefinitionProvider; + this.setMatchResult((MapMatchResult) mapTableDefinitionProvider.getMatchResult().clone()); populateDefinition(mapTableDefinitionProvider); } } - protected void populateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider){ + protected void populateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider) { if (mapTableDefinitionProvider.getCategoryName() != null) { areaNameCom.setSelectedItem(mapTableDefinitionProvider.getCategoryName()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java index de2b9ded6a..141b2eb2e0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java @@ -1,22 +1,49 @@ package com.fr.van.chart.map.designer.data.contentpane.table; +import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.AreaPane; import com.fr.van.chart.map.designer.data.component.table.LineMapAreaPane; import com.fr.van.chart.map.designer.data.component.table.LineMapLongLatAreaPane; +import java.awt.Component; + /** * Created by hufan on 2016/12/15. */ -public class VanLineMapPlotTableDataContentPane extends VanPointMapPlotTableDataContentPane{ +public class VanLineMapPlotTableDataContentPane extends VanPointMapPlotTableDataContentPane { public VanLineMapPlotTableDataContentPane(ChartDataPane parent) { super(parent); } protected AbstractLongLatAreaPane createAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { - return new LineMapAreaPane(longLatAreaTableComboPane); + return new LineMapAreaPane(longLatAreaTableComboPane) { + @Override + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new AreaPane(parentPane) { + @Override + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), VanLineMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + @Override + protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + endAreaPane = new AreaPane(parentPane) { + @Override + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), VanLineMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + }; } protected AbstractLongLatAreaPane createLongLatAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java new file mode 100644 index 0000000000..09d72a72e6 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanMapTableDataContentPane.java @@ -0,0 +1,137 @@ +package com.fr.van.chart.map.designer.data.contentpane.table; + +import com.fr.base.BaseUtils; +import com.fr.base.Utils; +import com.fr.chartx.TwoTuple; +import com.fr.design.chartx.component.MapAreaMatchPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.data.MapMatchResult; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.util.Set; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2019-12-25 + */ +public abstract class VanMapTableDataContentPane extends AbstractTableDataContentPane { + + private VanChartMapPlot plot; + + //钻取地图有层级,默认-1代表无层级关系 + private int level = ChartGEOJSONHelper.DEFAULT_LEVEL; + + private MapMatchResult matchResult = new MapMatchResult(); + + public void setLevel(int level) { + this.level = level; + } + + public void setPlot(VanChartMapPlot plot) { + this.plot = plot; + } + + public MapMatchResult getMatchResult() { + return matchResult; + } + + public void setMatchResult(MapMatchResult matchResult) { + this.matchResult = matchResult; + } + + public JPanel createAreaPanel(UIComboBox areaBox) { + JPanel areaPanel = new JPanel(new BorderLayout(4, 0)); + areaBox.setPreferredSize(new Dimension(70, 20)); + areaPanel.add(areaBox, BorderLayout.CENTER); + UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); + uiButton.addActionListener(createActionListener(areaBox)); + areaPanel.add(uiButton, BorderLayout.EAST); + return areaPanel; + } + + private ActionListener createActionListener(final UIComboBox areaBox){ + return new ActionListener() { + private TwoTuple> treeNodeAndItems; + + @Override + public void actionPerformed(ActionEvent e) { + if (treeNodeAndItems == null) { + treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level, plot.getMapType()); + } + final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems); + + final String nameTable = getTableName(); + + BasicDialog dialog = pane.showWindow(new JFrame()); + dialog.addDialogActionListener(new DialogActionListener() { + @Override + public void doOk() { + pane.updateBean(matchResult); + } + + @Override + public void doCancel() { + + } + }); + dialog.addWindowListener(new WindowListener() { + @Override + public void windowOpened(WindowEvent e) { + pane.populateBean(matchResult, nameTable, Utils.objectToString(areaBox.getSelectedItem())); + } + + @Override + public void windowClosing(WindowEvent e) { + + } + + @Override + public void windowClosed(WindowEvent e) { + + } + + @Override + public void windowIconified(WindowEvent e) { + + } + + @Override + public void windowDeiconified(WindowEvent e) { + + } + + @Override + public void windowActivated(WindowEvent e) { + + } + + @Override + public void windowDeactivated(WindowEvent e) { + + } + }); + dialog.setVisible(true); + } + }; + } + + @Override + public void refreshLevel(int level) { + this.setLevel(level); + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java index 40ea3fe3a3..2e25e1bc20 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java @@ -2,13 +2,14 @@ package com.fr.van.chart.map.designer.data.contentpane.table; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; - import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.AreaPane; import com.fr.van.chart.map.designer.data.component.table.PointMapAreaPane; import com.fr.van.chart.map.designer.data.component.table.PointMapLongLatAreaPane; @@ -16,11 +17,11 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.util.List; /** * Created by Mitisky on 16/5/17. @@ -41,7 +42,7 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData protected JPanel createAreaNamePane() { JPanel panel = new JPanel(new BorderLayout()); - panel.setBorder(BorderFactory.createEmptyBorder(0,LEFT_GAP,V_GAP,0)); + panel.setBorder(BorderFactory.createEmptyBorder(0, LEFT_GAP, V_GAP, 0)); panel.add(longLatTableComboPane, BorderLayout.CENTER); return panel; } @@ -56,7 +57,7 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData longLatTableComboPane.checkBoxUse(hasUse); } - protected boolean isAreaSelectedItem(){ + protected boolean isAreaSelectedItem() { return longLatTableComboPane.isSelectedItem(); } @@ -92,12 +93,12 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData double f = TableLayout.FILL; this.setLayout(new BorderLayout(0, 5)); - centerPane = new JPanel(new CardLayout()){ + centerPane = new JPanel(new CardLayout()) { @Override public Dimension getPreferredSize() { - if (locationType.getSelectedIndex() == 0){ + if (locationType.getSelectedIndex() == 0) { return new Dimension(180, (int) areaNamePane.getPreferredSize().getHeight()); - }else { + } else { return new Dimension(180, (int) longLatAreaPane.getPreferredSize().getHeight()); } } @@ -124,17 +125,17 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData double[] columnSize = {p, f}; double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")),locationType}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")), locationType}, }; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,30,6); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 30, 6); this.add(panel, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); } - public void fireCheckSeriesUse(boolean hasUse){ + public void fireCheckSeriesUse(boolean hasUse) { checkSeriseUse(hasUse); } @@ -142,7 +143,7 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (locationType.getSelectedIndex() == 0) { cardLayout.show(centerPane, "area"); - }else { + } else { cardLayout.show(centerPane, "longLat"); } fireCheckSeriesUse(true); @@ -177,18 +178,18 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData if (locationType.getSelectedIndex() == 0) { areaNamePane.populate(mapTableDefinitionProvider); - }else { + } else { longLatAreaPane.populate(mapTableDefinitionProvider); } checkCenterPane(); } - public void updateBean(VanMapTableDefinitionProvider mapTableDefinitionProvider){ + public void updateBean(VanMapTableDefinitionProvider mapTableDefinitionProvider) { boolean useAreaName = locationType.getSelectedIndex() == 0; mapTableDefinitionProvider.setUseAreaName(useAreaName); if (useAreaName) { areaNamePane.update(mapTableDefinitionProvider); - }else { + } else { longLatAreaPane.update(mapTableDefinitionProvider); } @@ -206,16 +207,26 @@ public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableData } public boolean isSelectedItem() { - if (locationType.getSelectedIndex() == 0){ + if (locationType.getSelectedIndex() == 0) { return areaNamePane.isSelectedItem(); - }else { + } else { return longLatAreaPane.isSelectedItem(); } } } protected AbstractLongLatAreaPane createAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { - return new PointMapAreaPane(longLatAreaTableComboPane); + return new PointMapAreaPane(longLatAreaTableComboPane) { + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new AreaPane(parentPane) { + protected Component[][] getComponent () { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), VanPointMapPlotTableDataContentPane.this.createAreaPanel(areaNameCom)} + }; + } + }; + } + }; } protected AbstractLongLatAreaPane createLongLatAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java index 2419604142..0f89fed693 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java @@ -1,11 +1,9 @@ package com.fr.van.chart.map.designer.other; import com.fr.chart.chartattr.Plot; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.type.MapType; -import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.other.AutoRefreshPane; @@ -20,11 +18,13 @@ import javax.swing.JPanel; public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZoom { private static final int HYPERLINK_LEFT_GAP = 36; private VanChartMapHyperLinkPane hyperlinkPane; + @Override protected JPanel createHyperlinkPane() { hyperlinkPane = new VanChartMapHyperLinkPane(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), hyperlinkPane); } + @Override protected void populateHyperlink(Plot plot) { hyperlinkPane.populateBean(plot); @@ -35,11 +35,12 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo hyperlinkPane.updateBean(plot); } + //大数据模式 恢复用注释。删除下面方法。 @Override protected boolean largeModel(Plot plot) { - if(plot instanceof VanChartMapPlot){ - VanChartMapPlot mapPlot = (VanChartMapPlot)plot; - switch (mapPlot.getMapType()){ + if (plot instanceof VanChartMapPlot) { + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + switch (mapPlot.getMapType()) { case LINE: return PlotFactory.lineMapLargeModel(mapPlot); default: @@ -49,13 +50,23 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo return false; } + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + if (this.chart == null || this.chart.getPlot() == null) { + return false; + } + VanChartMapPlot mapPlot = this.chart.getPlot(); + + return mapPlot.getMapType() == MapType.POINT || mapPlot.getMapType() == MapType.LINE; + } + protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { boolean isLargeModel = largeModel(plot); - VanChartMapPlot mapPlot = (VanChartMapPlot)plot; + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; if (mapPlot.getMapType().equals(MapType.LINE)) { - return new AutoRefreshPaneWithoutTooltip((VanChart) chart, isLargeModel); + return new AutoRefreshPaneWithoutTooltip(chart, isLargeModel); } - return new AutoRefreshPane((VanChart) chart, isLargeModel); + return new AutoRefreshPane(chart, isLargeModel); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java index b6862a38e2..89bc16b7e3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java @@ -46,7 +46,10 @@ public class VanChartLineMapConditionPane extends DataSeriesConditionPane { classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this)); classPaneMap.put(AttrCurve.class, new VanChartCurveConditionPane(this)); classPaneMap.put(AttrTooltip.class, new VanChartLineMapTooltipConditionPane(this, plot)); - if(!PlotFactory.lineMapLargeModel(plot)){ + //大数据模式 恢复用注释。下面1行删除。 + if (!PlotFactory.lineMapLargeModel(plot)) { + //大数据模式 恢复用注释。取消注释。 + //if (!PlotFactory.largeDataModel(plot)) { classPaneMap.put(AttrLineEffect.class, new VanChartLineEffectConditionPane(this, EffectHelper.getLineMapDefaultLineEffect())); } } @@ -56,6 +59,7 @@ public class VanChartLineMapConditionPane extends DataSeriesConditionPane { /** * 返回图表class对象 + * * @return class对象 */ public Class class4Correspond() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index 6698652202..004ac81b38 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -2,9 +2,12 @@ package com.fr.van.chart.map.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.MapChartDataDefinition; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.map.MapIndependentVanChart; import com.fr.plugin.chart.map.VanChartMapPlot; @@ -31,10 +34,10 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { }; } - protected Component[][] getPaneComponents(JPanel typePane){ + protected Component[][] getPaneComponents(JPanel typePane) { try { sourceChoosePane = createSourceChoosePane(); - } catch (Exception e){ + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return new Component[][]{ @@ -51,10 +54,10 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { * 更新界面内容 */ public void populateBean(Chart chart) { - for(ChartImagePane imagePane : typeDemo) { + for (ChartImagePane imagePane : typeDemo) { imagePane.isPressing = false; } - VanChartMapPlot plot = (VanChartMapPlot)chart.getPlot(); + VanChartMapPlot plot = (VanChartMapPlot) chart.getPlot(); typeDemo.get(plot.getDetailType()).isPressing = true; populateSourcePane(plot); @@ -69,7 +72,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { protected void populateSourcePane(VanChartMapPlot plot) { //populate需要使用clone的plot try { - VanChartMapPlot mapPlot = (VanChartMapPlot)plot.clone(); + VanChartMapPlot mapPlot = (VanChartMapPlot) plot.clone(); sourceChoosePane.populateBean(mapPlot); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); @@ -79,21 +82,21 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { public void updateBean(Chart chart) { super.updateBean(chart); Plot plot = chart.getPlot(); - if(plot instanceof VanChartMapPlot) { + if (plot instanceof VanChartMapPlot) { sourceChoosePane.updateBean((VanChartMapPlot) plot); - if(!isSamePlot() || (typeChanged && isSamePlot())){ + if (!isSamePlot() || (typeChanged && isSamePlot())) { resetAttr(plot); } } } - /** * 不同地图类型的超链不需要复制 + * * @param oldPlot * @param newPlot * @throws CloneNotSupportedException */ - protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ + protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { } @@ -106,11 +109,11 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { sourceChoosePane.resetComponentValue((VanChartMapPlot) plot); } - protected Plot getSelectedClonedPlot(){ + protected Plot getSelectedClonedPlot() { VanChartMapPlot newPlot = null; Chart[] charts = getDefaultCharts(); - for(int i = 0, len = charts.length; i < len; i++){ - if(typeDemo.get(i).isPressing){ + for (int i = 0, len = charts.length; i < len; i++) { + if (typeDemo.get(i).isPressing) { newPlot = (VanChartMapPlot) charts[i].getPlot(); } } @@ -119,7 +122,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { return cloned; } try { - cloned = (Plot)newPlot.clone(); + cloned = (Plot) newPlot.clone(); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -142,8 +145,12 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { return MapIndependentVanChart.MapVanCharts[0]; } - public VanChartMapSourceChoosePane getSourceChoosePane(){ + public VanChartMapSourceChoosePane getSourceChoosePane() { return this.sourceChoosePane; } + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + return definition instanceof MapChartDataDefinition; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index c7a44d1b88..1cc66a2bf5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -41,19 +41,10 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan }; } - @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { - return new MultiPiePlotTableDataContentPane(parent); - } - - @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { - return new MultiPiePlotReportDataContentPane(parent); - } - + //图表数据结构 恢复用注释。取消注释。 // @Override // public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new AbstractDataPane(listener) { +// return new AbstractVanSingleDataPane(listener) { // @Override // protected SingleDataPane createSingleDataPane() { // return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane()); @@ -61,6 +52,17 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan // }; // } + //图表数据结构 恢复用注释。删除下面两个方法 getTableDataSourcePane getReportDataSourcePane。 + @Override + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + return new MultiPiePlotTableDataContentPane(parent); + } + + @Override + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + return new MultiPiePlotReportDataContentPane(parent); + } + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ return new VanChartMultiPieSeriesPane(parent, plot); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java index 397a118926..555cca468d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/VanChartMultiPiePlotPane.java @@ -2,7 +2,12 @@ package com.fr.van.chart.multilayer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.multilayer.MultiPieIndependentVanChart; import com.fr.plugin.chart.multilayer.VanChartMultiPiePlot; @@ -20,11 +25,11 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane { } @Override - protected Plot getSelectedClonedPlot(){ + protected Plot getSelectedClonedPlot() { VanChartMultiPiePlot newPlot = null; Chart[] multilayerCharts = MultiPieIndependentVanChart.MultilayerVanChartTypes; - for(int i = 0, len = multilayerCharts.length; i < len; i++){ - if(typeDemo.get(i).isPressing){ + for (int i = 0, len = multilayerCharts.length; i < len; i++) { + if (typeDemo.get(i).isPressing) { newPlot = (VanChartMultiPiePlot) multilayerCharts[i].getPlot(); } } @@ -34,7 +39,7 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane { return cloned; } try { - cloned = (Plot)newPlot.clone(); + cloned = (Plot) newPlot.clone(); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error("Error In MultiPieChart"); } @@ -43,13 +48,14 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane { /** * 防止新建其他图表从而切换很卡 + * * @return */ public Chart getDefaultChart() { return MultiPieIndependentVanChart.MultilayerVanChartTypes[0]; } - protected void resetChartAttr(Chart chart, Plot newPlot){ + protected void resetChartAttr(Chart chart, Plot newPlot) { super.resetChartAttr(chart, newPlot); //重置工具栏选项 VanChartTools tools = ((VanChart) chart).getVanChartTools(); @@ -59,4 +65,13 @@ public class VanChartMultiPiePlotPane extends AbstractVanChartTypePane { tools.setExport(false); } } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if (definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + return columnFieldCollection instanceof MultiPieColumnFieldCollection; + } + return false; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java index 0ec79c3b8a..2169c4a20c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/VanChartPieSeriesPane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -53,21 +54,21 @@ public class VanChartPieSeriesPane extends VanChartAbstractPlotSeriesPane { startAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); endAngle = new UISpinner(MIN_ANGLE, MAX_ANGLE, 1, 0); innerRadius = new UISpinner(0, 100, 1, 0); - supportRotation = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); + supportRotation = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); Component[][] components = new Component[][]{ new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, - new Component[]{createRadiusPane(),null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Start_Angle")),startAngle}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_End_Angle")),endAngle}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Inner_Radius")),innerRadius}, + new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")),null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Rotation")),supportRotation} }; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } public void populateBean(Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPane.java index 94bb9a4dae..f4103e0d2f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPane.java @@ -3,8 +3,9 @@ package com.fr.van.chart.range.component; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; - +import com.fr.design.style.color.ColorSelectBox; import java.awt.Component; @@ -34,4 +35,9 @@ public class SectionIntervalConfigPane extends MapColorPickerPaneWithFormula { }; } + + @Override + protected ColorSelectBox getColorSelectBox() { + return new ColorSelectBoxWithOutTransparent(100); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java index 263ce191af..1b7063af4d 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/ScatterIndependentVanChartInterface.java @@ -16,6 +16,7 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.scatter.component.VanChartScatterStylePane; import com.fr.van.chart.scatter.data.VanChartScatterPlotTableDataContentPane; @@ -56,18 +57,19 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC public String getIconPath() { return "com/fr/design/images/form/toolbar/scatter.png"; } + @Override - public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartScatterSeriesPane(parent, plot); } @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { return new VanChartScatterPlotTableDataContentPane(parent); } @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { return new BubblePlotReportDataContentPane(parent); } @@ -76,19 +78,40 @@ public class ScatterIndependentVanChartInterface extends AbstractIndependentVanC * 图表的属性界面数组 * @return 属性界面 */ - public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ + public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { VanChartStylePane stylePane = new VanChartScatterStylePane(listener); - VanChartOtherPane otherPane = new VanChartOtherPane(){ + VanChartOtherPane otherPane = new VanChartOtherPane() { @Override protected BasicBeanPane createInteractivePane() { - return new VanChartInteractivePaneWithOutSort(); + return new VanChartInteractivePaneWithOutSort() { + @Override + protected ZoomPane createZoomPane() { + return new ZoomPane(); + } + + @Override + protected boolean isCurrentChartSupportLargeDataMode() { + return true; + } + }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } - public ConditionAttributesPane getPlotConditionPane(Plot plot){ + public ConditionAttributesPane getPlotConditionPane(Plot plot) { return new VanChartScatterConditionPane(plot); } + + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); +// } +// }; +// } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java index b2d6be16e2..f93051a747 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterPlotPane.java @@ -5,7 +5,12 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionCollection; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.scatter.ScatterIndependentVanChart; @@ -81,4 +86,13 @@ public class VanChartScatterPlotPane extends AbstractVanChartTypePane { } } } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if(definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + return columnFieldCollection instanceof BubbleColumnFieldCollection; + } + return false; + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java index 456c6a135d..a85725a8e7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java @@ -5,7 +5,6 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; - import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; @@ -20,19 +19,19 @@ import java.awt.Component; /** * 散点图的系列界面 */ -public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ +public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { private static final long serialVersionUID = 5595016643808487932L; - public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot){ + public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } - protected JPanel getContentInPlotType(){ + protected JPanel getContentInPlotType() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] row = {p,p,p,p,p,p,p,p,p,p}; + double[] row = {p, p, p, p, p, p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ @@ -40,6 +39,7 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ new Component[]{createLineTypePane()}, new Component[]{createMarkerPane()}, new Component[]{createStackedAndAxisPane()}, + //大数据模式 恢复用注释。下面1行删除。 new Component[]{createLargeDataModelPane()}, new Component[]{createTrendLinePane()}, }; @@ -49,25 +49,25 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ } //设置色彩面板内容 - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { panel.add(createAlphaPane(), BorderLayout.CENTER); } @Override //堆积和坐标轴设置(自定义柱形图等用到) protected JPanel createStackedAndAxisPane() { - stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane(){ + stackAndAxisEditPane = new VanChartStackedAndAxisListControlPane() { @Override protected Class getStackAndAxisPaneClass() { return VanChartCustomAxisConditionPane.class; } @Override - public String getPaneTitle(){ + public String getPaneTitle() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Axis"); } }; - stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); + stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane); return stackAndAxisEditExpandablePane; } @@ -77,8 +77,8 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane{ } @Override - protected void checkCompsEnabledWithLarge() { - super.checkCompsEnabledWithLarge(); + protected void checkCompsEnabledWithLarge(Plot plot) { + super.checkCompsEnabledWithLarge(this.plot); checkLinePane(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java index b9dac828c6..8808a78e38 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/VanChartScatterLineTypePane.java @@ -2,15 +2,12 @@ package com.fr.van.chart.scatter.component; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.TableLayoutHelper; - +import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.base.VanChartAttrLine; import com.fr.plugin.chart.type.LineStyle; import com.fr.stable.Constants; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; -import javax.swing.JPanel; import java.awt.Component; /** @@ -21,29 +18,28 @@ public class VanChartScatterLineTypePane extends VanChartLineTypePane { @Override protected void createLineStyle() { String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Normal_Line"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_CurveLine")}; lineStyle = new UIButtonGroup(textArray, new LineStyle[]{LineStyle.NORMAL, LineStyle.CURVE}); } @Override - protected JPanel createContentPane(double p, double f) { - double[] row = {p,p,p}; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] col = {f, e}; - Component[][] components = new Component[][]{ - new Component[]{null,null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")), lineStyle}, + protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { + return new Component[][]{ + //线型支持虚线 恢复用注释。下面2行删除。 + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, + lineStyleComponent }; - - return TableLayoutHelper.createTableLayoutPane(components, row, col); } @Override protected VanChartAttrLine initVanChartAttrLine() { - VanChartAttrLine attrLine = new VanChartAttrLine(); + VanChartAttrLine attrLine = new VanChartAttrLine(); //默认为无线型,且默認空值不斷開 + //线型支持虚线 恢复用注释。下面1行删除。 attrLine.setLineWidth(Constants.LINE_NONE); + //线型支持虚线 恢复用注释。取消注释。 + //attrLine.setLineType(LineType.NONE); attrLine.setNullValueBreak(false); return attrLine; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java similarity index 81% rename from designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java rename to designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java index 6be8c692ba..8109adeb0c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/StructureIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/VanStructureChartTypeUI.java @@ -15,6 +15,8 @@ import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; +import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.structure.desinger.data.StructurePlotReportDataContentPane; import com.fr.van.chart.structure.desinger.data.StructurePlotTableDataContentPane; @@ -26,7 +28,7 @@ import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; /** * Created by shine on 2017/2/15. */ -public class StructureIndependentVanChartInterface extends AbstractIndependentVanChartUI { +public class VanStructureChartTypeUI extends AbstractIndependentVanChartUI { @Override public AbstractChartTypePane getPlotTypePane() { return new VanChartStructureTypePane(); @@ -83,6 +85,7 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa protected BasicBeanPane createInteractivePane() { return new VanChartInteractivePaneWithOutSort(){ + //图表缩放新设计 恢复用注释。删除下面两个方法 getNameArray getValueArray。 @Override protected String[] getNameArray() { return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; @@ -94,6 +97,10 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; } + @Override + protected ZoomPane createZoomPane() { + return new ZoomPaneWithOutMode(); + } }; } }; @@ -105,8 +112,14 @@ public class StructureIndependentVanChartInterface extends AbstractIndependentVa return new VanChartStructureConditionPane(plot); } - /* @Override - public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new StructureChartDataPane(listener); - }*/ + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new StructureDataSetFieldsPane(), new StructureCellDataFieldsPane()); +// } +// }; +// } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java index 1674c850c7..96544a56a4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/structure/desinger/type/VanChartStructureTypePane.java @@ -2,7 +2,12 @@ package com.fr.van.chart.structure.desinger.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.StructureColumnFieldCollection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.structure.StructureIndependentVanChart; import com.fr.plugin.chart.structure.VanChartStructurePlot; @@ -54,4 +59,12 @@ public class VanChartStructureTypePane extends AbstractVanChartTypePane { return WordCloudIndependentVanChart.WordCloudVanCharts[0]; } + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if(definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + return columnFieldCollection instanceof StructureColumnFieldCollection; + } + return false; + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java index e1234c90fe..57bed739b7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractIndependentVanChartUI.java @@ -46,4 +46,15 @@ public abstract class AbstractIndependentVanChartUI extends AbstractIndependentC public int currentAPILevel() { return CURRENT_API_LEVEL; } + + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); +// } +// }; +// } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java index 9dfac7c2c1..b9794b1c83 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java @@ -13,19 +13,80 @@ import com.fr.van.chart.designer.data.VanChartMoreCateTableDataContentPane; /** * Created by mengao on 2017/7/6. */ -public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependentVanChartUI { - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ +public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependentVanChartUI { + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { //自定义组合图特殊处理 - if (((VanChartPlot)plot).isInCustom() && ((VanChartPlot)plot).getCustomType().equals("CUSTOM")) { + if (((VanChartPlot) plot).isInCustom() && ((VanChartPlot) plot).getCustomType().equals("CUSTOM")) { return new CategoryPlotTableDataContentPane(parent); } - return new VanChartMoreCateTableDataContentPane(parent); } + return new VanChartMoreCateTableDataContentPane(parent); + } - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { //自定义组合图特殊处理 - if (((VanChartPlot)plot).isInCustom() && ((VanChartPlot)plot).getCustomType().equals("CUSTOM")) { + if (((VanChartPlot) plot).isInCustom() && ((VanChartPlot) plot).getCustomType().equals("CUSTOM")) { return new CategoryPlotReportDataContentPane(parent); } return new VanChartMoreCateReportDataContentPane(parent); } + + + //图表缩放新设计 恢复用注释。取消注释。 +// @Override +// public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) { +// +// VanChartStylePane stylePane = new VanChartStylePane(listener); +// VanChartOtherPane otherPane = new VanChartOtherPane() { +// @Override +// protected BasicBeanPane createInteractivePane() { +// return new VanChartInteractivePane() { +// @Override +// protected ZoomPane createZoomPane() { +// return new ZoomPane(); +// } +// +// @Override +// protected boolean isCurrentChartSupportLargeDataMode() { +// return true; +// } +// }; +// } +// }; +// return new AbstractChartAttrPane[]{stylePane, otherPane}; +// } + + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// MultiCategoryDataSetFieldsPane multiCategoryDataSetFieldsPane; +// MultiCategoryCellDataFieldsPane multiCategoryCellDataFieldsPane; +// +// @Override +// protected SingleDataPane createSingleDataPane() { +// multiCategoryDataSetFieldsPane = new MultiCategoryDataSetFieldsPane(); +// multiCategoryCellDataFieldsPane = new MultiCategoryCellDataFieldsPane(); +// return new SingleDataPane(multiCategoryDataSetFieldsPane, multiCategoryCellDataFieldsPane); +// } +// +// @Override +// public void populate(ChartCollection collection) { +// super.populate(collection); +// VanChart vanChart = this.getVanChart(); +// if (vanChart == null) { +// return; +// } +// +// VanChartRectanglePlot plot = vanChart.getPlot(); +// VanChartAxis axis = plot.getDefaultXAxis(); +// if (plot instanceof VanChartColumnPlot +// && ((VanChartColumnPlot) plot).isBar()) { +// axis = plot.getDefaultYAxis(); +// } +// +// multiCategoryDataSetFieldsPane.setCategoryAxis(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY)); +// multiCategoryCellDataFieldsPane.setCategoryAxis(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY)); +// } +// }; +// } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java index ff4b9bbce8..5ff077a4b6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java @@ -16,6 +16,8 @@ import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; import com.fr.van.chart.designer.other.VanChartOtherPane; +import com.fr.van.chart.designer.other.zoom.ZoomPane; +import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; import com.fr.van.chart.wordcloud.designer.data.WordCloudPlotReportDataContentPane; @@ -97,9 +99,10 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa protected BasicBeanPane createInteractivePane() { return new VanChartInteractivePaneWithOutSort(){ + //图表缩放新设计 恢复用注释。删除下面两个方法 getNameArray getValueArray。 @Override protected String[] getNameArray() { - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; + return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; } @Override @@ -107,15 +110,21 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; } + + @Override + protected ZoomPane createZoomPane() { + return new ZoomPaneWithOutMode(); + } }; } }; return new AbstractChartAttrPane[]{stylePane, otherPane}; } + //图表数据结构 恢复用注释。取消注释。 // @Override // public ChartDataPane getChartDataPane(AttributeChangeListener listener) { -// return new AbstractDataPane(listener) { +// return new AbstractVanSingleDataPane(listener) { // @Override // protected SingleDataPane createSingleDataPane() { // return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/type/VanChartWordCloudTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/type/VanChartWordCloudTypePane.java index 1a75c18e14..99f330e06a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/type/VanChartWordCloudTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/type/VanChartWordCloudTypePane.java @@ -2,7 +2,12 @@ package com.fr.van.chart.wordcloud.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.data.AbstractDataDefinition; +import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.chartx.data.field.AbstractColumnFieldCollection; +import com.fr.chartx.data.field.diff.WordCloudColumnFieldCollection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.WordCloudIndependentVanChart; @@ -63,4 +68,13 @@ public class VanChartWordCloudTypePane extends AbstractVanChartTypePane { public Chart getDefaultChart() { return WordCloudIndependentVanChart.WordCloudVanCharts[0]; } + + @Override + protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { + if(definition instanceof AbstractDataDefinition) { + AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); + return columnFieldCollection instanceof WordCloudColumnFieldCollection; + } + return false; + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XRadio.java b/designer-form/src/main/java/com/fr/design/designer/creator/XRadio.java index 3e122d070e..af207457f9 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XRadio.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XRadio.java @@ -15,7 +15,9 @@ import java.beans.IntrospectionException; /** * @author richer * @since 6.5.3 + * @deprecated */ +@Deprecated public class XRadio extends XWidgetCreator { public XRadio(Radio widget, Dimension initSize) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 714bd0a2ea..3fb0b5f969 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java @@ -22,7 +22,6 @@ import com.fr.general.FRLogger; import com.fr.general.FRScreen; import com.fr.stable.ArrayUtils; import com.fr.stable.AssistUtils; -import edu.emory.mathcs.backport.java.util.Arrays; import javax.swing.JOptionPane; import java.awt.Component; @@ -31,6 +30,7 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ContainerEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 6de8c0114f..f0e23b977f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fr.design.designer.creator.cardlayout; @@ -62,6 +62,8 @@ public class XCardSwitchButton extends XButton { private static final int MIN_SIZE = 1; + private static final int HALF_NUMBER = 2; + // 删除按钮识别区域偏移量 private static final int CLOSE_ICON_RIGHT_OFFSET = 15; private static final int CLOSE_ICON_TOP_OFFSET = 15; @@ -81,7 +83,7 @@ public class XCardSwitchButton extends XButton { private UILabel label; private Icon closeIcon = MOUSE_CLOSE; - + public XWCardTagLayout getTagLayout() { return tagLayout; } @@ -127,12 +129,12 @@ public class XCardSwitchButton extends XButton { /** * 响应点击事件 - * + * * @param editingMouseListener * 事件处理器 * @param e * 点击事件 - * + * */ @Override public void respondClick(EditingMouseListener editingMouseListener, @@ -144,12 +146,12 @@ public class XCardSwitchButton extends XButton { if(cardLayout == null){ initRelateLayout(); } - + //获取当前tab的index CardSwitchButton currentButton = (CardSwitchButton) this.toData(); int index = currentButton.getIndex(); int maxIndex = cardLayout.getComponentCount() - 1; - + //点击删除图标时 if (isSelectedClose(e, designer)) { //当删除到最后一个tab时,删除整个tab布局 @@ -236,8 +238,8 @@ public class XCardSwitchButton extends XButton { } } } - - + + //SwitchButton对应的XWCardLayout和XWCardTagLayout暂未存到xml中,重新打开时根据父子层关系获取 private void initRelateLayout(){ this.tagLayout = (XWCardTagLayout)this.getBackupParent(); @@ -245,28 +247,28 @@ public class XCardSwitchButton extends XButton { XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent(); this.cardLayout = borderLayout.getCardPart(); } - + //是否进入点击关闭按钮区域 private boolean isSelectedClose(MouseEvent e, FormDesigner designer){ - + int diff = designer.getArea().getHorScrollBar().getValue(); - + // mouse position int ex = e.getX() + diff; int ey = e.getY(); - + //获取tab布局的位置,鼠标相对于tab按钮的位置 XLayoutContainer mainLayout = cardLayout.getBackupParent(); Point point = mainLayout.getLocation(); double mainX = point.getX(); double mainY = point.getY(); - + // 参数界面对坐标的影响 JForm jform = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if(jform.getFormDesign().getParaComponent() != null){ ey -= jform.getFormDesign().getParaHeight(); } - + //减掉tab布局的相对位置 ex -= mainX; ey -= mainY; @@ -281,10 +283,10 @@ public class XCardSwitchButton extends XButton { // 鼠标进入按钮右侧删除图标区域 double recX = position.getX() + titlePoint.getX() + (width - CLOSE_ICON_RIGHT_OFFSET); double recY = position.getY() + titlePoint.getY() + CLOSE_ICON_TOP_OFFSET; - + return (recX < ex && ex < recX + CLOSE_ICON_RIGHT_OFFSET && ey < recY && ey > position.getY()); } - + //将当前switchButton改为选中状态 private void changeButtonState(int index) { for (int i = 0; i < this.tagLayout.getComponentCount(); i++) { @@ -293,7 +295,7 @@ public class XCardSwitchButton extends XButton { tempButton.setShowButton(tempButton.getIndex() == index); } } - + @Override public void paintComponent(Graphics g) { super.paintComponent(g); @@ -306,12 +308,12 @@ public class XCardSwitchButton extends XButton { this.getContentBackground().paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight())); drawCloseIcon(g2d); } - + //画删除图标 private void drawCloseIcon(Graphics2D g2d){ closeIcon.paintIcon(this, g2d, this.getWidth() - LEFT_GAP, 0); } - + //画背景 private void drawBackground(CardSwitchButton button, TitlePacker widgetTitle){ Background background = widgetTitle.getBackground() == null ? ColorBackground.getInstance(NORMAL_GRAL) : widgetTitle.getBackground(); @@ -329,7 +331,7 @@ public class XCardSwitchButton extends XButton { this.setContentBackground(initialBackground == null ? background : initialBackground); } } - + //画标题 private void drawTitle(CardSwitchButton button, TitlePacker widgetTitle) { String titleText = button.getText(); @@ -349,7 +351,7 @@ public class XCardSwitchButton extends XButton { BorderPacker style = this.cardLayout.toData().getBorderStyle(); return style.getTitle(); } - + //删除tab布局 private void deleteTabLayout(SelectionModel selectionModel, FormDesigner designer){ String titleName = this.getContentLabel().getText(); @@ -456,7 +458,8 @@ public class XCardSwitchButton extends XButton { StringBuilder titleStringBuf = new StringBuilder(); TitlePacker title = getWidgetTitle(); FRFont font = title.getFrFont(); - FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), font.getSize() + FONT_SIZE_ADJUST); + int fontSize = font.getSize() + FONT_SIZE_ADJUST; + FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), fontSize); FontMetrics fm = GraphHelper.getFontMetrics(newFont); for (int i = 0; i < titleText.length(); i++) { titleStringBuf.append(titleText.charAt(i)); @@ -470,12 +473,13 @@ public class XCardSwitchButton extends XButton { for (int i = 0; i < verticalTextList.size(); i++) { String paint_str = (String) verticalTextList.get(i); - GraphHelper.drawString(g2d, paint_str, (width - fm.stringWidth(paint_str)) / 2, textY); + GraphHelper.drawString(g2d, paint_str, + (width - fm.stringWidth(paint_str)) / (HALF_NUMBER * 1.0D), textY); textY += textHeight; textY += PT.pt2pix(0, RESLUTION); if (textY > height - textHeight && i < verticalTextList.size() - 1) { textY -= DOTS_HEIGHT; - paintDots(g2d, textY, (width - fm.stringWidth(paint_str)) / 2); + paintDots(g2d, textY, (width - fm.stringWidth(paint_str)) / HALF_NUMBER); break; } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index f2f58f17b3..f17ac09250 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -8,11 +8,15 @@ import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; +import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI; +import com.fr.design.form.util.FormDesignerUtils; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormHierarchyTreePane; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.utils.gui.LayoutUtils; @@ -589,7 +593,11 @@ public class XWTabFitLayout extends XWFitLayout { */ @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - return new WidgetPropertyUIProvider[0]; + if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) { + return new WidgetPropertyUIProvider[] {new MobileBookMarkPropertyUI(this), new MobileBooKMarkUsePropertyUI(this)}; + } else { + return new WidgetPropertyUIProvider[0]; + } } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 10ba5d31f9..f61eb2f8a4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -93,7 +93,7 @@ public class FormCreatorDropTarget extends DropTarget { //SetSelection时要确保选中的是最顶层的布局 //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout XCreator addingXCreator = addingModel.getXCreator(); - Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); + Widget widget = (addingXCreator.getBackupParent() != null && addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); //图表埋点 dealChartBuryingPoint(widget); if (addingXCreator.isShared()) { @@ -257,6 +257,7 @@ public class FormCreatorDropTarget extends DropTarget { */ @Override public synchronized void dropActionChanged(DropTargetDragEvent dtde) { + //do nothing } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ab19002c18..cee0d5b90d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,7 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.extension.FileExtension; import com.fr.base.vcs.DesignerMode; +import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; @@ -12,6 +13,7 @@ import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.cell.FloatElementsProvider; +import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.TargetComponent; import com.fr.design.designer.beans.actions.CopyAction; import com.fr.design.designer.beans.actions.CutAction; @@ -587,6 +589,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm { public RadioDefinePane(XCreator xCreator) { super(xCreator); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java index fb4148629a..7038330697 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java @@ -1,6 +1,7 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icheckbox.UICheckBox; @@ -8,12 +9,11 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.form.ui.container.WLayout; import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -77,6 +77,7 @@ public class MobileBookMarkUsePane extends BasicPane { public void update(XCreator xCreator) { WLayout wLayout = ((WLayout) xCreator.toData()); wLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected()); + WidgetPropertyPane.getInstance().getEditingFormDesigner().getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java index 3ea8d984b2..66870ff6fe 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/NewPresentAction.java @@ -9,9 +9,13 @@ import com.fr.general.GeneralUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; +import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; +import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.StableUtils; +import java.awt.*; + public class NewPresentAction extends PresentCheckBoxAction { private String itemName = null; @@ -28,10 +32,28 @@ public class NewPresentAction extends PresentCheckBoxAction { if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) { CellElementPropertyPane.getInstance().GoToPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Present"), this.itemName); } else { - TemplateCellElement ce = getSelectedCellElement(); - // 只有原来ce设置了形态的情况下才有undo操作 - if (ce != null && ce.getPresent() != null) { - ce.setPresent(null); + ElementCasePane ePane = this.getEditingComponent(); + TemplateElementCase elementCase = ePane.getEditingElementCase(); + Selection sel = ePane.getSelection(); + if (sel instanceof CellSelection) { + CellSelection cs = (CellSelection) sel; + int cellRectangleCount = cs.getCellRectangleCount(); + for (int rect = 0; rect < cellRectangleCount; rect++) { + Rectangle cellRectangle = cs.getCellRectangle(rect); + for (int j = 0; j < cellRectangle.height; j++) { + for (int i = 0; i < cellRectangle.width; i++) { + int column = i + cellRectangle.x; + int row = j + cellRectangle.y; + TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); + if (cellElement == null) { + cellElement = new DefaultTemplateCellElement(column, row); + elementCase.addCellElement(cellElement); + } else if (cellElement.getPresent() != null) { + cellElement.setPresent(null); + } + } + } + } return true; } else { return false; diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java index e97a92b4d1..f3cea39410 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java @@ -88,7 +88,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { Window parentWindow = SwingUtilities.getWindowAncestor(grid); this.biasTextPainterPane = new BiasTextPainterPane(); Dimension dimension = this.biasTextPainterPane.getPreferredSize(); - Dimension wrapDimension = new Dimension((int) (dimension.width * MULTIPLE), (int) (dimension.height * MULTIPLE)); + Dimension wrapDimension = new Dimension((int) (dimension.width * MULTIPLE), (int) (dimension.height * Math.pow(MULTIPLE, 2))); this.biasTextPainterPane.populate(biasTextPainter); return this.biasTextPainterPane.showWindowWithCustomSize(parentWindow, new DialogActionAdapter() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java index d44a9402f6..d504b9d859 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java @@ -9,7 +9,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; -import org.apache.commons.codec.digest.DigestUtils; +import com.fr.third.org.apache.commons.codec.digest.DigestUtils; import java.awt.Desktop; import java.io.IOException; @@ -50,7 +50,7 @@ public class RobotModel extends AlphaCellModel { try { String result = HttpToolbox.get(url); - if(StringUtils.isEmpty(result)){ + if (StringUtils.isEmpty(result)) { return StringUtils.EMPTY; } JSONObject jsonObject = new JSONObject(result); @@ -94,7 +94,7 @@ public class RobotModel extends AlphaCellModel { @Override public final boolean equals(Object obj) { return obj instanceof RobotModel - && AssistUtils.equals(this.title, ((RobotModel)obj).title) + && AssistUtils.equals(this.title, ((RobotModel) obj).title) && AssistUtils.equals(this.content, ((RobotModel) obj).content); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java index 68cc882a92..d090b9e8f1 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java @@ -1,22 +1,18 @@ package com.fr.design.mainframe.messagecollect.solid; +import com.fr.analysis.cloud.solid.SolidRecordExecutor; import com.fr.general.CloudCenter; import com.fr.general.http.HttpToolbox; -import com.fr.json.JSON; -import com.fr.json.JSONFactory; import com.fr.log.FineLoggerFactory; -import com.fr.security.JwtUtils; +import com.fr.rpc.ExceptionHandler; +import com.fr.rpc.RPCInvokerExceptionInfo; import com.fr.stable.CommonUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; -import java.io.IOException; import java.util.HashMap; import java.util.Map; -import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants.REQUEST_SUBJECT; -import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants.TIME_OUT; - /** * 设计器固化信息回传类 * Created by alex sung on 2019/8/22. @@ -24,9 +20,6 @@ import static com.fr.design.mainframe.messagecollect.solid.SolidCollectConstants public class SolidCollector { - private static final String CONTENT_URL = "/v10/collect/solid"; - private static final String DELETE_URL = "/v10/collect/solid/delete"; - private static final String UNLOCK_URL = "/v10/collect/solid/unlock"; private static final String ATTR_CIPHER_TEXT = "cipherText"; private static final String ATTR_SIGNATURE = "signature"; private static final String SOLID_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.solid"); @@ -53,27 +46,22 @@ public class SolidCollector { } FineLoggerFactory.getLogger().info("start to get solid content from server..."); try { - String content = requestContent(); - if (StringUtils.isNotEmpty(content)) { - String cipherText = JSONFactory.createJSON(JSON.OBJECT, content).optString("data"); - if(StringUtils.isNotEmpty(cipherText)){ - Map params = new HashMap<>(); - params.put(ATTR_CIPHER_TEXT, cipherText); - params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature())); - HttpToolbox.post(SOLID_UPLOAD_URL, params); + String cipherText = requestContent(); + if (StringUtils.isNotEmpty(cipherText)) { + Map params = new HashMap<>(); + params.put(ATTR_CIPHER_TEXT, cipherText); + params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature())); + HttpToolbox.post(SOLID_UPLOAD_URL, params); - String deleteUrl = WorkContext.getCurrent().getPath() + DELETE_URL; - HttpToolbox.post(deleteUrl, getParams()); - } + deleteSolidFile(); } FineLoggerFactory.getLogger().info("send solid content to cloud center success."); } catch (Exception e) { FineLoggerFactory.getLogger().info(e.getMessage(), e); } finally { - String unlockUrl = WorkContext.getCurrent().getPath() + UNLOCK_URL; try { - HttpToolbox.post(unlockUrl, getParams()); - } catch (IOException e) { + unlockSolidFile(); + } catch (Exception e) { FineLoggerFactory.getLogger().warn(e.getMessage(), e); } } @@ -81,17 +69,42 @@ public class SolidCollector { /** * 获取服务端固化文件内容 + * * @return 回传内容 */ - public String requestContent() throws Exception { - Map params = new HashMap(); - params.put("token", JwtUtils.createDefaultJWT(REQUEST_SUBJECT, TIME_OUT)); - return HttpToolbox.get(WorkContext.getCurrent().getPath() + CONTENT_URL, params); + private String requestContent() throws Exception { + return WorkContext.getCurrent().get(SolidRecordExecutor.class, new ExceptionHandler() { + @Override + public String callHandler(RPCInvokerExceptionInfo info) { + FineLoggerFactory.getLogger().error(info.getException().getMessage(), info.getException()); + return StringUtils.EMPTY; + } + }).feedBackTask(StringUtils.EMPTY); } - private Map getParams() { - Map params = new HashMap(); - params.put("token", JwtUtils.createDefaultJWT(REQUEST_SUBJECT, TIME_OUT)); - return params; + /** + * 删除服务端固化文件 + */ + private void deleteSolidFile() throws Exception { + WorkContext.getCurrent().get(SolidRecordExecutor.class, new ExceptionHandler() { + @Override + public Void callHandler(RPCInvokerExceptionInfo info) { + FineLoggerFactory.getLogger().error(info.getException().getMessage(), info.getException()); + return null; + } + }).deleteSolidFile(); + } + + /** + * unlock + */ + private void unlockSolidFile() throws Exception { + WorkContext.getCurrent().get(SolidRecordExecutor.class, new ExceptionHandler() { + @Override + public Void callHandler(RPCInvokerExceptionInfo info) { + FineLoggerFactory.getLogger().error(info.getException().getMessage(), info.getException()); + return null; + } + }).unlockSolidFile(); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java index eec7773282..85266b7cd8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/template/info/JWorkBookProcessInfo.java @@ -5,6 +5,7 @@ import com.fr.main.impl.WorkBook; import com.fr.main.parameter.ReportParameterAttr; import com.fr.report.cellcase.CellCase; import com.fr.report.poly.PolyWorkSheet; +import com.fr.report.report.Report; import com.fr.report.worksheet.WorkSheet; import java.util.Iterator; @@ -61,8 +62,12 @@ public class JWorkBookProcessInfo extends TemplateProcessInfo { int blockCount = 0; if (!template.isElementCaseBook()) { // 如果是聚合报表 for (int i = 0; i < template.getReportCount(); i++) { - PolyWorkSheet r = (PolyWorkSheet) template.getReport(i); - blockCount += r.getBlockCount(); + Report report = template.getReport(i); + // 考虑多个sheet下 包含WorkSheet的情况 需要判断下 + if (report instanceof PolyWorkSheet) { + PolyWorkSheet r = (PolyWorkSheet) report; + blockCount += r.getBlockCount(); + } } } return blockCount; diff --git a/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java b/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java index 0406abffb9..39061a4b6d 100644 --- a/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java @@ -14,9 +14,14 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.cell.cellattr.core.RichText; import com.fr.report.cell.cellattr.core.RichTextConverter; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultHighlighter; import javax.swing.text.Element; +import javax.swing.text.Highlighter; import javax.swing.text.StyledDocument; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -44,6 +49,7 @@ public class RichTextEditingPane extends UITextPane{ */ public RichTextEditingPane() { this.addMouseListener(doubleClickFormulaListener); + this.addFocusListener(focusListener); } /** @@ -195,4 +201,34 @@ public class RichTextEditingPane extends UITextPane{ } } }; + + private FocusListener focusListener = new FocusAdapter() { + /** + * 移除高亮,重新选中文本 + * @param e + */ + public void focusGained(FocusEvent e) { + RichTextEditingPane richTextPane = RichTextEditingPane.this; + richTextPane.getHighlighter().removeAllHighlights(); + richTextPane.select(richTextPane.getSelectionStart(), richTextPane.getSelectionEnd()); + } + + /** + * 失去焦点时,被选中的文本保持着被选中时的样式 + * @param e + */ + public void focusLost(FocusEvent e) { + RichTextEditingPane richTextPane = RichTextEditingPane.this; + int start = richTextPane.getSelectionStart(); + int end = richTextPane.getSelectionEnd(); + richTextPane.select(start, end); + Highlighter highlighter = richTextPane.getHighlighter(); + richTextPane.getHighlighter().removeAllHighlights(); + try { + highlighter.addHighlight(start, end, DefaultHighlighter.DefaultPainter); + } catch (BadLocationException exception) { + FineLoggerFactory.getLogger().error(exception.getMessage(), exception); + } + } + }; } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/style/StylePane.java b/designer-realize/src/main/java/com/fr/design/style/StylePane.java index fc53376479..78b0b289cf 100644 --- a/designer-realize/src/main/java/com/fr/design/style/StylePane.java +++ b/designer-realize/src/main/java/com/fr/design/style/StylePane.java @@ -8,8 +8,11 @@ import com.fr.base.NameStyle; import com.fr.base.ScreenResolution; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.fun.MultiStyleUIConfigProvider; +import com.fr.design.fun.StyleUIConfigProvider; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; @@ -19,6 +22,7 @@ import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.FloatElement; @@ -27,7 +31,6 @@ import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.TemplateElementCase; import javax.swing.JComponent; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; @@ -39,6 +42,8 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; +import java.util.List; +import java.util.Set; /** * Style Pane. @@ -49,6 +54,7 @@ public class StylePane extends BasicBeanPane