Browse Source

REPORT-3163 合作开发9.0设计器=>超级链接=>优化保存设置的时机,可正常撤销、重做;修复bug;完成

master
plough 7 years ago
parent
commit
48edcf18da
  1. 3
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  2. 7
      designer/src/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java
  3. 23
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  4. 3
      designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

3
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -61,8 +61,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
if (editingTemplate != null && !editingTemplate.isUpMode()) { if (editingTemplate != null && !editingTemplate.isUpMode()) {
// 模板初始化完成后,才能初始化超级链接面板 // 模板初始化完成后,才能初始化超级链接面板
// HyperlinkGroupPane hyperlinkGroupPane = ReportHyperlinkGroupPane.getInstance(HyperlinkGroupPaneActionImpl.getInstance()); // HyperlinkGroupPane hyperlinkGroupPane = ReportHyperlinkGroupPane.getInstance(HyperlinkGroupPaneActionImpl.getInstance());
HyperlinkGroupPane hyperlinkGroupPane = DesignerContext.getDesignerFrame().getSelectedJTemplate() HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this); hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) { if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);

7
designer/src/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java

@ -59,11 +59,12 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro
@Override @Override
public void saveSettings(HyperlinkGroupPane hyperlinkGroupPane) { public void saveSettings(HyperlinkGroupPane hyperlinkGroupPane) {
TargetComponent tc = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); // plough: 需要判断设计器是否初始化完成,不能用 HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()
if (tc == null) { JTemplate jt = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (jt == null) {
return; return;
} }
ElementCasePane reportPane = (ElementCasePane)tc; ElementCasePane reportPane = (ElementCasePane)jt.getCurrentElementCasePane();
final TemplateElementCase report = reportPane.getEditingElementCase(); final TemplateElementCase report = reportPane.getEditingElementCase();
final Selection sel = reportPane.getSelection(); final Selection sel = reportPane.getSelection();
final NameJavaScriptGroup updateNameHyperlinks = hyperlinkGroupPane.updateJSGroup(); final NameJavaScriptGroup updateNameHyperlinks = hyperlinkGroupPane.updateJSGroup();

23
designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

@ -29,6 +29,8 @@ import com.fr.stable.Nameable;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
@ -55,6 +57,7 @@ public abstract class UIListControlPane extends UIControlPane {
protected int editingIndex; protected int editingIndex;
protected String selectedName; protected String selectedName;
private boolean isNameRepeated = false; private boolean isNameRepeated = false;
protected boolean isPopulating = false;
public UIListControlPane() { public UIListControlPane() {
this.initComponentPane(); this.initComponentPane();
@ -94,9 +97,23 @@ 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都保存一下,会稍微影响效率 }
}
});
nameableList.getModel().addListDataListener(new ListDataListener() {
@Override
public void intervalAdded(ListDataEvent e) {
saveSettings();
}
@Override
public void intervalRemoved(ListDataEvent e) {
saveSettings(); saveSettings();
} }
@Override
public void contentsChanged(ListDataEvent e) {
saveSettings();
} }
}); });
} }
@ -179,9 +196,11 @@ public abstract class UIListControlPane extends UIControlPane {
@Override @Override
public void populate(Nameable[] nameableArray) { public void populate(Nameable[] nameableArray) {
isPopulating = true; // 加一个标识位,避免切换单元格时,触发 saveSettings
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
listModel.removeAllElements(); listModel.removeAllElements();
if (ArrayUtils.isEmpty(nameableArray)) { if (ArrayUtils.isEmpty(nameableArray)) {
isPopulating = false;
return; return;
} }
@ -193,6 +212,8 @@ public abstract class UIListControlPane extends UIControlPane {
this.nameableList.setSelectedIndex(0); this.nameableList.setSelectedIndex(0);
} }
this.checkButtonEnabled(); this.checkButtonEnabled();
isPopulating = false;
} }
/** /**

3
designer_base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -99,6 +99,9 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override @Override
public void saveSettings() { public void saveSettings() {
if (isPopulating) {
return;
}
hyperlinkGroupPaneActionProvider.saveSettings(this); hyperlinkGroupPaneActionProvider.saveSettings(this);
} }
} }
Loading…
Cancel
Save