Browse Source

Merge pull request #1512 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '6c9c51e5e2cf5087f377ee7f74fe66171e25e0b4':
  漏交
  REPORT-28459 JWorkBook未释放问题
feature/big-screen
neil 5 years ago
parent
commit
5dc05f89ed
  1. 1
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 11
      designer-base/src/main/java/com/fr/design/event/RemoveListener.java
  3. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 5
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  5. 8
      designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java
  6. 21
      designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

1
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -114,6 +114,7 @@ public abstract class DesignTableDataManager {
public static void closeTemplate(JTemplate<?, ?> template) { public static void closeTemplate(JTemplate<?, ?> template) {
if (template != null) { if (template != null) {
template.whenClose();
columnCache.remove(getEditingTableDataSource()); columnCache.remove(getEditingTableDataSource());
dsListenersMap.remove(template.getPath()); dsListenersMap.remove(template.getPath());
} }

11
designer-base/src/main/java/com/fr/design/event/RemoveListener.java

@ -0,0 +1,11 @@
package com.fr.design.event;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/19
*/
public interface RemoveListener {
void doRemoveAction();
}

7
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -247,6 +247,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
/**
* 模板关闭时
*/
public void whenClose() {
// do nothing
}
/** /**
* 刷新内部资源 * 刷新内部资源
* *

5
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -1188,4 +1188,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
provider.addChooseFileFilter(fileChooser, this.suffix()); provider.addChooseFileFilter(fileChooser, this.suffix());
} }
} }
@Override
public void whenClose() {
reportComposite.doRemoveAction();
}
} }

8
designer-realize/src/main/java/com/fr/design/mainframe/ReportComponentComposite.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.EditingState; import com.fr.design.designer.EditingState;
import com.fr.design.event.RemoveListener;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.icontainer.UIModeControlContainer;
@ -30,7 +31,7 @@ import java.util.ArrayList;
* @editor zhou * @editor zhou
* @since 2012-3-27下午12:12:05 * @since 2012-3-27下午12:12:05
*/ */
public class ReportComponentComposite extends JComponent { public class ReportComponentComposite extends JComponent implements RemoveListener {
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
@ -250,4 +251,9 @@ public class ReportComponentComposite extends JComponent {
public void fireTargetModified() { public void fireTargetModified() {
parent.fireTargetModified(); parent.fireTargetModified();
} }
@Override
public void doRemoveAction() {
sheetNameTab.doRemoveAction();
}
} }

21
designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java

@ -5,6 +5,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter; import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@ -27,6 +28,7 @@ import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.RemoveListener;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ibutton.UIButtonUI;
@ -44,7 +46,6 @@ import com.fr.poly.PolyDesigner;
import com.fr.report.poly.PolyWorkSheet; import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.TemplateReport; import com.fr.report.report.TemplateReport;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants;
/** /**
* NameTabPane of sheets * NameTabPane of sheets
@ -52,7 +53,7 @@ import com.fr.stable.ProductConstants;
* @editor zhou * @editor zhou
* @since 2012-3-26下午1:45:53 * @since 2012-3-26下午1:45:53
*/ */
public class SheetNameTabPane extends JComponent implements MouseListener, MouseMotionListener { public class SheetNameTabPane extends JComponent implements MouseListener, MouseMotionListener, RemoveListener {
private static final Color LINE_COLOR = new Color(0xababab); private static final Color LINE_COLOR = new Color(0xababab);
@ -140,6 +141,10 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
private boolean isAuthorityEditing = false; private boolean isAuthorityEditing = false;
private ComponentListener listener;
private DesignerFrame designerFrame;
public SheetNameTabPane(ReportComponentComposite reportCompositeX) { public SheetNameTabPane(ReportComponentComposite reportCompositeX) {
this.reportComposite = reportCompositeX; this.reportComposite = reportCompositeX;
this.setLayout(new BorderLayout(0, 0)); this.setLayout(new BorderLayout(0, 0));
@ -203,14 +208,20 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse
} }
} }
}); });
listener = new ComponentAdapter(){
DesignerContext.getDesignerFrame().addComponentListener(new ComponentAdapter(){
@Override public void componentResized(ComponentEvent e) { @Override public void componentResized(ComponentEvent e) {
for (int i = 0; i < lastOneIndex * NUM; i++) { for (int i = 0; i < lastOneIndex * NUM; i++) {
moveLeft(); moveLeft();
} }
} }
}); };
designerFrame = DesignerContext.getDesignerFrame();
designerFrame.addComponentListener(listener);
}
@Override
public void doRemoveAction() {
designerFrame.removeComponentListener(listener);
} }
private ActionListener createLeftButtonActionListener() { private ActionListener createLeftButtonActionListener() {

Loading…
Cancel
Save