diff --git a/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java b/designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java index 64c397da1b..841e6c6e0d 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 c558f0b680..c47f8b195d 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 e2ca3d6088..9c82ffbe9e 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 e2932fbe65..97e6e22458 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;