Browse Source

无任务,slider和quickeditor的内存问题

master
yaoh.wu 7 years ago
parent
commit
f2b67d482d
  1. 14
      designer-base/src/com/fr/design/actions/core/ActionFactory.java
  2. 13
      designer-base/src/com/fr/design/file/MutilTempalteTabPane.java
  3. 45
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  4. 80
      designer-base/src/com/fr/design/mainframe/JFormSliderPane.java
  5. 73
      designer-base/src/com/fr/design/mainframe/JSliderPane.java
  6. 9
      designer-base/src/com/fr/design/selection/QuickEditor.java
  7. 18
      designer-form/src/com/fr/design/mainframe/WidgetToolBarPane.java
  8. 55
      designer-realize/src/com/fr/design/dscolumn/DSColumnBasicPane.java
  9. 7
      designer-realize/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java
  10. 173
      designer-realize/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  11. 2
      designer-realize/src/com/fr/design/mainframe/ElementCasePane.java
  12. 3
      designer-realize/src/com/fr/design/mainframe/ReportComponentComposite.java
  13. 5
      designer-realize/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java
  14. 32
      designer-realize/src/com/fr/design/module/DesignerModule.java
  15. 40
      designer-realize/src/com/fr/grid/selection/CellSelection.java
  16. 17
      designer-realize/src/com/fr/grid/selection/FloatSelection.java
  17. 14
      designer-realize/src/com/fr/quickeditor/FloatQuickEditor.java
  18. 283
      designer-realize/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  19. 7
      designer-realize/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  20. 2
      designer-realize/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  21. 6
      designer-realize/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  22. 8
      designer-realize/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java
  23. 66
      designer-realize/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

14
designer-base/src/com/fr/design/actions/core/ActionFactory.java

@ -55,6 +55,20 @@ public class ActionFactory {
private ActionFactory() {
}
/**
* 元素编辑器释放模板对象
*/
public static void editorRelease() {
for (Map.Entry<Class, QuickEditor> entry : cellEditor.entrySet()) {
entry.getValue().release();
}
for (Map.Entry<Class, QuickEditor> entry : floatEditor.entrySet()) {
entry.getValue().release();
}
}
/**
* 注册无需每次实例化的单元格元素编辑器
*

13
designer-base/src/com/fr/design/file/MutilTempalteTabPane.java

@ -711,23 +711,12 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) {
specifiedTemplate.saveTemplate();
FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."}));
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
} else if (returnVal == JOptionPane.NO_OPTION) {
//不保存
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
}
//若是点击取消关闭,则什么都不做
} else {
//若是已经保存过了,则关闭即可
}
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
}
}
/**
* 关闭模板
*

45
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -10,12 +10,17 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.*;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight;
@ -49,13 +54,39 @@ import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.*;
import java.awt.event.*;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@ -734,6 +765,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板.
*/
public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) {
return;
}
@ -750,6 +783,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板
*/
public void activateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) {
return;
}

80
designer-base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -14,13 +14,33 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
/**
@ -51,7 +71,6 @@ public class JFormSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JFormSliderPane THIS;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider;
@ -62,7 +81,7 @@ public class JFormSliderPane extends JPanel {
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
@ -83,7 +102,7 @@ public class JFormSliderPane extends JPanel {
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
@ -91,7 +110,7 @@ public class JFormSliderPane extends JPanel {
initShowValButton();
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(1, 0, 0));
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
@ -100,17 +119,13 @@ public class JFormSliderPane extends JPanel {
this.add(panel, BorderLayout.NORTH);
}
public static final JFormSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JFormSliderPane();
return THIS;
public static JFormSliderPane getInstance() {
return new JFormSliderPane();
}
private void initSlider() {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED){
public Point getToolTipLocation(MouseEvent event){
slider = new UISlider(0, HUNDRED, HALF_HUNDRED) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -123,8 +138,8 @@ public class JFormSliderPane extends JPanel {
}
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)){
public Point getToolTipLocation(MouseEvent event){
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -134,16 +149,16 @@ public class JFormSliderPane extends JPanel {
}
private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")){
public Point getToolTipLocation(MouseEvent event){
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
downButton.setOpaque(false);
downButton.setBorderPainted(false);
downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")){
public Point getToolTipLocation(MouseEvent event){
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -164,10 +179,11 @@ public class JFormSliderPane extends JPanel {
showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
}
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
@ -176,7 +192,7 @@ public class JFormSliderPane extends JPanel {
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
@ -194,7 +210,7 @@ public class JFormSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
@ -217,7 +233,7 @@ public class JFormSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR);
@ -227,7 +243,7 @@ public class JFormSliderPane extends JPanel {
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()}
@ -247,14 +263,14 @@ public class JFormSliderPane extends JPanel {
return spinnerPanel;
}
ActionListener showValButtonActionListener = new ActionListener() {
private ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
@ -277,7 +293,7 @@ public class JFormSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() {
private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
@ -296,7 +312,7 @@ public class JFormSliderPane extends JPanel {
}
};
ItemListener radioButtonItemListener = new ItemListener() {
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
@ -312,7 +328,7 @@ public class JFormSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) {
} else {
slider.setValue(HALF_HUNDRED);
}
}
@ -336,7 +352,7 @@ public class JFormSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
private ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();

73
designer-base/src/com/fr/design/mainframe/JSliderPane.java

@ -15,13 +15,34 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@ -59,7 +80,6 @@ public class JSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider;
@ -70,12 +90,14 @@ public class JSliderPane extends JPanel {
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
/**
* 拖动条处理和button直接输入不一样
*/
private boolean isButtonOrIsTxt = true;
private PopupPane dialog;
private int upButtonX;
@ -91,7 +113,7 @@ public class JSliderPane extends JPanel {
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
@ -99,7 +121,7 @@ public class JSliderPane extends JPanel {
initShowValButton();
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(1, 0, 0));
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
@ -109,12 +131,8 @@ public class JSliderPane extends JPanel {
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
public static JSliderPane getInstance() {
return new JSliderPane();
}
private void initSlider() {
@ -178,7 +196,7 @@ public class JSliderPane extends JPanel {
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
@ -187,7 +205,7 @@ public class JSliderPane extends JPanel {
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
@ -205,7 +223,7 @@ public class JSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
@ -228,7 +246,7 @@ public class JSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
selfAdaptButton.setBackground(BACK_COLOR);
@ -238,7 +256,7 @@ public class JSliderPane extends JPanel {
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{selfAdaptButton, null},
@ -259,14 +277,14 @@ public class JSliderPane extends JPanel {
return spinnerPanel;
}
ActionListener showValButtonActionListener = new ActionListener() {
private ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
@ -289,7 +307,7 @@ public class JSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() {
private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
@ -309,7 +327,7 @@ public class JSliderPane extends JPanel {
}
};
ItemListener radioButtonItemListener = new ItemListener() {
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
@ -325,7 +343,7 @@ public class JSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) {
} else {
slider.setValue(HALF_HUNDRED);
}
}
@ -343,7 +361,7 @@ public class JSliderPane extends JPanel {
return this.showValue;
}
public void reset(){
public void reset() {
this.showValSpinner.setValue(HUNDRED);
}
@ -353,7 +371,7 @@ public class JSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
private ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
@ -390,7 +408,7 @@ public class JSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else {
times = (int) (SIX * value - TWO_HUNDRED);
times = SIX * value - TWO_HUNDRED;
}
}
@ -448,11 +466,9 @@ class JSliderPaneUI extends BasicSliderUI {
super(b);
}
/** */
/**
* 绘制指示物
*/
public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g;
@ -460,7 +476,6 @@ class JSliderPaneUI extends BasicSliderUI {
g2d.dispose();
}
/** */
/**
* 绘制刻度轨迹
*/

9
designer-base/src/com/fr/design/selection/QuickEditor.java

@ -2,7 +2,7 @@ package com.fr.design.selection;
import com.fr.design.designer.TargetComponent;
import javax.swing.*;
import javax.swing.JComponent;
/**
* 快速编辑区域
@ -39,11 +39,15 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
tc.fireTargetModified();
}
/**
* 刷新面板
*/
protected abstract void refresh();
/**
* for 关闭时候释放
* 关闭模板时释放模板对象
* 所有持有tc的对象也必须置空或者丢弃对于tc的引用
*/
public void release() {
tc = null;
@ -53,7 +57,6 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
@Override
protected void refresh() {
}
};

18
designer-form/src/com/fr/design/mainframe/WidgetToolBarPane.java

@ -10,8 +10,20 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Stroke;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.ImageObserver;
@ -47,7 +59,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide
}
public void refreshToolbar() {
reset();
singleton.reset();
}
public static void refresh() {

55
designer-realize/src/com/fr/design/dscolumn/DSColumnBasicPane.java

@ -14,8 +14,9 @@ import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -27,6 +28,29 @@ public class DSColumnBasicPane extends BasicPane {
private ExpandDirectionPane expandDirectionPane;
private CellElement cellElement;
private ActionListener summaryDirectionActionlistener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(true);
}
}
};
private ActionListener othergroupDirectionActionlistener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(false);
}
}
};
private ActionListener sdcupdateActionlistener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
selectDataColumnPane.update(cellElement);
}
};
public DSColumnBasicPane() {
this(DSColumnPane.SETTING_ALL);
}
@ -78,7 +102,7 @@ public class DSColumnBasicPane extends BasicPane {
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER);
this.resultSetGroupPane.addListeners(summary_direction_ActionListener, otherGroup_direction_ActionListener, sdcUpdate_ActionListener);
this.resultSetGroupPane.addListeners(summaryDirectionActionlistener, othergroupDirectionActionlistener, sdcupdateActionlistener);
}
@Override
@ -93,7 +117,7 @@ public class DSColumnBasicPane extends BasicPane {
this.cellElement = cellElement;
selectDataColumnPane.populate(source, cellElement);
selectDataColumnPane.populate(source, cellElement, null);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (conditionParentPane != null) {
@ -134,29 +158,6 @@ public class DSColumnBasicPane extends BasicPane {
resultSetGroupPane.update();
}
ActionListener summary_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(true);
}
}
};
ActionListener otherGroup_direction_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (expandDirectionPane != null) {
expandDirectionPane.setNoneRadioButtonSelected(false);
}
}
};
ActionListener sdcUpdate_ActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
selectDataColumnPane.update(cellElement);
}
};
public void putElementcase(ElementCasePane t) {
if (conditionParentPane != null) {
conditionParentPane.putElementcase(t);

7
designer-realize/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java

@ -6,7 +6,7 @@ import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.main.impl.WorkBook;
import com.fr.report.cell.TemplateCellElement;
import java.awt.*;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Iterator;
@ -17,6 +17,7 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
super(false);
}
@Override
protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(new WorkBook());
tableNameComboBox.addItemListener(new ItemListener() {
@ -32,14 +33,14 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
tableNameComboBox.refresh(source);
tableNameComboBox.setEditable(false);
tableNameComboBox.setEnabled(false);
super.populate(source, cell);
super.populate(source, cell, null);
try {
Iterator it = source.getTableDataNameIterator();
String name = (String) it.next();
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name);
tableNameComboBox.setSelectedItem(wrapper);
tableNameComboBox.getModel().setSelectedItem(wrapper);
} catch (Exception e) {
} catch (Exception ignored) {
}
}
}

173
designer-realize/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -26,14 +26,18 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
/**
@ -45,27 +49,83 @@ import java.util.regex.Pattern;
* @since 8.0
*/
public class SelectedDataColumnPane extends BasicPane {
/**
* 参数编辑器面板
*/
private UITableEditorPane<ParameterProvider> editorPane;
/**
* 参数
*/
private Parameter[] ps;
/**
* 数据集下拉框
*/
TableDataComboBox tableNameComboBox;
/**
* 动态参数注入按钮
*/
private UIButton paramButton;
/**
* 数据列下拉框
*/
LazyComboBox columnNameComboBox;
/**
* 数据集下拉框和数据列下拉框监听器
*/
private ItemListener itemListener;
private UIButton paramButton;
public SelectedDataColumnPane() {
this(true, false, null, null);
/**
* 当前编辑的模板面板用于触发保存操作
*/
private ElementCasePane casePane;
/**
* 保存当前选中的 CE
*/
private CellElement cellElement;
private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile("[^\\d]");
/**
* 数据集下拉框变动后修改数据列下拉框加载状态的监听器
*/
private ItemListener isNeedReloadListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
columnNameComboBox.setLoaded(false);
}
}
};
/**
* 创建横向布局附带显示动态参数注入按钮的数据集数据列选择面板
*/
SelectedDataColumnPane() {
this(true, false);
}
public SelectedDataColumnPane(boolean showParameterButton) {
this(showParameterButton, false, null, null);
/**
* 创建横向布局的数据集数据列选择面板
*
* @param showParameterButton 是否显示动态参数注入按钮
*/
SelectedDataColumnPane(boolean showParameterButton) {
this(showParameterButton, false);
}
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane, TemplateCellElement cellElement) {
/**
* 创建数据集数据列选择面板
*
* @param showParameterButton 是否显示动态参数注入按钮
* @param verticalLayout 是否是垂直布局
*/
public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout) {
if (verticalLayout) {
initComponentVerticalLayout(casePane, cellElement);
initComponentVerticalLayout();
} else {
initComponent(showParameterButton);
}
@ -79,7 +139,7 @@ public class SelectedDataColumnPane extends BasicPane {
public void initComponent(boolean showParameterButton) {
initTableNameComboBox();
if (showParameterButton) {
initWithParameterButton();
initParameterButton();
}
columnNameComboBox = new LazyComboBox() {
@ -119,9 +179,9 @@ public class SelectedDataColumnPane extends BasicPane {
/**
* 初始化竖直布局的组件
*/
public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) {
private void initComponentVerticalLayout() {
initTableNameComboBox();
initWithParameterButton(casePane, cellElement);
initVerticalParameterButton();
columnNameComboBox = new LazyComboBox() {
@Override
public Object[] load() {
@ -149,13 +209,22 @@ public class SelectedDataColumnPane extends BasicPane {
}
public void populate(TableDataSource source, TemplateCellElement cellElement) {
/**
* 更新面板数据
*
* @param source 数据源
* @param cellElement 单元格
* @param casePane 当前编辑的模板面板
*/
public void populate(TableDataSource source, TemplateCellElement cellElement, ElementCasePane casePane) {
tableNameComboBox.refresh(source);
this.casePane = casePane;
if (cellElement == null) {
return;
}
if (itemListener != null) {
removeListener(itemListener);
}
this.cellElement = cellElement;
removeListener();
Object value = cellElement.getValue();
if (!(value instanceof DSColumn)) {
return;
@ -166,9 +235,14 @@ public class SelectedDataColumnPane extends BasicPane {
columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn()));
ps = dsColumn.getParameters();
addListener(itemListener);
addListener();
}
/**
* 保存数据到单元格对象中
*
* @param cellElement 单元格
*/
public void update(CellElement cellElement) {
if (cellElement == null) {
return;
@ -177,7 +251,7 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) {
return;
}
DSColumn dsColumn = null;
DSColumn dsColumn;
if (value == null || !(value instanceof DSColumn)) {
dsColumn = new DSColumn();
cellElement.setValue(dsColumn);
@ -185,18 +259,27 @@ public class SelectedDataColumnPane extends BasicPane {
dsColumn = (DSColumn) cellElement.getValue();
SimpleDSColumn simpleDSColumn = updateColumnPane();
dsColumn.setDSName(simpleDSColumn.getDsName());
dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName());
dsColumn.setColumn(simpleDSColumn.getColumn());
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
}
/**
* 释放模板对象
*/
public void release() {
this.cellElement = null;
this.casePane = null;
this.tableNameComboBox.setModel(new DefaultComboBoxModel());
}
/**
* 更新面板
*
* @return 更新后的值
*/
public SimpleDSColumn updateColumnPane() {
private SimpleDSColumn updateColumnPane() {
SimpleDSColumn dsColumn = new SimpleDSColumn();
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem();
if (tableDataWrappe == null) {
@ -206,9 +289,8 @@ public class SelectedDataColumnPane extends BasicPane {
TableDataColumn column;
String columnExp = (String) this.columnNameComboBox.getSelectedItem();
if (isColumnName(columnExp)) {
String number = columnExp.substring(1);
Pattern pattern = Pattern.compile("[^\\d]");
if (pattern.matcher(number).find()) {
String number = Objects.requireNonNull(columnExp).substring(1);
if (COLUMN_NAME_PATTERN.matcher(number).find()) {
column = TableDataColumn.createColumn(columnExp);
} else {
int serialNumber = Integer.parseInt(columnExp.substring(1));
@ -221,36 +303,31 @@ public class SelectedDataColumnPane extends BasicPane {
return dsColumn;
}
public void setListener(ItemListener i) {
this.itemListener = i;
}
/**
* 添加监听事件
*
* @param i 监听事件
*/
public void addListener(ItemListener i) {
itemListener = i;
tableNameComboBox.addItemListener(i);
columnNameComboBox.addItemListener(i);
private void addListener() {
tableNameComboBox.addItemListener(this.itemListener);
columnNameComboBox.addItemListener(this.itemListener);
tableNameComboBox.addItemListener(this.isNeedReloadListener);
}
/**
* 移除监听事件
*
* @param i 监听事件
*/
public void removeListener(ItemListener i) {
tableNameComboBox.removeItemListener(i);
columnNameComboBox.removeItemListener(i);
private void removeListener() {
tableNameComboBox.removeItemListener(this.itemListener);
columnNameComboBox.removeItemListener(this.itemListener);
tableNameComboBox.removeItemListener(this.isNeedReloadListener);
}
protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
columnNameComboBox.setLoaded(false);
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20));
}
@ -260,8 +337,8 @@ public class SelectedDataColumnPane extends BasicPane {
}
private void initWithParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
private void initParameterButton() {
editorPane = new UITableEditorPane<>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -279,18 +356,18 @@ public class SelectedDataColumnPane extends BasicPane {
});
}
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) {
final SelectedDataColumnPane that = this;
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
private void initVerticalParameterButton() {
editorPane = new UITableEditorPane<>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection"));
paramButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
List<ParameterProvider> parameterList = editorPane.update();
ps = parameterList.toArray(new Parameter[parameterList.size()]);
that.update(cellElement);
update(SelectedDataColumnPane.this.cellElement);
casePane.fireTargetModified();
}
});
@ -310,6 +387,6 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList();
}
return new ArrayList<String>();
return new ArrayList<>();
}
}

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

@ -524,6 +524,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* 因为这边判断selection是一个selection所以不会触发fireSelectionChanged
*/
public void setSelection(Selection selection) {
//旧选中内容编辑器释放模板对象
this.getCurrentEditor().release();
if (!ComparatorUtils.equals(this.selection, selection) ||
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
this.selection = selection;

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

@ -127,10 +127,9 @@ public class ReportComponentComposite extends JComponent {
templateStateList.add(null);
}
centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement());
if (jSliderContainer != null){
jSliderContainer=JSliderPane.getInstance();
jSliderContainer.reset();
}
}
if (centerCardPane.editingComponet.elementCasePane == null) {
centerCardPane.getPolyDezi().polyArea.addMouseWheelListener(showValSpinnerMouseWheelListener);

5
designer-realize/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java

@ -120,4 +120,9 @@ public abstract class AbstractDSCellEditorPane extends JPanel {
scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP);
scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground()));
}
/**
* 释放tc
*/
protected abstract void release();
}

32
designer-realize/src/com/fr/design/module/DesignerModule.java

@ -150,23 +150,23 @@ public class DesignerModule extends DesignModule {
*/
private void registerCellEditor() {
ActionFactory.registerCellEditorClass(String.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditorClass(Number.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditorClass(BaseFormula.class, CellFormulaQuickEditor.class);
ActionFactory.registerCellEditorClass(SubReport.class, CellSubReportEditor.class);
ActionFactory.registerCellEditorClass(RichText.class, CellRichTextEditor.class);
ActionFactory.registerCellEditorClass(DSColumn.class, CellDSColumnEditor.class);
ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class);
ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor());
ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor());
ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor());
ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
try {
ActionFactory.registerCellEditorClass(provider.targetObjectClass(), provider.quickEditor());
ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance());
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
@ -185,12 +185,12 @@ public class DesignerModule extends DesignModule {
*/
private void registerFloatEditor() {
ActionFactory.registerFloatEditorClass(String.class, FloatStringQuickEditor.class);
ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class);
ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class);
}

40
designer-realize/src/com/fr/grid/selection/CellSelection.java

@ -49,8 +49,9 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU;
import javax.swing.*;
import java.awt.*;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -114,6 +115,7 @@ public class CellSelection extends Selection {
/**
* 增加选中的区域
*
* @param cellRectangle 区域
*/
public void addCellRectangle(Rectangle cellRectangle) {
@ -164,6 +166,7 @@ public class CellSelection extends Selection {
/**
* 清除区域块
*
* @param i 区域块
*/
public void clearCellRectangles(int i) {
@ -172,6 +175,7 @@ public class CellSelection extends Selection {
/**
* 包含单元格
*
* @param column
* @param row
* @return 若不包含返回-1
@ -205,6 +209,7 @@ public class CellSelection extends Selection {
/**
* 转换成矩形
*
* @return 矩形
*/
public Rectangle toRectangle() {
@ -213,6 +218,7 @@ public class CellSelection extends Selection {
/**
* 是否选择一个单元格
*
* @param ePane 区域
* @return 是则返回rue
*/
@ -239,6 +245,7 @@ public class CellSelection extends Selection {
/**
* 作为可传输的
*
* @param transferable 传输介质
* @param ePane 区域
*/
@ -251,12 +258,12 @@ public class CellSelection extends Selection {
TemplateCellElement cellElement = (TemplateCellElement) cells.next();
list.add((TemplateCellElement) cellElement.deriveCellElement(cellElement.getColumn() - column, cellElement.getRow() - row));
}
FU [] columnWidth = new FU[columnSpan];
FU [] rowHeight = new FU[rowSpan];
for (int i = 0; i < columnSpan; i++){
FU[] columnWidth = new FU[columnSpan];
FU[] rowHeight = new FU[rowSpan];
for (int i = 0; i < columnSpan; i++) {
columnWidth[i] = ec.getColumnWidth(this.column + i);
}
for (int j = 0; j < rowSpan; j++){
for (int j = 0; j < rowSpan; j++) {
rowHeight[j] = ec.getRowHeight(this.row + j);
}
transferable.addObject(new CellElementsClip(this.columnSpan, this.rowSpan, columnWidth, rowHeight, list.toArray(new TemplateCellElement[list.size()])));
@ -264,6 +271,7 @@ public class CellSelection extends Selection {
/**
* 黏贴单元格
*
* @param ceClip 单元格
* @param ePane 区域
* @return 成功返回true
@ -281,6 +289,7 @@ public class CellSelection extends Selection {
/**
* 黏贴字符串
*
* @param str 字符串
* @param ePane 区域
* @return 成功返回true
@ -329,6 +338,7 @@ public class CellSelection extends Selection {
/**
* 黏贴其他
*
* @param ob 要黏贴的东西
* @param ePane 区域
* @return 成功返回true
@ -352,6 +362,7 @@ public class CellSelection extends Selection {
/**
* 是否能合并单元格
*
* @param ePane 区域
* @return 是则返回true
*/
@ -363,6 +374,7 @@ public class CellSelection extends Selection {
/**
* 合并单元格
*
* @param ePane 区域
* @return 成功返回true
*/
@ -371,7 +383,7 @@ public class CellSelection extends Selection {
TemplateElementCase ec = ePane.getEditingElementCase();
Iterator cells = ec.intersect(column, row, columnSpan, rowSpan);
if (cells.hasNext() && cells.hasNext()) { // alex:有两个以上的格子在这个区域内
if (cells.hasNext()) { // alex:有两个以上的格子在这个区域内
int returnValue = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ePane), Inter.getLocText("Des-Merger_Cell"), Inter.getLocText("Utils-Merge_Cell"),
JOptionPane.OK_CANCEL_OPTION);
if (returnValue != JOptionPane.OK_OPTION) {
@ -386,6 +398,7 @@ public class CellSelection extends Selection {
/**
* 是否撤销合并单元格
*
* @param ePane 区域
* @return 是则返回true
*/
@ -407,6 +420,7 @@ public class CellSelection extends Selection {
/**
* 撤销合并单元格
*
* @param ePane 区域
* @return 成功返回true
*/
@ -443,6 +457,7 @@ public class CellSelection extends Selection {
/**
* 创建弹出菜单
*
* @param ePane 区域
* @return 菜单
*/
@ -477,7 +492,7 @@ public class CellSelection extends Selection {
popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu());
popup.add(new CellAttributeAction().createMenuItem());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 控件设置
if (jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 控件设置
popup.add(new CellWidgetAttrAction().createMenuItem());
}
popup.add(new ConditionAttributesAction().createMenuItem());
@ -497,6 +512,7 @@ public class CellSelection extends Selection {
/**
* 清除
*
* @param type 要清除的类型
* @param ePane 区域
* @return 成功返回true
@ -581,6 +597,7 @@ public class CellSelection extends Selection {
/**
* 向左移动
*
* @param ePane 区域
*/
public void moveLeft(ElementCasePane ePane) {
@ -592,6 +609,7 @@ public class CellSelection extends Selection {
/**
* 向右移动
*
* @param ePane 区域
*/
public void moveRight(ElementCasePane ePane) {
@ -600,6 +618,7 @@ public class CellSelection extends Selection {
/**
* 向上移动
*
* @param ePane 区域
*/
public void moveUp(ElementCasePane ePane) {
@ -611,6 +630,7 @@ public class CellSelection extends Selection {
/**
* 向下移动
*
* @param ePane 区域
*/
public void moveDown(ElementCasePane ePane) {
@ -626,6 +646,7 @@ public class CellSelection extends Selection {
/**
* 触发删除动作
*
* @param ePane 区域
* @return 成功返回true
*/
@ -657,6 +678,7 @@ public class CellSelection extends Selection {
/**
* 包含行列
*
* @param cr 行列
* @return 包含返回true
*/
@ -716,7 +738,7 @@ public class CellSelection extends Selection {
CellElementPropertyPane.getInstance().reInit(ePane);
}
public void populateWidgetPropertyPane(ElementCasePane ePane){
public void populateWidgetPropertyPane(ElementCasePane ePane) {
CellWidgetPropertyPane.getInstance().reInit(ePane);
}

17
designer-realize/src/com/fr/grid/selection/FloatSelection.java

@ -5,7 +5,12 @@ import com.fr.base.FRContext;
import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.FloatStyleAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.*;
import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
import com.fr.design.actions.edit.DeleteAction;
import com.fr.design.actions.edit.EditFloatElementNameAction;
import com.fr.design.actions.edit.HyperlinkAction;
import com.fr.design.actions.edit.PasteAction;
import com.fr.design.actions.edit.order.BringFloatElementForwardAction;
import com.fr.design.actions.edit.order.BringFloatElementToFrontAction;
import com.fr.design.actions.edit.order.SendFloatElementBackwardAction;
@ -28,10 +33,12 @@ import com.fr.stable.ColumnRow;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPopupMenu;
import java.awt.Toolkit;
/**
* the float selection
*
* @editor zhou
* 2012-3-22下午2:09:20
*/
@ -216,6 +223,7 @@ public class FloatSelection extends Selection {
public boolean isSelectedOneCell(ElementCasePane ePane) {
return false;
}
//TODO:august 这儿不比较FloatElement会不会有问题啊
@Override
public boolean equals(Object obj) {
@ -239,8 +247,7 @@ public class FloatSelection extends Selection {
CellElementPropertyPane.getInstance().removeAll();
}
public void populateWidgetPropertyPane(ElementCasePane ePane){
return;
public void populateWidgetPropertyPane(ElementCasePane ePane) {
}
}

14
designer-realize/src/com/fr/quickeditor/FloatQuickEditor.java

@ -1,12 +1,11 @@
package com.fr.quickeditor;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.QuickEditor;
import com.fr.grid.selection.FloatSelection;
import com.fr.report.cell.FloatElement;
import com.fr.design.selection.QuickEditor;
/**
*
* @author zhou
* @since 2012-7-23下午5:17:23
*/
@ -15,10 +14,19 @@ public abstract class FloatQuickEditor extends QuickEditor<ElementCasePane> {
@Override
protected void refresh() {
FloatSelection fs = (FloatSelection)tc.getSelection();
FloatSelection fs = (FloatSelection) tc.getSelection();
floatElement = tc.getEditingElementCase().getFloatElement(fs.getSelectedFloatName());
refreshDetails();
}
/**
* 刷新详细信息
*/
protected abstract void refreshDetails();
@Override
public void release() {
super.release();
floatElement = null;
}
}

283
designer-realize/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -35,6 +35,7 @@ import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -74,9 +75,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true);
private JPanel dsColumnRegion;
private JPanel centerPane;
/**
* 基本和高级设置
*/
@ -117,10 +115,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
public JComponent createCenterBody() {
this.createPanes();
this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout());
JPanel dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(cardContainer, BorderLayout.CENTER);
centerPane = new JPanel(new BorderLayout());
JPanel centerPane = new JPanel(new BorderLayout());
centerPane.add(dsColumnRegion, BorderLayout.CENTER);
return centerPane;
}
@ -141,17 +139,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
/**
* 关闭时候释放
*/
@Override
public void release() {
super.release();
dsColumnRegion = null;
centerPane = null;
}
/**
* 初始化基本和高级设置切换tab
*/
@ -187,6 +174,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
paneList.add(cellDSColumnAdvancedPane);
}
@Override
public void release() {
super.release();
cellDSColumnBasicPane.release();
cellDSColumnAdvancedPane.release();
}
/**
* 单元格元素 数据列 高级设置内容面板
@ -252,9 +245,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
};
DSColumnBasicEditorPane() {
dataPane = new SelectedDataColumnPane(true, true, tc, cellElement);
dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane();
dataPane.addListener(dataListener);
dataPane.setListener(dataListener);
groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {P, F};
@ -297,13 +290,19 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public void populate() {
dataPane.populate(null, cellElement);
dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc);
groupPane.populate(cellElement);
if (tc != null) {
condition.setEditingComponent(tc);
}
}
@Override
protected void release() {
condition.setEditingComponent(null);
dataPane.release();
}
/**
* 创建有内容的面板显示信息
@ -330,6 +329,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
class DSColumnAdvancedEditorPane extends AbstractDSCellEditorPane {
/*pane begin*/
/**
* 排列顺序
*/
@ -353,7 +353,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
/**
* 补充空白数据
*/
private UICheckBox useMultiplyNumCheckBox;
private UICheckBox useMultiNumCheckBox;
/**
* 补充空白数据数目输入框
*/
@ -362,6 +362,75 @@ public class CellDSColumnEditor extends CellQuickEditor {
* 补充空白数据数目面板 可隐藏
*/
private JPanel multiPane;
/*pane end*/
/*listeners begin*/
private UIObserverListener sortPaneFormulaChangeListener = new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener sortTypeBtnGroupChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener filterPaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
};
private UIObserverListener customValuePaneChangeListener = new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
};
private ChangeListener heCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ChangeListener veCheckBoxChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
};
private ActionListener useMultiNumCheckBoxChangeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
private ChangeListener multiNumSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
};
/*listeners end*/
public DSColumnAdvancedEditorPane() {
@ -397,6 +466,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
public void populate() {
if (cellElement != null) {
disableListener();
sortPane.populate(cellElement);
valuePane.populate(cellElement);
filterPane.populate(cellElement);
@ -406,6 +476,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellElement.setCellExpandAttr(cellExpandAttr);
}
// extendable
//noinspection Duplicates
switch (cellExpandAttr.getExtendable()) {
case CellExpandAttr.Both_EXTENDABLE:
heCheckBox.setSelected(true);
@ -425,13 +496,21 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}
if (cellExpandAttr.getMultipleNumber() == -1) {
useMultiplyNumCheckBox.setSelected(false);
useMultiNumCheckBox.setSelected(false);
// 默认值
multiNumSpinner.setValue(1);
} else {
useMultiplyNumCheckBox.setSelected(true);
useMultiNumCheckBox.setSelected(true);
multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber());
}
this.checkButtonEnabled();
enableListener();
}
}
@Override
protected void release() {
}
/**
@ -443,6 +522,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr);
}
//noinspection Duplicates
if (heCheckBox.isSelected()) {
if (veCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);
@ -463,12 +543,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/
private void updateMultipleConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (this.useMultiplyNumCheckBox.isSelected()) {
if (this.useMultiNumCheckBox.isSelected()) {
cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue());
} else {
cellExpandAttr.setMultipleNumber(-1);
}
}
/**
@ -479,68 +558,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override
protected JPanel createContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序
sortPane = new ResultSetSortConfigPane();
sortPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
sortPane.update(cellElement);
fireTargetModified();
}
}, new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement);
fireTargetModified();
}
}
);
//结果筛选
filterPane = new ResultSetFilterConfigPane();
filterPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
}
);
//自定义值显示
valuePane = new CustomValuePane();
valuePane.addListener(new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
});
//可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
heCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
});
veCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateExtendConfig();
fireTargetModified();
}
});
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
//补充空白数据
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data"));
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
useMultiNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data"));
JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiplyNumCheckBox, BorderLayout.WEST);
checkBoxPane.add(useMultiNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1);
//数据倍数
UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple"));
multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
@ -551,25 +591,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
);
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
multiNumSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
enableListener();
double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {F};
Component[][] components = new Component[][]{
{sortPane},
{filterPane},
@ -580,9 +606,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP);
}
public void enableListener() {
sortPane.addListener(sortPaneFormulaChangeListener, sortTypeBtnGroupChangeListener);
filterPane.addListener(filterPaneChangeListener);
valuePane.addListener(customValuePaneChangeListener);
heCheckBox.addChangeListener(heCheckBoxChangeListener);
veCheckBox.addChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.addActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.addChangeListener(multiNumSpinnerChangeListener);
}
public void disableListener() {
sortPane.removeListener(sortTypeBtnGroupChangeListener);
filterPane.removeListener();
valuePane.removeListener();
heCheckBox.removeChangeListener(heCheckBoxChangeListener);
veCheckBox.removeChangeListener(veCheckBoxChangeListener);
useMultiNumCheckBox.removeActionListener(useMultiNumCheckBoxChangeListener);
multiNumSpinner.removeChangeListener(multiNumSpinnerChangeListener);
}
private void checkButtonEnabled() {
if (useMultiplyNumCheckBox.isSelected()) {
if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true);
multiPane.setVisible(true);
} else {
@ -659,7 +705,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(TemplateCellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
if (value instanceof DSColumn) {
this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder();
@ -676,6 +722,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) {
this.formulaField.populate(sortFormula);
} else {
this.formulaField.populate(DEFAULT_VALUE);
}
}
}
@ -689,8 +737,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue());
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value;
dSColumn.setOrder(this.sortTypePane.getSelectedIndex());
dSColumn.setSortFormula(this.formulaField.getFormulaText());
}
@ -707,6 +755,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
formulaField.addListener(formulaChangeListener);
sortTypePane.addChangeListener(changeListener);
}
/**
* 去除事件监听器
*
* @param changeListener 排序类型下拉框改动事件监听器
*/
public void removeListener(ChangeListener changeListener) {
formulaField.removeListener();
sortTypePane.removeChangeListener(changeListener);
}
}
/**
@ -852,13 +910,18 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.removeActionListener(actionListener);
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue());
SelectCount selectCount = dSColumn.getSelectCount();
this.topFormulaPane.populateElement(cellElement);
this.bottomFormulaPane.populateElement(cellElement);
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
// 重置默认值
this.topFormulaPane.populate(DEFAULT_VALUE);
this.bottomFormulaPane.populate(DEFAULT_VALUE);
this.serialTextField.setText(StringUtils.EMPTY);
if (selectCount != null) {
int selectCountType = selectCount.getType();
this.rsComboBox.setSelectedIndex(selectCountType);
@ -927,6 +990,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
}
} else {
this.rsComboBox.setSelectedIndex(0);
//未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
@ -944,8 +1008,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue());
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value;
int selectedFilterIndex = this.rsComboBox.getSelectedIndex();
if (selectedFilterIndex == 0) {
dSColumn.setSelectCount(null);
@ -953,6 +1017,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = new SelectCount();
selectCount.setType(selectedFilterIndex);
dSColumn.setSelectCount(selectCount);
//noinspection Duplicates
if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectedFilterIndex == BOTTOM.getValue()) {
@ -976,6 +1041,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.registerChangeListener(formulaListener);
serialTextField.registerChangeListener(formulaListener);
}
/**
* 去除事件监听器
*/
public void removeListener() {
topFormulaPane.removeListener();
bottomFormulaPane.removeListener();
rsComboBox.removeChangeListener();
serialTextField.registerChangeListener(null);
}
}
/**
@ -1029,6 +1104,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.formulaTextField.registerChangeListener(listener);
}
/**
* 取消事件监听器
*/
public void removeListener() {
this.formulaTextField.registerChangeListener(null);
}
private ActionListener formulaButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
@ -1042,7 +1124,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
if (value instanceof DSColumn) {
DSColumn dsColumn = (DSColumn) value;
String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName());
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true));
@ -1086,12 +1168,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(CellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value;
//formula
String valueFormula = dSColumn.getResult();
if (valueFormula != null) {
formulaField.populate(valueFormula);
} else {
formulaField.populate(DEFAULT_VALUE);
}
formulaField.populateElement(cellElement);
@ -1102,7 +1186,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setResult(this.formulaField.getFormulaText());
}
@ -1117,6 +1201,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void addListener(UIObserverListener formulaListener) {
this.formulaField.addListener(formulaListener);
}
/**
* 移除事件监听器
*/
public void removeListener() {
this.formulaField.removeListener();
}
}
}

7
designer-realize/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -3,7 +3,6 @@ package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
@ -13,7 +12,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/**
* 单元格元素富文本编辑器
@ -58,4 +56,9 @@ public class CellRichTextEditor extends CellQuickEditor {
return true;
}
@Override
public void release() {
super.release();
richTextButton.setAction(null);
}
}

2
designer-realize/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,7 +3,6 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.BaseFormula;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.grid.GridKeyListener;
import com.fr.grid.selection.CellSelection;
@ -18,7 +17,6 @@ import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

6
designer-realize/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -56,4 +56,10 @@ public class CellSubReportEditor extends CellQuickEditor {
public boolean isScrollAll() {
return true;
}
@Override
public void release() {
super.release();
subReportButton.setAction(null);
}
}

8
designer-realize/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java

@ -14,8 +14,10 @@ import com.fr.general.Inter;
import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -73,8 +75,6 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
@Override
protected void refreshDetails() {
// TODO Auto-generated method stub
}
}

66
designer-realize/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

@ -12,10 +12,16 @@ import com.fr.quickeditor.FloatQuickEditor;
import com.fr.report.ReportHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -27,6 +33,25 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
};
public FloatStringQuickEditor() {
super();
stringTextField = new JTextArea();
@ -34,11 +59,17 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
formulaButton = new UIButton();
formulaButton.setPreferredSize(new Dimension(25, 23));
formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
ActionListener getFormulaActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
}
};
formulaButton.addActionListener(getFormulaActionListener);
JPanel pane = new JPanel(new BorderLayout(5, 0));
pane.add(stringTextField, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST);
pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
formulaButton.setVisible(false);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@ -55,16 +86,10 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.setBackground(Color.WHITE);
}
ActionListener getFormulaActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
}
};
@Override
protected void refreshDetails() {
String str = null;
String str;
Object value = floatElement.getValue();
if (value == null) {
str = StringUtils.EMPTY;
@ -89,26 +114,8 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.getDocument().addDocumentListener(documentListener);
}
DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
}
};
protected void changeReportPaneCell(String tmpText) {
private void changeReportPaneCell(String tmpText) {
if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText);
textFormula.setReserveInResult(reserveInResult);
@ -125,5 +132,4 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
fireTargetModified();
stringTextField.requestFocus();
}
}
Loading…
Cancel
Save