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. 15
      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. 175
      designer-realize/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  11. 2
      designer-realize/src/com/fr/design/mainframe/ElementCasePane.java
  12. 5
      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. 60
      designer-realize/src/com/fr/grid/selection/CellSelection.java
  16. 17
      designer-realize/src/com/fr/grid/selection/FloatSelection.java
  17. 28
      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() { 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();
}
}
/** /**
* 注册无需每次实例化的单元格元素编辑器 * 注册无需每次实例化的单元格元素编辑器
* *

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

@ -711,21 +711,10 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) {
specifiedTemplate.saveTemplate(); specifiedTemplate.saveTemplate();
FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); 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);
} }
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.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
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.*; 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.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; 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.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants; 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 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.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.*; import java.awt.dnd.DnDConstants;
import java.awt.event.*; 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.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -734,6 +765,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }
@ -750,6 +783,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板 * @param jt 模板
*/ */
public void activateJTemplate(JTemplate<?, ?> jt) { public void activateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; 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.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; 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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter; import javax.swing.text.NumberFormatter;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; 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; import java.math.BigDecimal;
/** /**
@ -51,7 +71,6 @@ public class JFormSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JFormSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner; private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
@ -62,7 +81,7 @@ public class JFormSliderPane extends JPanel {
private UISliderButton showValButton; private UISliderButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton; private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton; private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton; private UIRadioButton selfAdaptButton;
@ -83,7 +102,7 @@ public class JFormSliderPane extends JPanel {
showValSpinner.setEditor(editor); showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true); textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false); formatter.setAllowsInvalid(false);
@ -91,7 +110,7 @@ public class JFormSliderPane extends JPanel {
initShowValButton(); initShowValButton();
initUIRadioButton(); initUIRadioButton();
initPane(); 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(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -100,17 +119,13 @@ public class JFormSliderPane extends JPanel {
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
public static final JFormSliderPane getInstance() { public static JFormSliderPane getInstance() {
// if (THIS == null) { return new JFormSliderPane();
// THIS = new JSliderPane();
// }
THIS = new JFormSliderPane();
return THIS;
} }
private void initSlider() { private void initSlider() {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED){ slider = new UISlider(0, HUNDRED, HALF_HUNDRED) {
public Point getToolTipLocation(MouseEvent event){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
@ -123,8 +138,8 @@ public class JFormSliderPane extends JPanel {
} }
private void initShowValSpinner() { private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)){ showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
@ -134,16 +149,16 @@ public class JFormSliderPane extends JPanel {
} }
private void initDownUpButton() { 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")){ 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){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
downButton.setOpaque(false); downButton.setOpaque(false);
downButton.setBorderPainted(false); downButton.setBorderPainted(false);
downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down")); 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")){ 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){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
@ -164,10 +179,11 @@ public class JFormSliderPane extends JPanel {
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade")); showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
} }
private void initUIRadioButton() { private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%"); twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%"); oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%"); sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); 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)); customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() { customButton.addItemListener(new ItemListener() {
@ -194,7 +210,7 @@ public class JFormSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton); bg.add(oneHundredButton);
bg.add(SevenFiveButton); bg.add(sevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
@ -217,7 +233,7 @@ public class JFormSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR); septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR); // selfAdaptButton.setBackground(BACK_COLOR);
@ -227,7 +243,7 @@ public class JFormSliderPane extends JPanel {
new Component[]{septPane, null}, new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()} new Component[]{customButton, createSpinnerPanel()}
@ -247,14 +263,14 @@ public class JFormSliderPane extends JPanel {
return spinnerPanel; return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() { private ActionListener showValButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
popupDialog(); popupDialog();
} }
}; };
ChangeListener showValSpinnerChangeListener = new ChangeListener() { private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); 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) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -296,7 +312,7 @@ public class JFormSliderPane extends JPanel {
} }
}; };
ItemListener radioButtonItemListener = new ItemListener() { private ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource(); JRadioButton temp = (JRadioButton) e.getSource();
@ -312,7 +328,7 @@ public class JFormSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) { } else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) { } else {
slider.setValue(HALF_HUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -336,7 +352,7 @@ public class JFormSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue(); return b1.divide(b2, scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue(); 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.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; 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.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; 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); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner; private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
@ -70,12 +90,14 @@ public class JSliderPane extends JPanel {
private UISliderButton showValButton; private UISliderButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton; private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton; private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton; private UIRadioButton selfAdaptButton;
private UIRadioButton customButton; private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样 /**
* 拖动条处理和button直接输入不一样
*/
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
private PopupPane dialog; private PopupPane dialog;
private int upButtonX; private int upButtonX;
@ -91,7 +113,7 @@ public class JSliderPane extends JPanel {
showValSpinner.setEditor(editor); showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true); textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false); formatter.setAllowsInvalid(false);
@ -99,7 +121,7 @@ public class JSliderPane extends JPanel {
initShowValButton(); initShowValButton();
initUIRadioButton(); initUIRadioButton();
initPane(); 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(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -109,12 +131,8 @@ public class JSliderPane extends JPanel {
} }
public static final JSliderPane getInstance() { public static JSliderPane getInstance() {
// if (THIS == null) { return new JSliderPane();
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
} }
private void initSlider() { private void initSlider() {
@ -178,7 +196,7 @@ public class JSliderPane extends JPanel {
private void initUIRadioButton() { private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%"); twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%"); oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%"); sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); 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)); customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() { customButton.addItemListener(new ItemListener() {
@ -205,7 +223,7 @@ public class JSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton); bg.add(oneHundredButton);
bg.add(SevenFiveButton); bg.add(sevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
@ -228,7 +246,7 @@ public class JSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR); septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR);
selfAdaptButton.setBackground(BACK_COLOR); selfAdaptButton.setBackground(BACK_COLOR);
@ -238,7 +256,7 @@ public class JSliderPane extends JPanel {
new Component[]{septPane, null}, new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
new Component[]{selfAdaptButton, null}, new Component[]{selfAdaptButton, null},
@ -259,14 +277,14 @@ public class JSliderPane extends JPanel {
return spinnerPanel; return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() { private ActionListener showValButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
popupDialog(); popupDialog();
} }
}; };
ChangeListener showValSpinnerChangeListener = new ChangeListener() { private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); 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) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -309,7 +327,7 @@ public class JSliderPane extends JPanel {
} }
}; };
ItemListener radioButtonItemListener = new ItemListener() { private ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource(); JRadioButton temp = (JRadioButton) e.getSource();
@ -325,7 +343,7 @@ public class JSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) { } else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) { } else {
slider.setValue(HALF_HUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -343,7 +361,7 @@ public class JSliderPane extends JPanel {
return this.showValue; return this.showValue;
} }
public void reset(){ public void reset() {
this.showValSpinner.setValue(HUNDRED); this.showValSpinner.setValue(HUNDRED);
} }
@ -353,7 +371,7 @@ public class JSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue(); return b1.divide(b2, scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue(); showValue = (int) showValSpinner.getValue();
@ -390,7 +408,7 @@ public class JSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) { } else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN); times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else { } else {
times = (int) (SIX * value - TWO_HUNDRED); times = SIX * value - TWO_HUNDRED;
} }
} }
@ -448,11 +466,9 @@ class JSliderPaneUI extends BasicSliderUI {
super(b); super(b);
} }
/** */
/** /**
* 绘制指示物 * 绘制指示物
*/ */
public void paintThumb(Graphics g) { public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect; Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -460,7 +476,6 @@ class JSliderPaneUI extends BasicSliderUI {
g2d.dispose(); 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 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(); tc.fireTargetModified();
} }
/**
* 刷新面板
*/
protected abstract void refresh(); protected abstract void refresh();
/** /**
* for 关闭时候释放 * 关闭模板时释放模板对象
* 所有持有tc的对象也必须置空或者丢弃对于tc的引用
*/ */
public void release() { public void release() {
tc = null; tc = null;
@ -53,7 +57,6 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
@Override @Override
protected void refresh() { 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.design.module.DesignModuleFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.JComponent;
import java.awt.*; 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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
@ -47,7 +59,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide
} }
public void refreshToolbar() { public void refreshToolbar() {
reset(); singleton.reset();
} }
public static void refresh() { 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.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr; import com.fr.report.cell.cellattr.CellExpandAttr;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -27,6 +28,29 @@ public class DSColumnBasicPane extends BasicPane {
private ExpandDirectionPane expandDirectionPane; private ExpandDirectionPane expandDirectionPane;
private CellElement cellElement; 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() { public DSColumnBasicPane() {
this(DSColumnPane.SETTING_ALL); this(DSColumnPane.SETTING_ALL);
} }
@ -78,7 +102,7 @@ public class DSColumnBasicPane extends BasicPane {
this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); 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 @Override
@ -93,7 +117,7 @@ public class DSColumnBasicPane extends BasicPane {
this.cellElement = cellElement; this.cellElement = cellElement;
selectDataColumnPane.populate(source, cellElement); selectDataColumnPane.populate(source, cellElement, null);
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (conditionParentPane != null) { if (conditionParentPane != null) {
@ -134,29 +158,6 @@ public class DSColumnBasicPane extends BasicPane {
resultSetGroupPane.update(); 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) { public void putElementcase(ElementCasePane t) {
if (conditionParentPane != null) { if (conditionParentPane != null) {
conditionParentPane.putElementcase(t); 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.main.impl.WorkBook;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import java.awt.*; import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.Iterator; import java.util.Iterator;
@ -17,6 +17,7 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
super(false); super(false);
} }
@Override
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(new WorkBook()); tableNameComboBox = new TableDataComboBox(new WorkBook());
tableNameComboBox.addItemListener(new ItemListener() { tableNameComboBox.addItemListener(new ItemListener() {
@ -32,14 +33,14 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane {
tableNameComboBox.refresh(source); tableNameComboBox.refresh(source);
tableNameComboBox.setEditable(false); tableNameComboBox.setEditable(false);
tableNameComboBox.setEnabled(false); tableNameComboBox.setEnabled(false);
super.populate(source, cell); super.populate(source, cell, null);
try { try {
Iterator it = source.getTableDataNameIterator(); Iterator it = source.getTableDataNameIterator();
String name = (String) it.next(); String name = (String) it.next();
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name);
tableNameComboBox.setSelectedItem(wrapper); tableNameComboBox.setSelectedItem(wrapper);
tableNameComboBox.getModel().setSelectedItem(wrapper); tableNameComboBox.getModel().setSelectedItem(wrapper);
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
} }

175
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.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import java.awt.*; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -41,31 +45,87 @@ import java.util.regex.Pattern;
* *
* @author yaoh.wu * @author yaoh.wu
* @version 2017年8月3日 * @version 2017年8月3日
* 复用对话框代码保留对话框原始布局 * 复用对话框代码保留对话框原始布局
* @since 8.0 * @since 8.0
*/ */
public class SelectedDataColumnPane extends BasicPane { public class SelectedDataColumnPane extends BasicPane {
/**
* 参数编辑器面板
*/
private UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
/**
* 参数
*/
private Parameter[] ps; private Parameter[] ps;
/**
* 数据集下拉框
*/
TableDataComboBox tableNameComboBox; TableDataComboBox tableNameComboBox;
/**
* 动态参数注入按钮
*/
private UIButton paramButton;
/**
* 数据列下拉框
*/
LazyComboBox columnNameComboBox; LazyComboBox columnNameComboBox;
/**
* 数据集下拉框和数据列下拉框监听器
*/
private ItemListener itemListener; 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) { if (verticalLayout) {
initComponentVerticalLayout(casePane, cellElement); initComponentVerticalLayout();
} else { } else {
initComponent(showParameterButton); initComponent(showParameterButton);
} }
@ -79,7 +139,7 @@ public class SelectedDataColumnPane extends BasicPane {
public void initComponent(boolean showParameterButton) { public void initComponent(boolean showParameterButton) {
initTableNameComboBox(); initTableNameComboBox();
if (showParameterButton) { if (showParameterButton) {
initWithParameterButton(); initParameterButton();
} }
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@ -119,9 +179,9 @@ public class SelectedDataColumnPane extends BasicPane {
/** /**
* 初始化竖直布局的组件 * 初始化竖直布局的组件
*/ */
public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) { private void initComponentVerticalLayout() {
initTableNameComboBox(); initTableNameComboBox();
initWithParameterButton(casePane, cellElement); initVerticalParameterButton();
columnNameComboBox = new LazyComboBox() { columnNameComboBox = new LazyComboBox() {
@Override @Override
public Object[] load() { 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) { if (cellElement == null) {
return; return;
} }
if (itemListener != null) { this.cellElement = cellElement;
removeListener(itemListener); removeListener();
}
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (!(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
@ -166,9 +235,14 @@ public class SelectedDataColumnPane extends BasicPane {
columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn())); columnNameComboBox.setSelectedItem(TableDataColumn.getColumnName(dsColumn.getColumn()));
ps = dsColumn.getParameters(); ps = dsColumn.getParameters();
addListener(itemListener); addListener();
} }
/**
* 保存数据到单元格对象中
*
* @param cellElement 单元格
*/
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement == null) { if (cellElement == null) {
return; return;
@ -177,7 +251,7 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) { if (this.tableNameComboBox.getSelectedItem() == null && this.columnNameComboBox.getSelectedItem() == null) {
return; return;
} }
DSColumn dsColumn = null; DSColumn dsColumn;
if (value == null || !(value instanceof DSColumn)) { if (value == null || !(value instanceof DSColumn)) {
dsColumn = new DSColumn(); dsColumn = new DSColumn();
cellElement.setValue(dsColumn); cellElement.setValue(dsColumn);
@ -185,18 +259,27 @@ public class SelectedDataColumnPane extends BasicPane {
dsColumn = (DSColumn) cellElement.getValue(); dsColumn = (DSColumn) cellElement.getValue();
SimpleDSColumn simpleDSColumn = updateColumnPane(); SimpleDSColumn simpleDSColumn = updateColumnPane();
dsColumn.setDSName(simpleDSColumn.getDsName()); dsColumn.setDSName(Objects.requireNonNull(simpleDSColumn).getDsName());
dsColumn.setColumn(simpleDSColumn.getColumn()); dsColumn.setColumn(simpleDSColumn.getColumn());
dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null);
} }
/**
* 释放模板对象
*/
public void release() {
this.cellElement = null;
this.casePane = null;
this.tableNameComboBox.setModel(new DefaultComboBoxModel());
}
/** /**
* 更新面板 * 更新面板
* *
* @return 更新后的值 * @return 更新后的值
*/ */
public SimpleDSColumn updateColumnPane() { private SimpleDSColumn updateColumnPane() {
SimpleDSColumn dsColumn = new SimpleDSColumn(); SimpleDSColumn dsColumn = new SimpleDSColumn();
TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem(); TableDataWrapper tableDataWrappe = this.tableNameComboBox.getSelectedItem();
if (tableDataWrappe == null) { if (tableDataWrappe == null) {
@ -206,9 +289,8 @@ public class SelectedDataColumnPane extends BasicPane {
TableDataColumn column; TableDataColumn column;
String columnExp = (String) this.columnNameComboBox.getSelectedItem(); String columnExp = (String) this.columnNameComboBox.getSelectedItem();
if (isColumnName(columnExp)) { if (isColumnName(columnExp)) {
String number = columnExp.substring(1); String number = Objects.requireNonNull(columnExp).substring(1);
Pattern pattern = Pattern.compile("[^\\d]"); if (COLUMN_NAME_PATTERN.matcher(number).find()) {
if (pattern.matcher(number).find()) {
column = TableDataColumn.createColumn(columnExp); column = TableDataColumn.createColumn(columnExp);
} else { } else {
int serialNumber = Integer.parseInt(columnExp.substring(1)); int serialNumber = Integer.parseInt(columnExp.substring(1));
@ -221,36 +303,31 @@ public class SelectedDataColumnPane extends BasicPane {
return dsColumn; return dsColumn;
} }
public void setListener(ItemListener i) {
this.itemListener = i;
}
/** /**
* 添加监听事件 * 添加监听事件
*
* @param i 监听事件
*/ */
public void addListener(ItemListener i) { private void addListener() {
itemListener = i; tableNameComboBox.addItemListener(this.itemListener);
tableNameComboBox.addItemListener(i); columnNameComboBox.addItemListener(this.itemListener);
columnNameComboBox.addItemListener(i); tableNameComboBox.addItemListener(this.isNeedReloadListener);
} }
/** /**
* 移除监听事件 * 移除监听事件
*
* @param i 监听事件
*/ */
public void removeListener(ItemListener i) { private void removeListener() {
tableNameComboBox.removeItemListener(i); tableNameComboBox.removeItemListener(this.itemListener);
columnNameComboBox.removeItemListener(i); columnNameComboBox.removeItemListener(this.itemListener);
tableNameComboBox.removeItemListener(this.isNeedReloadListener);
} }
protected void initTableNameComboBox() { protected void initTableNameComboBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
columnNameComboBox.setLoaded(false);
}
});
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); tableNameComboBox.setPreferredSize(new Dimension(100, 20));
} }
@ -260,8 +337,8 @@ public class SelectedDataColumnPane extends BasicPane {
} }
private void initWithParameterButton() { private void initParameterButton() {
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel()); editorPane = new UITableEditorPane<>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -279,18 +356,18 @@ public class SelectedDataColumnPane extends BasicPane {
}); });
} }
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) { private void initVerticalParameterButton() {
final SelectedDataColumnPane that = this; editorPane = new UITableEditorPane<>(new ParameterTableModel());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection")); paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection"));
paramButton.addActionListener(new ActionListener() { paramButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
List<ParameterProvider> parameterList = editorPane.update(); List<ParameterProvider> parameterList = editorPane.update();
ps = parameterList.toArray(new Parameter[parameterList.size()]); ps = parameterList.toArray(new Parameter[parameterList.size()]);
that.update(cellElement); update(SelectedDataColumnPane.this.cellElement);
casePane.fireTargetModified(); casePane.fireTargetModified();
} }
}); });
@ -310,6 +387,6 @@ public class SelectedDataColumnPane extends BasicPane {
if (this.tableNameComboBox.getSelectedItem() != null) { if (this.tableNameComboBox.getSelectedItem() != null) {
return this.tableNameComboBox.getSelectedItem().calculateColumnNameList(); 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 * 因为这边判断selection是一个selection所以不会触发fireSelectionChanged
*/ */
public void setSelection(Selection selection) { public void setSelection(Selection selection) {
//旧选中内容编辑器释放模板对象
this.getCurrentEditor().release();
if (!ComparatorUtils.equals(this.selection, selection) || if (!ComparatorUtils.equals(this.selection, selection) ||
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
this.selection = selection; this.selection = selection;

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

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

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

60
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.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.*; import javax.swing.SwingUtilities;
import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -114,6 +115,7 @@ public class CellSelection extends Selection {
/** /**
* 增加选中的区域 * 增加选中的区域
*
* @param cellRectangle 区域 * @param cellRectangle 区域
*/ */
public void addCellRectangle(Rectangle cellRectangle) { public void addCellRectangle(Rectangle cellRectangle) {
@ -164,6 +166,7 @@ public class CellSelection extends Selection {
/** /**
* 清除区域块 * 清除区域块
*
* @param i 区域块 * @param i 区域块
*/ */
public void clearCellRectangles(int i) { public void clearCellRectangles(int i) {
@ -172,8 +175,9 @@ public class CellSelection extends Selection {
/** /**
* 包含单元格 * 包含单元格
* @param column *
* @param row * @param column
* @param row
* @return 若不包含返回-1 * @return 若不包含返回-1
*/ */
public int containsCell(int column, int row) { public int containsCell(int column, int row) {
@ -205,6 +209,7 @@ public class CellSelection extends Selection {
/** /**
* 转换成矩形 * 转换成矩形
*
* @return 矩形 * @return 矩形
*/ */
public Rectangle toRectangle() { public Rectangle toRectangle() {
@ -213,6 +218,7 @@ public class CellSelection extends Selection {
/** /**
* 是否选择一个单元格 * 是否选择一个单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 是则返回rue * @return 是则返回rue
*/ */
@ -239,8 +245,9 @@ public class CellSelection extends Selection {
/** /**
* 作为可传输的 * 作为可传输的
*
* @param transferable 传输介质 * @param transferable 传输介质
* @param ePane 区域 * @param ePane 区域
*/ */
public void asTransferable(ElementsTransferable transferable, ElementCasePane ePane) { public void asTransferable(ElementsTransferable transferable, ElementCasePane ePane) {
java.util.List<TemplateCellElement> list = new java.util.ArrayList<TemplateCellElement>(); java.util.List<TemplateCellElement> list = new java.util.ArrayList<TemplateCellElement>();
@ -251,12 +258,12 @@ public class CellSelection extends Selection {
TemplateCellElement cellElement = (TemplateCellElement) cells.next(); TemplateCellElement cellElement = (TemplateCellElement) cells.next();
list.add((TemplateCellElement) cellElement.deriveCellElement(cellElement.getColumn() - column, cellElement.getRow() - row)); list.add((TemplateCellElement) cellElement.deriveCellElement(cellElement.getColumn() - column, cellElement.getRow() - row));
} }
FU [] columnWidth = new FU[columnSpan]; FU[] columnWidth = new FU[columnSpan];
FU [] rowHeight = new FU[rowSpan]; FU[] rowHeight = new FU[rowSpan];
for (int i = 0; i < columnSpan; i++){ for (int i = 0; i < columnSpan; i++) {
columnWidth[i] = ec.getColumnWidth(this.column + 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); rowHeight[j] = ec.getRowHeight(this.row + j);
} }
transferable.addObject(new CellElementsClip(this.columnSpan, this.rowSpan, columnWidth, rowHeight, list.toArray(new TemplateCellElement[list.size()]))); transferable.addObject(new CellElementsClip(this.columnSpan, this.rowSpan, columnWidth, rowHeight, list.toArray(new TemplateCellElement[list.size()])));
@ -264,9 +271,10 @@ public class CellSelection extends Selection {
/** /**
* 黏贴单元格 * 黏贴单元格
*
* @param ceClip 单元格 * @param ceClip 单元格
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@Override @Override
public boolean pasteCellElementsClip(CellElementsClip ceClip, ElementCasePane ePane) { public boolean pasteCellElementsClip(CellElementsClip ceClip, ElementCasePane ePane) {
@ -281,8 +289,9 @@ public class CellSelection extends Selection {
/** /**
* 黏贴字符串 * 黏贴字符串
* @param str 字符串 *
* @param ePane 区域 * @param str 字符串
* @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@Override @Override
@ -329,7 +338,8 @@ public class CellSelection extends Selection {
/** /**
* 黏贴其他 * 黏贴其他
* @param ob 要黏贴的东西 *
* @param ob 要黏贴的东西
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -352,6 +362,7 @@ public class CellSelection extends Selection {
/** /**
* 是否能合并单元格 * 是否能合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 是则返回true * @return 是则返回true
*/ */
@ -363,6 +374,7 @@ public class CellSelection extends Selection {
/** /**
* 合并单元格 * 合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -371,7 +383,7 @@ public class CellSelection extends Selection {
TemplateElementCase ec = ePane.getEditingElementCase(); TemplateElementCase ec = ePane.getEditingElementCase();
Iterator cells = ec.intersect(column, row, columnSpan, rowSpan); 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"), int returnValue = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(ePane), Inter.getLocText("Des-Merger_Cell"), Inter.getLocText("Utils-Merge_Cell"),
JOptionPane.OK_CANCEL_OPTION); JOptionPane.OK_CANCEL_OPTION);
if (returnValue != JOptionPane.OK_OPTION) { if (returnValue != JOptionPane.OK_OPTION) {
@ -386,6 +398,7 @@ public class CellSelection extends Selection {
/** /**
* 是否撤销合并单元格 * 是否撤销合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 是则返回true * @return 是则返回true
*/ */
@ -407,6 +420,7 @@ public class CellSelection extends Selection {
/** /**
* 撤销合并单元格 * 撤销合并单元格
*
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -443,6 +457,7 @@ public class CellSelection extends Selection {
/** /**
* 创建弹出菜单 * 创建弹出菜单
*
* @param ePane 区域 * @param ePane 区域
* @return 菜单 * @return 菜单
*/ */
@ -477,7 +492,7 @@ public class CellSelection extends Selection {
popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu());
popup.add(new CellAttributeAction().createMenuItem()); popup.add(new CellAttributeAction().createMenuItem());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 控件设置 if (jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 控件设置
popup.add(new CellWidgetAttrAction().createMenuItem()); popup.add(new CellWidgetAttrAction().createMenuItem());
} }
popup.add(new ConditionAttributesAction().createMenuItem()); popup.add(new ConditionAttributesAction().createMenuItem());
@ -497,8 +512,9 @@ public class CellSelection extends Selection {
/** /**
* 清除 * 清除
* @param type 要清除的类型 *
* @param ePane 区域 * @param type 要清除的类型
* @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@Override @Override
@ -581,6 +597,7 @@ public class CellSelection extends Selection {
/** /**
* 向左移动 * 向左移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveLeft(ElementCasePane ePane) { public void moveLeft(ElementCasePane ePane) {
@ -592,6 +609,7 @@ public class CellSelection extends Selection {
/** /**
* 向右移动 * 向右移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveRight(ElementCasePane ePane) { public void moveRight(ElementCasePane ePane) {
@ -600,6 +618,7 @@ public class CellSelection extends Selection {
/** /**
* 向上移动 * 向上移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveUp(ElementCasePane ePane) { public void moveUp(ElementCasePane ePane) {
@ -611,6 +630,7 @@ public class CellSelection extends Selection {
/** /**
* 向下移动 * 向下移动
*
* @param ePane 区域 * @param ePane 区域
*/ */
public void moveDown(ElementCasePane ePane) { public void moveDown(ElementCasePane ePane) {
@ -626,6 +646,7 @@ public class CellSelection extends Selection {
/** /**
* 触发删除动作 * 触发删除动作
*
* @param ePane 区域 * @param ePane 区域
* @return 成功返回true * @return 成功返回true
*/ */
@ -657,6 +678,7 @@ public class CellSelection extends Selection {
/** /**
* 包含行列 * 包含行列
*
* @param cr 行列 * @param cr 行列
* @return 包含返回true * @return 包含返回true
*/ */
@ -716,7 +738,7 @@ public class CellSelection extends Selection {
CellElementPropertyPane.getInstance().reInit(ePane); CellElementPropertyPane.getInstance().reInit(ePane);
} }
public void populateWidgetPropertyPane(ElementCasePane ePane){ public void populateWidgetPropertyPane(ElementCasePane ePane) {
CellWidgetPropertyPane.getInstance().reInit(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.CleanAuthorityAction;
import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.cell.FloatStyleAction;
import com.fr.design.actions.core.ActionFactory; 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.BringFloatElementForwardAction;
import com.fr.design.actions.edit.order.BringFloatElementToFrontAction; import com.fr.design.actions.edit.order.BringFloatElementToFrontAction;
import com.fr.design.actions.edit.order.SendFloatElementBackwardAction; 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.FU;
import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.OLDPIX;
import javax.swing.*; import javax.swing.JPopupMenu;
import java.awt.*; import java.awt.Toolkit;
/** /**
* the float selection * the float selection
*
* @editor zhou * @editor zhou
* 2012-3-22下午2:09:20 * 2012-3-22下午2:09:20
*/ */
@ -216,6 +223,7 @@ public class FloatSelection extends Selection {
public boolean isSelectedOneCell(ElementCasePane ePane) { public boolean isSelectedOneCell(ElementCasePane ePane) {
return false; return false;
} }
//TODO:august 这儿不比较FloatElement会不会有问题啊 //TODO:august 这儿不比较FloatElement会不会有问题啊
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
@ -239,8 +247,7 @@ public class FloatSelection extends Selection {
CellElementPropertyPane.getInstance().removeAll(); CellElementPropertyPane.getInstance().removeAll();
} }
public void populateWidgetPropertyPane(ElementCasePane ePane){ public void populateWidgetPropertyPane(ElementCasePane ePane) {
return;
} }
} }

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

@ -1,24 +1,32 @@
package com.fr.quickeditor; package com.fr.quickeditor;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.QuickEditor;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.cell.FloatElement; import com.fr.report.cell.FloatElement;
import com.fr.design.selection.QuickEditor;
/** /**
*
* @author zhou * @author zhou
* @since 2012-7-23下午5:17:23 * @since 2012-7-23下午5:17:23
*/ */
public abstract class FloatQuickEditor extends QuickEditor<ElementCasePane> { public abstract class FloatQuickEditor extends QuickEditor<ElementCasePane> {
protected FloatElement floatElement; protected FloatElement floatElement;
@Override
protected void refresh() {
FloatSelection fs = (FloatSelection) tc.getSelection();
floatElement = tc.getEditingElementCase().getFloatElement(fs.getSelectedFloatName());
refreshDetails();
}
@Override /**
protected void refresh() { * 刷新详细信息
FloatSelection fs = (FloatSelection)tc.getSelection(); */
floatElement = tc.getEditingElementCase().getFloatElement(fs.getSelectedFloatName()); protected abstract void refreshDetails();
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.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum; import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; 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 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() { public JComponent createCenterBody() {
this.createPanes(); this.createPanes();
this.createSwitchTab(); this.createSwitchTab();
dsColumnRegion = new JPanel(new BorderLayout()); JPanel dsColumnRegion = new JPanel(new BorderLayout());
dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH);
dsColumnRegion.add(cardContainer, BorderLayout.CENTER); dsColumnRegion.add(cardContainer, BorderLayout.CENTER);
centerPane = new JPanel(new BorderLayout()); JPanel centerPane = new JPanel(new BorderLayout());
centerPane.add(dsColumnRegion, BorderLayout.CENTER); centerPane.add(dsColumnRegion, BorderLayout.CENTER);
return centerPane; return centerPane;
} }
@ -141,17 +139,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
/**
* 关闭时候释放
*/
@Override
public void release() {
super.release();
dsColumnRegion = null;
centerPane = null;
}
/** /**
* 初始化基本和高级设置切换tab * 初始化基本和高级设置切换tab
*/ */
@ -187,6 +174,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
paneList.add(cellDSColumnAdvancedPane); paneList.add(cellDSColumnAdvancedPane);
} }
@Override
public void release() {
super.release();
cellDSColumnBasicPane.release();
cellDSColumnAdvancedPane.release();
}
/** /**
* 单元格元素 数据列 高级设置内容面板 * 单元格元素 数据列 高级设置内容面板
@ -252,9 +245,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
}; };
DSColumnBasicEditorPane() { DSColumnBasicEditorPane() {
dataPane = new SelectedDataColumnPane(true, true, tc, cellElement); dataPane = new SelectedDataColumnPane(true, true);
groupPane = new ResultSetGroupDockingPane(); groupPane = new ResultSetGroupDockingPane();
dataPane.addListener(dataListener); dataPane.setListener(dataListener);
groupPane.setListener(groupListener); groupPane.setListener(groupListener);
double[] rowSize = {P}, columnSize = {P, F}; double[] rowSize = {P}, columnSize = {P, F};
@ -297,13 +290,19 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
dataPane.populate(null, cellElement); dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc);
groupPane.populate(cellElement); groupPane.populate(cellElement);
if (tc != null) { if (tc != null) {
condition.setEditingComponent(tc); 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 { 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; 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() { public DSColumnAdvancedEditorPane() {
@ -397,6 +466,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
public void populate() { public void populate() {
if (cellElement != null) { if (cellElement != null) {
disableListener();
sortPane.populate(cellElement); sortPane.populate(cellElement);
valuePane.populate(cellElement); valuePane.populate(cellElement);
filterPane.populate(cellElement); filterPane.populate(cellElement);
@ -406,6 +476,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
// extendable // extendable
//noinspection Duplicates
switch (cellExpandAttr.getExtendable()) { switch (cellExpandAttr.getExtendable()) {
case CellExpandAttr.Both_EXTENDABLE: case CellExpandAttr.Both_EXTENDABLE:
heCheckBox.setSelected(true); heCheckBox.setSelected(true);
@ -425,15 +496,23 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
} }
if (cellExpandAttr.getMultipleNumber() == -1) { if (cellExpandAttr.getMultipleNumber() == -1) {
useMultiplyNumCheckBox.setSelected(false); useMultiNumCheckBox.setSelected(false);
// 默认值
multiNumSpinner.setValue(1);
} else { } else {
useMultiplyNumCheckBox.setSelected(true); useMultiNumCheckBox.setSelected(true);
multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber()); multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber());
} }
this.checkButtonEnabled(); this.checkButtonEnabled();
enableListener();
} }
} }
@Override
protected void release() {
}
/** /**
* 更新单元格扩展属性 * 更新单元格扩展属性
*/ */
@ -443,6 +522,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
cellExpandAttr = new CellExpandAttr(); cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr); cellElement.setCellExpandAttr(cellExpandAttr);
} }
//noinspection Duplicates
if (heCheckBox.isSelected()) { if (heCheckBox.isSelected()) {
if (veCheckBox.isSelected()) { if (veCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);
@ -463,12 +543,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
private void updateMultipleConfig() { private void updateMultipleConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (this.useMultiplyNumCheckBox.isSelected()) { if (this.useMultiNumCheckBox.isSelected()) {
cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue()); cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue());
} else { } else {
cellExpandAttr.setMultipleNumber(-1); cellExpandAttr.setMultipleNumber(-1);
} }
} }
/** /**
@ -479,68 +558,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
//结果集排序 //结果集排序
sortPane = new ResultSetSortConfigPane(); 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 = new ResultSetFilterConfigPane();
filterPane.addListener(new UIObserverListener() {
@Override
public void doChange() {
filterPane.update(cellElement);
fireTargetModified();
}
}
);
//自定义值显示 //自定义值显示
valuePane = new CustomValuePane(); valuePane = new CustomValuePane();
valuePane.addListener(new UIObserverListener() {
@Override
public void doChange() {
valuePane.update(cellElement);
fireTargetModified();
}
});
//可扩展性 //可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"))); extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_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()); JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiplyNumCheckBox, BorderLayout.WEST); checkBoxPane.add(useMultiNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane); multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1); multiNumSpinner = new UISpinner(1, 10000, 1, 1);
//数据倍数 //数据倍数
UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple")); UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple"));
multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ multiPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
@ -551,25 +591,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
); );
multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); multiPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
multiNumPane.add(multiPane); multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
@Override enableListener();
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
multiNumSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
cellDSColumnAdvancedPane.updateMultipleConfig();
fireTargetModified();
}
});
double[] rowSize = {P, P, P, P, P, P}; double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {F}; double[] columnSize = {F};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{sortPane}, {sortPane},
{filterPane}, {filterPane},
@ -580,9 +606,29 @@ public class CellDSColumnEditor extends CellQuickEditor {
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, HGAP, VGAP); 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() { private void checkButtonEnabled() {
if (useMultiplyNumCheckBox.isSelected()) { if (useMultiNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true); multiNumSpinner.setEnabled(true);
multiPane.setVisible(true); multiPane.setVisible(true);
} else { } else {
@ -659,7 +705,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(TemplateCellElement cellElement) { public void populate(TemplateCellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
this.formulaField.populateElement(cellElement); this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder(); int sort = dSColumn.getOrder();
@ -676,6 +722,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
String sortFormula = dSColumn.getSortFormula(); String sortFormula = dSColumn.getSortFormula();
if (sortFormula != null && sortFormula.length() >= 1) { if (sortFormula != null && sortFormula.length() >= 1) {
this.formulaField.populate(sortFormula); this.formulaField.populate(sortFormula);
} else {
this.formulaField.populate(DEFAULT_VALUE);
} }
} }
} }
@ -689,8 +737,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) value;
dSColumn.setOrder(this.sortTypePane.getSelectedIndex()); dSColumn.setOrder(this.sortTypePane.getSelectedIndex());
dSColumn.setSortFormula(this.formulaField.getFormulaText()); dSColumn.setSortFormula(this.formulaField.getFormulaText());
} }
@ -707,6 +755,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
formulaField.addListener(formulaChangeListener); formulaField.addListener(formulaChangeListener);
sortTypePane.addChangeListener(changeListener); 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); rsComboBox.removeActionListener(actionListener);
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
SelectCount selectCount = dSColumn.getSelectCount(); SelectCount selectCount = dSColumn.getSelectCount();
this.topFormulaPane.populateElement(cellElement); this.topFormulaPane.populateElement(cellElement);
this.bottomFormulaPane.populateElement(cellElement); this.bottomFormulaPane.populateElement(cellElement);
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
// 重置默认值
this.topFormulaPane.populate(DEFAULT_VALUE);
this.bottomFormulaPane.populate(DEFAULT_VALUE);
this.serialTextField.setText(StringUtils.EMPTY);
if (selectCount != null) { if (selectCount != null) {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.rsComboBox.setSelectedIndex(selectCountType); this.rsComboBox.setSelectedIndex(selectCountType);
@ -927,6 +990,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} }
} else { } else {
this.rsComboBox.setSelectedIndex(0);
//未定义 //未定义
setCardPaneLayout.show(setCardPane, UNDEFINE.name()); setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name()); tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
@ -944,8 +1008,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) value;
int selectedFilterIndex = this.rsComboBox.getSelectedIndex(); int selectedFilterIndex = this.rsComboBox.getSelectedIndex();
if (selectedFilterIndex == 0) { if (selectedFilterIndex == 0) {
dSColumn.setSelectCount(null); dSColumn.setSelectCount(null);
@ -953,6 +1017,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = new SelectCount(); SelectCount selectCount = new SelectCount();
selectCount.setType(selectedFilterIndex); selectCount.setType(selectedFilterIndex);
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
//noinspection Duplicates
if (selectedFilterIndex == TOP.getValue()) { if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectedFilterIndex == BOTTOM.getValue()) { } else if (selectedFilterIndex == BOTTOM.getValue()) {
@ -976,6 +1041,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
rsComboBox.registerChangeListener(formulaListener); rsComboBox.registerChangeListener(formulaListener);
serialTextField.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); this.formulaTextField.registerChangeListener(listener);
} }
/**
* 取消事件监听器
*/
public void removeListener() {
this.formulaTextField.registerChangeListener(null);
}
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -1042,7 +1124,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dsColumn = (DSColumn) value; DSColumn dsColumn = (DSColumn) value;
String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName()); String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName());
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true)); formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true));
@ -1086,12 +1168,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void populate(CellElement cellElement) { public void populate(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
//formula //formula
String valueFormula = dSColumn.getResult(); String valueFormula = dSColumn.getResult();
if (valueFormula != null) { if (valueFormula != null) {
formulaField.populate(valueFormula); formulaField.populate(valueFormula);
} else {
formulaField.populate(DEFAULT_VALUE);
} }
formulaField.populateElement(cellElement); formulaField.populateElement(cellElement);
@ -1102,7 +1186,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setResult(this.formulaField.getFormulaText()); dSColumn.setResult(this.formulaField.getFormulaText());
} }
@ -1117,6 +1201,13 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void addListener(UIObserverListener formulaListener) { public void addListener(UIObserverListener formulaListener) {
this.formulaField.addListener(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.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton; 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.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -13,7 +12,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
/** /**
* 单元格元素富文本编辑器 * 单元格元素富文本编辑器
@ -58,4 +56,9 @@ public class CellRichTextEditor extends CellQuickEditor {
return true; 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.BaseFormula;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.grid.GridKeyListener; import com.fr.grid.GridKeyListener;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -18,7 +17,6 @@ import javax.swing.JPanel;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; 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() { public boolean isScrollAll() {
return true; 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.quickeditor.FloatQuickEditor;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -73,8 +75,6 @@ public class FloatImageQuickEditor extends FloatQuickEditor {
@Override @Override
protected void refreshDetails() { 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.report.ReportHelper;
import com.fr.stable.StringUtils; 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.DocumentEvent;
import javax.swing.event.DocumentListener; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -27,6 +33,25 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
private boolean reserveInResult = false; private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true; 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() { public FloatStringQuickEditor() {
super(); super();
stringTextField = new JTextArea(); stringTextField = new JTextArea();
@ -34,11 +59,17 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
formulaButton = new UIButton(); formulaButton = new UIButton();
formulaButton.setPreferredSize(new Dimension(25, 23)); formulaButton.setPreferredSize(new Dimension(25, 23));
formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); 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); formulaButton.addActionListener(getFormulaActionListener);
JPanel pane = new JPanel(new BorderLayout(5, 0)); JPanel pane = new JPanel(new BorderLayout(5, 0));
pane.add(stringTextField, BorderLayout.CENTER); pane.add(stringTextField, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST); pane.add(formulaButton, BorderLayout.EAST);
pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,5)); pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
formulaButton.setVisible(false); formulaButton.setVisible(false);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@ -55,16 +86,10 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.setBackground(Color.WHITE); stringTextField.setBackground(Color.WHITE);
} }
ActionListener getFormulaActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing();
}
};
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
String str = null; String str;
Object value = floatElement.getValue(); Object value = floatElement.getValue();
if (value == null) { if (value == null) {
str = StringUtils.EMPTY; str = StringUtils.EMPTY;
@ -89,26 +114,8 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
stringTextField.getDocument().addDocumentListener(documentListener); 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) == '=')) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) {
BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText); BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText);
textFormula.setReserveInResult(reserveInResult); textFormula.setReserveInResult(reserveInResult);
@ -125,5 +132,4 @@ public class FloatStringQuickEditor extends FloatQuickEditor {
fireTargetModified(); fireTargetModified();
stringTextField.requestFocus(); stringTextField.requestFocus();
} }
} }
Loading…
Cancel
Save