Browse Source

REPORT-28813 bugfix 消除过多重复代码

feature/big-screen
Java.Edge 5 years ago
parent
commit
68be58f8ce
  1. 10
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  2. 64
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java
  3. 64
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

10
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -918,9 +918,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
actionMap.put("paste", new AbstractAction() { actionMap.put("paste", new AbstractAction() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (paste()) { if (paste()) {
QuickEditorRegion.getInstance().populate(getCurrentEditor()); afterPasteAction();
fireTargetModified();
QuickEditorRegion.getInstance().populate(getCurrentEditor());
} }
} }
}); });
@ -942,6 +940,12 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}); });
} }
protected void afterPasteAction() {
QuickEditorRegion.getInstance().populate(getCurrentEditor());
fireTargetModified();
QuickEditorRegion.getInstance().populate(getCurrentEditor());
}
/** /**
* 是否列表头可见 * 是否列表头可见
* *

64
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -15,7 +15,6 @@ import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.merge.MergeCellAction; import com.fr.design.actions.edit.merge.MergeCellAction;
import com.fr.design.actions.edit.merge.UnmergeCellAction; import com.fr.design.actions.edit.merge.UnmergeCellAction;
import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
@ -36,17 +35,9 @@ import com.fr.page.ReportSettingsProvider;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块. * 类说明: 设计面板中最上方的"插入" "单元格"下拉列表Menu模块.
@ -123,61 +114,6 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
} }
} }
@Override
protected void initInputActionMap() {
InputMap inputMapAncestor = this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap actionMap = this.getActionMap();
inputMapAncestor.clear();
actionMap.clear();
if (!DesignModeContext.isBanCopyAndCut()) {
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), "cut");
actionMap.put("cut", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (cut()) {
fireTargetModified();
}
}
});
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy");
actionMap.put("copy", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
copy();
}
});
}
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), "paste");
actionMap.put("paste", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (paste()) {
refreshPropertyPanes();
repaint();
}
}
});
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete_content");
actionMap.put("delete_content", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (clearContents()) {
fireTargetModified();
}
}
});
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, DEFAULT_MODIFIER), "delete_all");
actionMap.put("delete_all", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (clearAll()) {
fireTargetModified();
}
}
});
}
@Override @Override
protected boolean supportRepeatedHeaderFooter() { protected boolean supportRepeatedHeaderFooter() {
return true; return true;

64
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

@ -6,7 +6,6 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.form.FormECBackgroundAction; import com.fr.design.actions.form.FormECBackgroundAction;
import com.fr.design.actions.form.FormECColumnsAction; import com.fr.design.actions.form.FormECColumnsAction;
import com.fr.design.actions.form.FormECFrozenAction; import com.fr.design.actions.form.FormECFrozenAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
@ -24,16 +23,8 @@ import com.fr.report.worksheet.FormElementCase;
import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener; import com.fr.design.selection.SelectionListener;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
*/ */
@ -79,58 +70,9 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
} }
@Override @Override
protected void initInputActionMap() { protected void afterPasteAction() {
InputMap inputMapAncestor = this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); refreshPropertyPanes();
ActionMap actionMap = this.getActionMap(); repaint();
inputMapAncestor.clear();
actionMap.clear();
if (!DesignModeContext.isBanCopyAndCut()) {
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), "cut");
actionMap.put("cut", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (cut()) {
fireTargetModified();
}
}
});
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy");
actionMap.put("copy", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
copy();
}
});
}
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), "paste");
actionMap.put("paste", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (paste()) {
refreshPropertyPanes();
repaint();
}
}
});
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "delete_content");
actionMap.put("delete_content", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (clearContents()) {
fireTargetModified();
}
}
});
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, DEFAULT_MODIFIER), "delete_all");
actionMap.put("delete_all", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
if (clearAll()) {
fireTargetModified();
}
}
});
} }
@Override @Override

Loading…
Cancel
Save