From c3d30e3a251518cd7009fe2bc85b93b973d7bffa Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 25 Jul 2017 17:43:31 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=3D=E3=80=8B=E5=AE=9E=E6=97=B6=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=BC=96=E8=BE=91=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/ReportHyperlinkGroupPane.java | 50 +++++++++++++++++++ .../design/gui/controlpane/UIControlPane.java | 3 ++ .../gui/controlpane/UIListControlPane.java | 4 ++ .../design/gui/frpane/HyperlinkGroupPane.java | 1 + 4 files changed, 58 insertions(+) diff --git a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java index 64c397da1..841e6c6e0 100644 --- a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java +++ b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java @@ -1,6 +1,10 @@ package com.fr.design.mainframe; +import com.fr.base.Style; +import com.fr.design.actions.utils.ReportActionUtils; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.frpane.HyperlinkGroupPane; +import com.fr.general.FRFont; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; @@ -8,6 +12,9 @@ import com.fr.js.NameJavaScriptGroup; import com.fr.report.cell.CellElement; import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; +import com.fr.stable.Constants; + +import java.awt.*; /** * Created by plough on 2017/7/21. @@ -23,9 +30,21 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { if (singleton == null) { singleton = new ReportHyperlinkGroupPane(); } + singleton.refreshPane(); return singleton; } + private void refreshPane() { + ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); + if (reportPane == null) { + return; + } +// + final TemplateElementCase report = reportPane.getEditingElementCase(); + NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); + populate(nameHyperlinks); + } + public void populate(ElementCasePane reportPane) { // TemplateElementCase elementCase = ePane.getEditingElementCase(); // if (elementCase == null) { @@ -52,4 +71,35 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane { return nameHyperlinks; } + + @Override + public void saveSettings() { + ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); + if (reportPane == null) { + return; + } + final TemplateElementCase report = reportPane.getEditingElementCase(); + final Selection sel = reportPane.getSelection(); + final NameJavaScriptGroup updateNameHyperlinks = updateJSGroup(); + if (sel instanceof FloatSelection) { + FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); + selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks); + } else { + ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new ReportActionUtils.IterAction() { + public void dealWith(CellElement editCellElement) { + Style elementStyle = editCellElement.getStyle(); + FRFont frFont = elementStyle.getFRFont(); + if (updateNameHyperlinks.size() > 0) { + frFont = frFont.applyForeground(Color.blue); + frFont = frFont.applyUnderline(Constants.LINE_THIN); + } else { + frFont = frFont.applyForeground(Color.black); + frFont = frFont.applyUnderline(Constants.LINE_NONE); + } + editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); + editCellElement.setNameHyperlinkGroup(updateNameHyperlinks); + } + }); + } + } } diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index c558f0b68..c47f8b195 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -89,6 +89,8 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH this.cardPane = cardPane; } + public abstract void saveSettings(); + protected void initComponentPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.creators = this.createNameableCreators(); @@ -271,6 +273,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH return; } } + saveSettings(); setVisible(false); } diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index e2ca3d608..9c82ffbe9 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -36,6 +36,8 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -92,6 +94,8 @@ public abstract class UIListControlPane extends UIControlPane { ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).update(); ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate(); UIListControlPane.this.checkButtonEnabled(); + // plough:感觉每次valueChange都保存一下,会稍微影响效率 + saveSettings(); } } }); diff --git a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java index e2932fbe6..97e6e2245 100644 --- a/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -5,6 +5,7 @@ import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.module.DesignModuleFactory; import com.fr.general.Inter; import com.fr.general.NameObject;