Browse Source

REPORT-3163 合作开发9.0设计器=>超级链接=》实时保存编辑状态

master
plough 7 years ago
parent
commit
c3d30e3a25
  1. 50
      designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  2. 3
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  3. 4
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  4. 1
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

50
designer/src/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -1,6 +1,10 @@
package com.fr.design.mainframe; 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.design.gui.frpane.HyperlinkGroupPane;
import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; 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.CellElement;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import java.awt.*;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -23,9 +30,21 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
if (singleton == null) { if (singleton == null) {
singleton = new ReportHyperlinkGroupPane(); singleton = new ReportHyperlinkGroupPane();
} }
singleton.refreshPane();
return singleton; 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) { public void populate(ElementCasePane reportPane) {
// TemplateElementCase elementCase = ePane.getEditingElementCase(); // TemplateElementCase elementCase = ePane.getEditingElementCase();
// if (elementCase == null) { // if (elementCase == null) {
@ -52,4 +71,35 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
return nameHyperlinks; 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);
}
});
}
}
} }

3
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; this.cardPane = cardPane;
} }
public abstract void saveSettings();
protected void initComponentPane() { protected void initComponentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creators = this.createNameableCreators(); this.creators = this.createNameableCreators();
@ -271,6 +273,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
return; return;
} }
} }
saveSettings();
setVisible(false); setVisible(false);
} }

4
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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
@ -92,6 +94,8 @@ public abstract class UIListControlPane extends UIControlPane {
((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).update(); ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).update();
((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate(); ((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate();
UIListControlPane.this.checkButtonEnabled(); UIListControlPane.this.checkButtonEnabled();
// plough:感觉每次valueChange都保存一下,会稍微影响效率
saveSettings();
} }
} }
}); });

1
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.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;

Loading…
Cancel
Save