Browse Source

REPORT-2897 9.0设计器修改

单元格属性面板
master
MoMeak 7 years ago
parent
commit
4686ba2fac
  1. 5
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  2. 47
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  3. 327
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  4. 84
      designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java
  5. 91
      designer/src/com/fr/design/present/BarCodePane.java
  6. 357
      designer/src/com/fr/design/present/CurrencyLinePane.java
  7. 72
      designer_base/src/com/fr/design/data/datapane/VerticalChoosePane.java
  8. 418
      designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java
  9. 23
      designer_base/src/com/fr/design/locale/designer.properties
  10. 23
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  11. 23
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  12. 23
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  13. 23
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  14. 23
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  15. 2
      designer_base/src/com/fr/design/mainframe/JFormSliderPane.java
  16. 147
      designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java
  17. 86
      designer_base/src/com/fr/design/present/dict/DictionaryPane.java
  18. 194
      designer_base/src/com/fr/design/present/dict/FormulaDictPane.java
  19. 97
      designer_base/src/com/fr/design/present/dict/TableDataDictPane.java

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

@ -64,8 +64,6 @@ public class ReportComponentComposite extends JComponent {
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
} }
KeyListener showValSpinnerKeyListener = new KeyListener() { KeyListener showValSpinnerKeyListener = new KeyListener() {
@ -155,6 +153,9 @@ public class ReportComponentComposite extends JComponent {
} }
Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid(); Grid grid = centerCardPane.editingComponet.elementCasePane.getGrid();
this.centerCardPane.editingComponet.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.centerCardPane.editingComponet.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { if (!grid.hasFocus() && grid.isRequestFocusEnabled()) {
grid.requestFocus(); grid.requestFocus();
} }

47
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -1,31 +1,28 @@
package com.fr.design.mainframe.cell; package com.fr.design.mainframe.cell;
import java.awt.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.CellAttributeProvider; import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.dialog.BasicPane; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.design.utils.DesignUtils;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作 * the new 单元格属性表 !!!:只对当前选中的设置面板进行数据的populate和update操作
@ -51,16 +48,6 @@ public class CellElementEditPane extends BasicPane {
private CellAttributeProvider cellAttributeProvider = null; private CellAttributeProvider cellAttributeProvider = null;
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel)jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellElementEditPane(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
public CellElementEditPane() { public CellElementEditPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
@ -87,19 +74,11 @@ public class CellElementEditPane extends BasicPane {
}; };
tabsHeaderIconPane.setNeedLeftRightOutLine(false); tabsHeaderIconPane.setNeedLeftRightOutLine(false);
titlename = new UILabel(Inter.getLocText("Cell-Cell_Attributes"));
titlename.setFont(new Font("Dialog", 1, 14));
titlename.setForeground(new Color(30,190,245));
title = new JPanel();
title.setLayout(new BorderLayout());
title.add(titlename, BorderLayout.NORTH);
downTitle = new JPanel(); downTitle = new JPanel();
downTitle.setLayout(new BorderLayout()); downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH); downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
downTitle.add(center, BorderLayout.CENTER); downTitle.add(center, BorderLayout.CENTER);
this.add(title, BorderLayout.NORTH);
this.add(downTitle, BorderLayout.CENTER); this.add(downTitle, BorderLayout.CENTER);
} }
@ -154,8 +133,8 @@ public class CellElementEditPane extends BasicPane {
@Override @Override
public void attributeChange() { public void attributeChange() {
boolean isChooseFatherPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_LeftParent")) || boolean isChooseFatherPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_LeftParent")) ||
ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell")); ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
boolean isChooseExpandPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction")); boolean isChooseExpandPane = ComparatorUtils.equals(paneList.get(tabsHeaderIconPane.getSelectedIndex()).getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
if (isChooseExpandPane || isChooseFatherPane) { if (isChooseExpandPane || isChooseFatherPane) {
ePane.setSupportDefaultParentCalculate(true); ePane.setSupportDefaultParentCalculate(true);
} }
@ -170,7 +149,7 @@ public class CellElementEditPane extends BasicPane {
ePane.fireTargetModified(); ePane.fireTargetModified();
} }
} else { } else {
DesignUtils.errorMessage(Inter.getLocText(new String[]{"Not_use_a_cell_attribute_table_editing", "M_Insert-Float"}) + "!"); DesignUtils.errorMessage(Inter.getLocText(new String[]{"FR-Designer_Not_use_a_cell_attribute_table_editing", "FR-Designer_Float_Element"}) + "!");
} }
ePane.setSupportDefaultParentCalculate(false); ePane.setSupportDefaultParentCalculate(false);
} }
@ -191,7 +170,7 @@ public class CellElementEditPane extends BasicPane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("CellElement-Property_Table"); return Inter.getLocText("FR-Designer_CellElement_Property_Table");
} }
@Override @Override
@ -207,7 +186,7 @@ public class CellElementEditPane extends BasicPane {
paneList.add(new CellOtherSetPane()); paneList.add(new CellOtherSetPane());
cellAttributeProvider = ExtraDesignClassManager.getInstance().getSingle(CellAttributeProvider.MARK_STRING); cellAttributeProvider = ExtraDesignClassManager.getInstance().getSingle(CellAttributeProvider.MARK_STRING);
if (cellAttributeProvider != null){ if (cellAttributeProvider != null) {
paneList.add((AbstractCellAttrPane) cellAttributeProvider.createCellAttributePane()); paneList.add((AbstractCellAttrPane) cellAttributeProvider.createCellAttributePane());
} }
} }

327
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -1,29 +1,18 @@
package com.fr.design.mainframe.cell.settingpane; package com.fr.design.mainframe.cell.settingpane;
import java.awt.*; import com.fr.design.constants.LayoutConstants;
import java.awt.event.ItemEvent; import com.fr.design.editor.ValueEditorPane;
import java.awt.event.ItemListener; import com.fr.design.editor.ValueEditorPaneFactory;
import java.util.Locale;
import com.fr.base.FRContext;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.foldablepane.UIExpandablePane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
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.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -33,11 +22,21 @@ import com.fr.report.cell.cellattr.CellInsertPolicyAttr;
import com.fr.report.cell.cellattr.CellPageAttr; import com.fr.report.cell.cellattr.CellPageAttr;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/** /**
* @author zhou * @author zhou
* @since 2012-5-11下午5:24:31 * @since 2012-5-11下午5:24:31
*/ */
public class CellOtherSetPane extends AbstractCellAttrPane { public class CellOtherSetPane extends AbstractCellAttrPane {
private static final int HEAD_WDITH = 290;
private static final int HEAD_HEIGTH = 20;
// normal // normal
private UIButtonGroup autoshrik; private UIButtonGroup autoshrik;
@ -59,7 +58,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UICheckBox canBreakOnPaginateCheckBox; private UICheckBox canBreakOnPaginateCheckBox;
private UICheckBox repeatCheckBox; private UICheckBox repeatCheckBox;
private UICheckBox autoHeightCheckBox;
private UICheckBox autoWidthCheckBox;
// 插入行策略 // 插入行策略
private UIButtonGroup insertRowPolicy; private UIButtonGroup insertRowPolicy;
private ValueEditorPane valueEditor; private ValueEditorPane valueEditor;
@ -69,146 +69,169 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
/** /**
* 初始化 * 初始化
* @return 面板 *
* @return 面板
*/ */
public JPanel createContentPane() { public JPanel createContentPane() {
final JPanel fileNamePane = createNormal(); JPanel downPane = new JPanel(new BorderLayout());
createOthers(); downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane()), BorderLayout.NORTH);
downPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane()), BorderLayout.CENTER);
JPanel contentPane = new JPanel(new BorderLayout(0, 10));
contentPane.add(new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane()), BorderLayout.NORTH);
contentPane.add(downPane, BorderLayout.CENTER);
initAllNames();
return contentPane;
}
private JPanel basicPane() {
autoHeightCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{null},
new Component[]{autoHeightCheckBox},
new Component[]{null},
new Component[]{autoWidthCheckBox},
new Component[]{null},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel seniorPane() {
// 插入行策略
insertRowPolicy = new UIButtonGroup(new String[]{Inter.getLocText("FR-Designer_CellWrite_InsertRow_NULL"), Inter.getLocText("FR-Designer-Estate_Default_Text"),
Inter.getLocText("FR-Designer_CellWrite_InsertRow_COPY")});
defaultValuePane = new JPanel(new BorderLayout(4, 0));
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
defaultValuePane.add(valueEditor, BorderLayout.CENTER);
defaultValuePane.setVisible(false);
insertRowPolicy.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1);
}
});
JPanel fileNamePane = createNormal();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize1 = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p, p};
double[] columnSize1 = {p, f}; double[] columnSize = {p, f};
UILabel autoAdjustLabel = new UILabel(Inter.getLocText("FR-Designer_Auto_Adjust_Size") + ":", SwingConstants.RIGHT); int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
autoAdjustLabel.setVerticalAlignment(UILabel.TOP); Component[][] components = new Component[][]{
Component[][] components1 = new Component[][]{ new Component[]{null, null},
new Component[]{autoAdjustLabel, autoshrik}, new Component[]{previewCellContent, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Preview") + ":", SwingConstants.RIGHT), previewCellContent}, new Component[]{printAndExportContent, null},
new Component[]{new UILabel(Inter.getLocText("CellWrite-Print_Export") + ":", SwingConstants.RIGHT), printAndExportContent}, new Component[]{printAndExportBackground, null},
new Component[]{null, printAndExportBackground}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content"), SwingConstants.LEFT), showContent},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content") + ":", SwingConstants.RIGHT), showContent},
new Component[]{null, fileNamePane}, new Component[]{null, fileNamePane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip") + ":", SwingConstants.RIGHT), tooltipTextField}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip"), SwingConstants.RIGHT), tooltipTextField},
}; new Component[]{null, null},
JPanel northContentPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
double[] rowSize2 = {p, p, p, p, p, p};
double[] columnSize2 = {p, f};
Component[][] components2 = new Component[][]{
new Component[]{new JSeparator(JSeparator.HORIZONTAL), null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Pagination")), null},
new Component[]{pageBeforeRowCheckBox, pageAfterRowCheckBox},
new Component[]{pageBeforeColumnCheckBox, pageAfterColumnCheckBox},
new Component[]{canBreakOnPaginateCheckBox, null},
new Component[]{repeatCheckBox, null}
}; };
JPanel centerContentPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2); JPanel seniorCenterPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
double[] rowSize3 = {p, p, p, p}; double[] rowSize1 = {p, p};
double[] columnSize3 = {f}; double[] columnSize1 = {p, f};
Component[][] components3 = new Component[][]{ int[][] rowCount1 = {{1, 1}, {1, 1}};
new Component[]{new JSeparator(JSeparator.HORIZONTAL)}, Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("CellWrite-InsertRow_Policy"), SwingConstants.LEFT)}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{insertRowPolicy}, new Component[]{null, defaultValuePane},
new Component[]{defaultValuePane}
}; };
southContentPane = TableLayoutHelper.createTableLayoutPane(components3, rowSize3, columnSize3); southContentPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
JPanel contentsmallPane = new JPanel(new BorderLayout(0, 10)); JPanel seniorPane = new JPanel(new BorderLayout());
contentsmallPane.add(northContentPane, BorderLayout.NORTH); seniorPane.add(seniorCenterPane, BorderLayout.NORTH);
contentsmallPane.add(centerContentPane, BorderLayout.CENTER); seniorPane.add(southContentPane, BorderLayout.CENTER);
JPanel contentPane = new JPanel(new BorderLayout(0, 10)); return seniorPane;
contentPane.add(contentsmallPane, BorderLayout.NORTH);
contentPane.add(southContentPane, BorderLayout.CENTER);
initAllNames();
return contentPane;
} }
private JPanel pagePane() {
// 分页
pageBeforeRowCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Row"));
private JPanel createNormal() { pageAfterRowCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_After_Row"));
String[] AjustRowTypes = new String[]{ pageBeforeColumnCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Column"));
Inter.getLocText("FR-Designer_No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("FR-Designer_DEFAULT")}; pageAfterColumnCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"));
autoshrik = new UIButtonGroup(AjustRowTypes);
if (FRContext.getLocale().equals(Locale.US)) {
// 英文显示不全,故每行一个按钮
autoshrik.setFourLine();
autoshrik.setLayout(new GridLayout(4, 1, 1, 1));
} else {
autoshrik.setTwoLine();
autoshrik.setLayout(new GridLayout(2, 2, 1, 1));
}
previewCellContent = new UICheckBox(Inter.getLocText("CellWrite-Preview_Cell_Content")); canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
printAndExportContent = new UICheckBox(Inter.getLocText("CellWrite-Print_Content")); repeatCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"));
printAndExportBackground = new UICheckBox(Inter.getLocText("CellWrite-Print_Background"));
showContent = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("CellWrite-Show_As_Image"), Inter.getLocText("CellWrite-Show_As_HTML"), double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{null},
new Component[]{pageBeforeRowCheckBox},
new Component[]{pageAfterRowCheckBox},
new Component[]{null},
new Component[]{pageBeforeColumnCheckBox},
new Component[]{pageAfterColumnCheckBox},
new Component[]{null},
new Component[]{canBreakOnPaginateCheckBox},
new Component[]{repeatCheckBox},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel createNormal() {
previewCellContent = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Preview_Cell_Content"));
printAndExportContent = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Print_Content"));
printAndExportBackground = new UICheckBox(Inter.getLocText("FR-Designer_CellWrite_Print_Background"));
showContent = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("FR-Designer_CellWrite_Show_As_Image"), Inter.getLocText("FR-Designer_CellWrite_Show_As_HTML"),
Inter.getLocText("FR-Designer_Show_As_Download")}); Inter.getLocText("FR-Designer_Show_As_Download")});
final CardLayout fileNameLayout = new CardLayout(); final CardLayout fileNameLayout = new CardLayout();
final JPanel fileNamePane = new JPanel(fileNameLayout); final JPanel fileNamePane = new JPanel(fileNameLayout);
JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0)); JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0));
fileNameCCPane.add(new UILabel(Inter.getLocText("FR-Designer_File_Name_For_Download")), BorderLayout.WEST); fileNameCCPane.add(new UILabel(Inter.getLocText("FR-Designer_File_Name_For_Download")), BorderLayout.WEST);
fileNameTextField = new UITextField(); fileNameTextField = new UITextField();
tooltipTextField = new UITextField(); tooltipTextField = new UITextField();
tooltipTextField.getUI(); tooltipTextField.getUI();
fileNamePane.add(new JPanel(), "none"); fileNamePane.add(new JPanel(), "none");
fileNamePane.add(fileNameCCPane, "content"); fileNamePane.add(fileNameCCPane, "content");
fileNamePane.setPreferredSize(new Dimension(0, 0));
fileNameCCPane.add(fileNameTextField, BorderLayout.CENTER); fileNameCCPane.add(fileNameTextField, BorderLayout.CENTER);
showContent.addItemListener(new ItemListener() { showContent.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
fileNameLayout.show(fileNamePane, showContent.getSelectedIndex() == 3 ? "content" : "none"); if (showContent.getSelectedIndex() == 3) {
fileNamePane.setPreferredSize(new Dimension(100, 20));
fileNameLayout.show(fileNamePane, "content");
} else {
fileNameLayout.show(fileNamePane, "none");
fileNamePane.setPreferredSize(new Dimension(0, 0));
}
} }
}); });
tooltipTextField = new UITextField(); tooltipTextField = new UITextField();
tooltipTextField.getUI(); tooltipTextField.getUI();
return fileNamePane; return fileNamePane;
} }
private void createOthers() {
// 分页
pageBeforeRowCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_Before_Row"));
pageAfterRowCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_After_Row"));
pageBeforeColumnCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_Before_Column"));
pageAfterColumnCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Page_After_Column"));
canBreakOnPaginateCheckBox = new UICheckBox(Inter.getLocText("CellPage-Can_Break_On_Paginate"));
repeatCheckBox = new UICheckBox(Inter.getLocText("CellWrite-Repeat_Content_When_Paging"));
// 插入行策略
insertRowPolicy = new UIButtonGroup(new String[]{Inter.getLocText("CellWrite-InsertRow_NULL"), Inter.getLocText("CellWrite-InsertRow_DEFAULT"),
Inter.getLocText("CellWrite-InsertRow_COPY")});
defaultValuePane = new JPanel(new BorderLayout(4, 0));
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
defaultValuePane.add(valueEditor, BorderLayout.CENTER);
defaultValuePane.setVisible(false);
insertRowPolicy.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1);
}
});
}
private void initAllNames() { private void initAllNames() {
autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size")); // autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size"));
autoHeightCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Height"));
autoWidthCheckBox.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"));
previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview")); previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview"));
printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content")); printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content"));
printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background")); printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background"));
showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content"));
tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip")); tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip"));
pageBeforeRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Row")); pageBeforeRowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Row"));
pageAfterRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_After_Row")); pageAfterRowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_After_Row"));
pageBeforeColumnCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Column")); pageBeforeColumnCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_Before_Column"));
pageAfterColumnCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_After_Column")); pageAfterColumnCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"));
canBreakOnPaginateCheckBox.setGlobalName(Inter.getLocText("CellPage-Can_Break_On_Paginate")); canBreakOnPaginateCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellPage_Can_Break_On_Paginate"));
repeatCheckBox.setGlobalName(Inter.getLocText("CellWrite-Repeat_Content_When_Paging")); repeatCheckBox.setGlobalName(Inter.getLocText("FR-Designer_CellPage_Repeat_Content_When_Paging"));
insertRowPolicy.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy")); insertRowPolicy.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"));
valueEditor.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy")); valueEditor.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"));
} }
@ -224,14 +247,34 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
if (cellGUIAttr == null) { if (cellGUIAttr == null) {
cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR; cellGUIAttr = CellGUIAttr.DEFAULT_CELLGUIATTR;
} }
autoshrik.setSelectedIndex(cellGUIAttr.getAdjustMode()); // autoshrik.setSelectedIndex(cellGUIAttr.getAdjustMode());
switch (cellGUIAttr.getAdjustMode()) {
case 0:
autoHeightCheckBox.setSelected(false);
autoWidthCheckBox.setSelected(false);
break;
case 1:
autoHeightCheckBox.setSelected(true);
autoWidthCheckBox.setSelected(false);
break;
case 2:
autoHeightCheckBox.setSelected(false);
autoWidthCheckBox.setSelected(true);
break;
case 3:
autoHeightCheckBox.setSelected(true);
autoWidthCheckBox.setSelected(true);
break;
default:
break;
}
previewCellContent.setSelected(cellGUIAttr.isPreviewContent()); previewCellContent.setSelected(cellGUIAttr.isPreviewContent());
printAndExportContent.setSelected(cellGUIAttr.isPrintContent()); printAndExportContent.setSelected(cellGUIAttr.isPrintContent());
printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground()); printAndExportBackground.setSelected(cellGUIAttr.isPrintBackground());
if (cellGUIAttr.isShowAsImage()) { if (cellGUIAttr.isShowAsImage()) {
showContent.setSelectedItem(Inter.getLocText("CellWrite-Show_As_Image")); showContent.setSelectedItem(Inter.getLocText("FR-Designer_CellWrite_Show_As_Image"));
} else if (cellGUIAttr.isShowAsHTML()) { } else if (cellGUIAttr.isShowAsHTML()) {
showContent.setSelectedItem(Inter.getLocText("CellWrite-Show_As_HTML")); showContent.setSelectedItem(Inter.getLocText("FR-Designer_CellWrite_Show_As_HTML"));
} else if (cellGUIAttr.isShowAsDownload()) { } else if (cellGUIAttr.isShowAsDownload()) {
showContent.setSelectedItem(Inter.getLocText("FR-Designer_Show_As_Download")); showContent.setSelectedItem(Inter.getLocText("FR-Designer_Show_As_Download"));
fileNameTextField.setText(cellGUIAttr.getFileName()); fileNameTextField.setText(cellGUIAttr.getFileName());
@ -265,7 +308,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1); defaultValuePane.setVisible(insertRowPolicy.getSelectedIndex() == 1);
southContentPane.setVisible(true); southContentPane.setVisible(true);
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (!jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 插入行策略 if (!jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 插入行策略
southContentPane.setVisible(false); southContentPane.setVisible(false);
} }
} }
@ -281,19 +324,36 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellGUIAttr = new CellGUIAttr(); cellGUIAttr = new CellGUIAttr();
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) { // if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) {
cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex()); // cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex());
// }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Height")) || ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Wdith"))) {
int flag;
if (autoHeightCheckBox.isSelected()) {
if (autoWidthCheckBox.isSelected()) {
flag = 3;
} else {
flag = 1;
}
} else if (autoWidthCheckBox.isSelected()) {
flag = 2;
} else {
flag = 0;
}
cellGUIAttr.setAdjustMode(flag);
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) {
cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); cellGUIAttr.setPreviewContent(previewCellContent.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Preview_Cell_Content"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Preview_Cell_Content"))) {
cellGUIAttr.setPrintContent(printAndExportContent.isSelected()); cellGUIAttr.setPrintContent(printAndExportContent.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Print_Background"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Print_Background"))) {
cellGUIAttr.setPrintBackground(printAndExportBackground.isSelected()); cellGUIAttr.setPrintBackground(printAndExportBackground.isSelected());
} }
@ -334,28 +394,28 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellPageAttr = new CellPageAttr(); cellPageAttr = new CellPageAttr();
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_Before_Row"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_Before_Row"))) {
cellPageAttr.setPageBeforeRow(this.pageBeforeRowCheckBox.isSelected()); cellPageAttr.setPageBeforeRow(this.pageBeforeRowCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_After_Row"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_After_Row"))) {
cellPageAttr.setPageAfterRow(this.pageAfterRowCheckBox.isSelected()); cellPageAttr.setPageAfterRow(this.pageAfterRowCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_Before_Column"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_Before_Column"))) {
cellPageAttr.setPageBeforeColumn(this.pageBeforeColumnCheckBox.isSelected()); cellPageAttr.setPageBeforeColumn(this.pageBeforeColumnCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Page_After_Column"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Page_After_Column"))) {
cellPageAttr.setPageAfterColumn(this.pageAfterColumnCheckBox.isSelected()); cellPageAttr.setPageAfterColumn(this.pageAfterColumnCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellPage-Can_Break_On_Paginate"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Can_Break_On_Paginate"))) {
cellPageAttr.setCanBreakOnPaginate(canBreakOnPaginateCheckBox.isSelected()); cellPageAttr.setCanBreakOnPaginate(canBreakOnPaginateCheckBox.isSelected());
} }
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-Repeat_Content_When_Paging"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_Repeat_Content_When_Paging"))) {
cellPageAttr.setRepeat(this.repeatCheckBox.isSelected()); cellPageAttr.setRepeat(this.repeatCheckBox.isSelected());
} }
cellElement.setCellPageAttr(cellPageAttr); cellElement.setCellPageAttr(cellPageAttr);
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-InsertRow_Policy"))) { if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_InsertRow_Policy"))) {
// 插入 // 插入
CellInsertPolicyAttr cellInsertPolicyAttr = new CellInsertPolicyAttr(); CellInsertPolicyAttr cellInsertPolicyAttr = new CellInsertPolicyAttr();
@ -373,7 +433,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
} }
/** /**
*存储 * 存储
*/ */
public void updateBeans() { public void updateBeans() {
TemplateElementCase elementCase = elementCasePane.getEditingElementCase(); TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
@ -398,10 +458,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
/** /**
* 返回界面的标题 * 返回界面的标题
* @return 标题 *
* @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Datasource-Other_Attributes"); return Inter.getLocText("FR-Designer_Datasource_Other_Attributes");
} }
} }

84
designer/src/com/fr/design/mainframe/form/FormReportComponentComposite.java

@ -5,10 +5,12 @@ import com.fr.base.ScreenResolution;
import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
@ -26,12 +28,12 @@ import java.awt.event.*;
/** /**
* 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab * 整个FormElementCase编辑区域 包括滚动条中间的grid或者聚合块下面的sheetTab
*/ */
public class FormReportComponentComposite extends JComponent implements TargetModifiedListener, FormECCompositeProvider{ public class FormReportComponentComposite extends JComponent implements TargetModifiedListener, FormECCompositeProvider {
private static final int MAX = 400; private static final int MAX = 400;
private static final int HUND = 100; private static final int HUND = 100;
private static final int MIN = 10; private static final int MIN = 10;
public FormElementCaseDesigner elementCaseDesigner; public FormElementCaseDesigner elementCaseDesigner;
private BaseJForm jForm; private BaseJForm jForm;
private FormTabPane sheetNameTab; private FormTabPane sheetNameTab;
@ -48,8 +50,6 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener); jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
((JForm)this.jForm).getFormDesign().getArea().addMouseWheelListener(showValSpinnerMouseWheelListener);
((JForm)this.jForm).getFormDesign().getArea().addKeyListener(showValSpinnerKeyListener);
this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener); this.elementCaseDesigner.elementCasePane.getGrid().addMouseWheelListener(showValSpinnerMouseWheelListener);
this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener); this.elementCaseDesigner.elementCasePane.getGrid().addKeyListener(showValSpinnerKeyListener);
elementCaseDesigner.addTargetModifiedListener(this); elementCaseDesigner.addTargetModifiedListener(this);
@ -60,22 +60,24 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if( e.isControlDown()){ if (e.isControlDown()) {
isCtrl = true ; isCtrl = true;
} }
} }
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
isCtrl = false ; isCtrl = false;
} }
}; };
MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() { MouseWheelListener showValSpinnerMouseWheelListener = new MouseWheelListener() {
@Override @Override
public void mouseWheelMoved(MouseWheelEvent e) { public void mouseWheelMoved(MouseWheelEvent e) {
if (isCtrl){ if (isCtrl) {
int dir = e.getWheelRotation(); int dir = e.getWheelRotation();
int old_resolution = (int) jSliderContainer.getShowVal().getValue(); int old_resolution = (int) jSliderContainer.getShowVal().getValue();
jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN)); jSliderContainer.getShowVal().setValue(old_resolution - (dir * MIN));
@ -87,10 +89,10 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
ChangeListener showValSpinnerChangeListener = new ChangeListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner)e.getSource()).getValue(); double value = (int) ((UIBasicSpinner) e.getSource()).getValue();
value = value > MAX ? MAX : value; value = value > MAX ? MAX : value;
value = value < MIN ? MIN : value; value = value < MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); int resolution = (int) (ScreenResolution.getScreenResolution() * value / HUND);
setScale(resolution); setScale(resolution);
// HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); // HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
} }
@ -99,18 +101,17 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
ItemListener selfAdaptButtonItemListener = new ItemListener() { ItemListener selfAdaptButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
if (jSliderContainer.getSelfAdaptButton().isSelected()){ if (jSliderContainer.getSelfAdaptButton().isSelected()) {
int resolution = selfAdaptUpdate(); int resolution = selfAdaptUpdate();
jSliderContainer.getShowVal().setValue(resolution*HUND/ScreenResolution.getScreenResolution()); jSliderContainer.getShowVal().setValue(resolution * HUND / ScreenResolution.getScreenResolution());
} }
} }
}; };
private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>(); private java.util.List<TargetModifiedListener> targetModifiedList = new java.util.ArrayList<TargetModifiedListener>();
private void setScale(int resolution){ private void setScale(int resolution) {
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); ElementCasePane elementCasePane = elementCaseDesigner.getEditingElementCasePane();
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
elementCasePane.setResolution(resolution); elementCasePane.setResolution(resolution);
elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
elementCasePane.getGrid().setResolution(resolution); elementCasePane.getGrid().setResolution(resolution);
@ -122,20 +123,16 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
elementCasePane.getGrid().updateUI(); elementCasePane.getGrid().updateUI();
//更新Column和Row //更新Column和Row
((DynamicScrollBar)elementCasePane.getVerticalScrollBar()).setDpi(resolution); ((DynamicScrollBar) elementCasePane.getVerticalScrollBar()).setDpi(resolution);
((DynamicScrollBar)elementCasePane.getHorizontalScrollBar()).setDpi(resolution); ((DynamicScrollBar) elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
elementCasePane.getGridColumn().setResolution(resolution); elementCasePane.getGridColumn().setResolution(resolution);
elementCasePane.getGridColumn().updateUI(); elementCasePane.getGridColumn().updateUI();
elementCasePane.getGridRow().setResolution(resolution); elementCasePane.getGridRow().setResolution(resolution);
elementCasePane.getGridRow().updateUI(); elementCasePane.getGridRow().updateUI();
} }
private int selfAdaptUpdate(){ private int selfAdaptUpdate() {
JForm jForm = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); ElementCasePane elementCasePane = elementCaseDesigner.getEditingElementCasePane();
if (jForm.resolution == 0){
jForm.resolution = ScreenResolution.getScreenResolution();
}
ElementCasePane elementCasePane = ((FormReportComponentComposite)jForm.getReportComposite()).elementCaseDesigner.getEditingElementCasePane();
ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane(); ElementCasePane reportPane = elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0]; int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length; double columnLength = reportPane.getSelection().getSelectedColumns().length;
@ -143,10 +140,10 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
int row = reportPane.getSelection().getSelectedRows()[0]; int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length; double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent(); double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){ if (columnLength == 0 || rowLength == 0) {
return jForm.resolution; return ScreenResolution.getScreenResolution();
} }
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength); double time = (columnExtent / columnLength) < (rowExtent / rowLength) ? (columnExtent / columnLength) : (rowExtent / rowLength);
if (reportPane.isHorizontalScrollBarVisible()) { if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row); reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column); reportPane.getHorizontalScrollBar().setValue(column);
@ -155,23 +152,26 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
} }
/** /**
* 添加目标改变的监听 * 添加目标改变的监听
* @param targetModifiedListener 目标改变事件 *
* @param targetModifiedListener 目标改变事件
*/ */
public void addTargetModifiedListener(TargetModifiedListener targetModifiedListener) { public void addTargetModifiedListener(TargetModifiedListener targetModifiedListener) {
targetModifiedList.add(targetModifiedListener); targetModifiedList.add(targetModifiedListener);
} }
/** /**
* 目标改变 * 目标改变
* @param e 事件 *
* @param e 事件
*/ */
public void targetModified(TargetModifiedEvent e) { public void targetModified(TargetModifiedEvent e) {
for (TargetModifiedListener l : targetModifiedList) { for (TargetModifiedListener l : targetModifiedList) {
l.targetModified(e); l.targetModified(e);
} }
} }
public void setEditingElementCase(FormElementCase formElementCase){
public void setEditingElementCase(FormElementCase formElementCase) {
elementCaseDesigner.setTarget(formElementCase); elementCaseDesigner.setTarget(formElementCase);
fireTargetModified(); fireTargetModified();
} }
@ -183,8 +183,8 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
jSliderContainer = JSliderPane.getInstance(); jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer); JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
southPane.add(hbarContainer,BorderLayout.NORTH); southPane.add(hbarContainer, BorderLayout.NORTH);
southPane.add(splitpane,BorderLayout.CENTER); southPane.add(splitpane, BorderLayout.CENTER);
splitpane.setBorder(null); splitpane.setBorder(null);
splitpane.setDividerSize(3); splitpane.setDividerSize(3);
splitpane.setResizeWeight(1); splitpane.setResizeWeight(1);
@ -195,7 +195,7 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
* 停止编辑 * 停止编辑
*/ */
public void stopEditing() { public void stopEditing() {
elementCaseDesigner.stopEditing(); elementCaseDesigner.stopEditing();
} }
public void setComposite() { public void setComposite() {
@ -203,12 +203,12 @@ public class FormReportComponentComposite extends JComponent implements TargetMo
this.validate(); this.validate();
this.repaint(40); this.repaint(40);
} }
public void setSelectedWidget(FormElementCaseProvider fc) { public void setSelectedWidget(FormElementCaseProvider fc) {
if (fc != null){ if (fc != null) {
elementCaseDesigner.setTarget(fc); elementCaseDesigner.setTarget(fc);
} }
} }
/** /**
* 模板更新 * 模板更新

91
designer/src/com/fr/design/present/BarCodePane.java

@ -1,57 +1,47 @@
package com.fr.design.present; package com.fr.design.present;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
import javax.swing.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.BarcodeAttr; import com.fr.report.cell.cellattr.BarcodeAttr;
import com.fr.report.cell.cellattr.BarcodePresent; import com.fr.report.cell.cellattr.BarcodePresent;
import com.fr.report.cell.painter.barcode.BarcodeImpl; import com.fr.report.cell.painter.barcode.BarcodeImpl;
import com.fr.report.cell.painter.barcode.core.BarCodeUtils; import com.fr.report.cell.painter.barcode.core.BarCodeUtils;
import com.fr.stable.pinyin.ChineseHelper; import com.fr.stable.pinyin.ChineseHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author zhou * @author zhou
* @since 2012-6-4下午6:49:59 * @since 2012-6-4下午6:49:59
*/ */
public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> { public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private final int num16 = 16; private final int NUM16 = 16;
private BarCodePreviewPane barCodePreviewPane; private BarCodePreviewPane barCodePreviewPane;
private UIComboBox typeComboBox; private UIComboBox typeComboBox;
private UIBasicSpinner barWidthSpinner; private UIBasicSpinner barWidthSpinner;
@ -69,13 +59,23 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
addlistener(); addlistener();
} }
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new BarCodePane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
private void initComponents() { private void initComponents() {
barCodePreviewPane = new BarCodePreviewPane(); barCodePreviewPane = new BarCodePreviewPane();
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, 100, 0.1)); this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(10.0, 1, 100, 1.0));
this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1)); this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1));
this.barWidthSpinner.setPreferredSize(new Dimension(45, 20)); this.barWidthSpinner.setPreferredSize(new Dimension(60, 20));
this.barHeightSpinner.setPreferredSize(new Dimension(45, 20)); this.barHeightSpinner.setPreferredSize(new Dimension(60, 20));
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR);
borderPane.setBorder(titledBorder); borderPane.setBorder(titledBorder);
@ -95,7 +95,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
barCodePreviewPane.setPreferredSize(new Dimension(0, 145)); barCodePreviewPane.setPreferredSize(new Dimension(0, 125));
final JPanel centerPane = new JPanel(new CardLayout()); final JPanel centerPane = new JPanel(new CardLayout());
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -109,7 +109,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
typeComboBox.addItemListener(new ItemListener() { typeComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); CardLayout cardLayout = (CardLayout) centerPane.getLayout();
cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == num16 ? "special" : "normal"); cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == NUM16 ? "special" : "normal");
setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex())); setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex()));
repaintPreviewBarCode(); repaintPreviewBarCode();
} }
@ -142,25 +142,22 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
} }
private JPanel getNormalPane() { private JPanel getNormalPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize1 = {p, f, f};
JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel barWidthContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
barWidthContainer.add(barWidthSpinner); barWidthContainer.add(barWidthSpinner);
JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
barHeightContainer.add(barHeightSpinner); barHeightContainer.add(barHeightSpinner);
UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT);
uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize());
Component[][] components_normal = new Component[][]{ Component[][] components_normal = new Component[][]{
new Component[]{uiLabel, barWidthContainer}, new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer},
new Component[]{new UILabel(Inter.getLocText("Height") + ":", UILabel.RIGHT), barHeightContainer}, new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)},
new Component[]{new UILabel(Inter.getLocText("Text") + ":", UILabel.RIGHT), drawingTextCheckBox} new Component[]{drawingTextCheckBox, null, null}
}; };
double[] columnSize1 = {p, p};
JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1);
return normalPane; return normalPane;
@ -247,7 +244,7 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
private void repaintPreviewBarCode() { private void repaintPreviewBarCode() {
try { try {
// carl:不支持中文转条形码 // carl:不支持中文转条形码
if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != num16) { if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != NUM16) {
throw new Exception("Illegal Character."); throw new Exception("Illegal Character.");
} }
this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText())); this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText()));
@ -281,13 +278,13 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
@Override @Override
public BarcodePresent updateBean() { public BarcodePresent updateBean() {
BarcodeAttr barcodeAttr = new BarcodeAttr(); BarcodeAttr barcodeAttr = new BarcodeAttr();
if ((typeComboBox.getSelectedIndex() == num16 )) { if ((typeComboBox.getSelectedIndex() == NUM16)) {
barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex());
barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex());
barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue()); barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue());
} }
barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); barcodeAttr.setType(this.typeComboBox.getSelectedIndex());
barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue()); barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10);
barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue()); barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue());
barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected());
return new BarcodePresent(barcodeAttr); return new BarcodePresent(barcodeAttr);

357
designer/src/com/fr/design/present/CurrencyLinePane.java

@ -1,238 +1,231 @@
package com.fr.design.present; package com.fr.design.present;
import java.awt.*;
import javax.swing.JComponent;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
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.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.cellattr.CurrencyLineAttr; import com.fr.report.cell.cellattr.CurrencyLineAttr;
import com.fr.report.cell.cellattr.CurrencyLinePresent; import com.fr.report.cell.cellattr.CurrencyLinePresent;
import com.fr.report.cell.painter.barcode.BarcodeException; import com.fr.report.cell.painter.barcode.BarcodeException;
import com.fr.report.core.CurrencyLineImpl; import com.fr.report.core.CurrencyLineImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.gui.ispinner.UIBasicSpinner; import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
/** /**
*
* @author zhou * @author zhou
* @since 2012-6-4下午7:34:52 * @since 2012-6-4下午7:34:52
*/ */
public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent> { public class CurrencyLinePane extends FurtherBasicBeanPane<CurrencyLinePresent> {
private static final int VS_NUM = 4; private static final int VS_NUM = 4;
private static final int VG_NUM = 6; private static final int VG_NUM = 6;
private UIBasicSpinner intPartSpinner; private UIBasicSpinner intPartSpinner;
private UIBasicSpinner deciPartSpinner; private UIBasicSpinner deciPartSpinner;
private UITextField textField; private UITextField textField;
private CurrencyLinePreviewPane CurrencyLinePreviewPane; private CurrencyLinePreviewPane CurrencyLinePreviewPane;
private int intPart = 9; private int intPart = 9;
private int deciPart = 3; private int deciPart = 3;
private static final int POSITION = 8; private static final int POSITION = 8;
ChangeListener listener2 = new ChangeListener() { ChangeListener listener2 = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
}; };
DocumentListener listener = new DocumentListener() { DocumentListener listener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
@Override @Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
CurrencyLinePreviewPane.setObject(textField.getText(), update()); CurrencyLinePreviewPane.setObject(textField.getText(), update());
} }
}; };
public CurrencyLinePane() { public CurrencyLinePane() {
this.initComponents(); this.initComponents();
} }
protected void initComponents() { protected void initComponents() {
// 整数位选择 // 整数位选择
intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1));
intPartSpinner.setPreferredSize(new Dimension(45, 20)); intPartSpinner.setPreferredSize(new Dimension(135, 20));
// 小数位选择 // 小数位选择
deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1));
deciPartSpinner.setPreferredSize(new Dimension(45, 20)); deciPartSpinner.setPreferredSize(new Dimension(135, 20));
// 预览区域 // 预览区域
textField = new UITextField(10); textField = new UITextField(10);
CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); CurrencyLinePreviewPane = new CurrencyLinePreviewPane();
CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145));
JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel borderPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR); TitledBorder titledBorder = new TitledBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5), Inter.getLocText("StyleFormat-Sample"), 4, 2, this.getFont(), UIConstants.LINE_COLOR);
borderPane.setBorder(titledBorder); borderPane.setBorder(titledBorder);
borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER);
textField.requestFocus(); textField.requestFocus();
double vs = VS_NUM; double vs = VS_NUM;
double vg = VG_NUM; double vg = VG_NUM;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = {p, f};
double[] rowSize = { p, p,p,p }; double[] rowSize = {p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Data") + ":", UILabel.RIGHT),textField}, new Component[]{new UILabel(Inter.getLocText("Data"), UILabel.LEFT), textField},
new Component[]{borderPane,null}, new Component[]{borderPane, null},
new Component[]{new UILabel(Inter.getLocText("IntPart") + ":", UILabel.RIGHT), groupPane(intPartSpinner)}, new Component[]{new UILabel(Inter.getLocText("IntPart"), UILabel.LEFT), groupPane(intPartSpinner)},
new Component[]{new UILabel(Inter.getLocText("DeciPart") + ":", UILabel.RIGHT), groupPane(deciPartSpinner)} new Component[]{new UILabel(Inter.getLocText("DeciPart"), UILabel.LEFT), groupPane(deciPartSpinner)}
} ; };
JPanel linePane = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel linePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(linePane,BorderLayout.CENTER); this.add(linePane, BorderLayout.CENTER);
textField.getDocument().addDocumentListener(listener);
textField.getDocument().addDocumentListener(listener); intPartSpinner.addChangeListener(listener2);
intPartSpinner.addChangeListener(listener2); deciPartSpinner.addChangeListener(listener2);
deciPartSpinner.addChangeListener(listener2); textField.setText("123456.78");
textField.setText("123456.78"); }
}
@Override @Override
/** /**
* 窗口名 * 窗口名
* @return 同上 * @return 同上
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Currency_Line"); return Inter.getLocText("Currency_Line");
} }
/** /**
* *
*/ */
public CurrencyLineAttr update() { public CurrencyLineAttr update() {
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); CurrencyLineAttr currencylineAttr = new CurrencyLineAttr();
currencylineAttr.setintPart(((Integer)this.intPartSpinner.getValue()).intValue()); currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue());
currencylineAttr.setdeciPart(((Integer)this.deciPartSpinner.getValue()).intValue()); currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue());
return currencylineAttr; return currencylineAttr;
} }
/** /**
* *
*/ */
public void setintPart(int intpart) { public void setintPart(int intpart) {
this.intPart = intpart; this.intPart = intpart;
} }
/** /**
* *
*/ */
public void setdeciPart(int decipart) { public void setdeciPart(int decipart) {
this.deciPart = decipart; this.deciPart = decipart;
} }
private class CurrencyLinePreviewPane extends JPanel { private class CurrencyLinePreviewPane extends JPanel {
private String text; private String text;
CurrencyLineAttr currencyLineAttr; CurrencyLineAttr currencyLineAttr;
public CurrencyLinePreviewPane() { public CurrencyLinePreviewPane() {
// setBackground(Color.white); // setBackground(Color.white);
} }
public void setObject(String text, CurrencyLineAttr currencyLineAttr) { public void setObject(String text, CurrencyLineAttr currencyLineAttr) {
this.text = text; this.text = text;
this.currencyLineAttr = currencyLineAttr; this.currencyLineAttr = currencyLineAttr;
GUICoreUtils.repaint(this); GUICoreUtils.repaint(this);
} }
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
if (text == null){ if (text == null) {
return; return;
}
Dimension size = this.getSize();
try {
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr);
currencyLineImpl.draw((Graphics2D) g, (int) (size.getWidth()), (int) (size.getHeight()));
} catch (BarcodeException e) {
Color oldColor = g.getColor();
g.setColor(Color.red);
g.drawString(e.getMessage(), (int) (size.getWidth() / POSITION), (int) (size.getHeight() / POSITION));
g.setColor(oldColor);
} }
Dimension size = this.getSize(); }
try {
CurrencyLineImpl currencyLineImpl = new CurrencyLineImpl(text, currencyLineAttr); }
currencyLineImpl.draw((Graphics2D)g, (int)(size.getWidth()), (int)(size.getHeight()));
} catch (BarcodeException e) { protected static JPanel groupPane(JComponent comp) {
Color oldColor = g.getColor(); JPanel jp = new JPanel();
g.setColor(Color.red); jp.setBorder(null);
g.drawString(e.getMessage(), (int)(size.getWidth() / POSITION), (int)(size.getHeight() / POSITION)); jp.setLayout(new FlowLayout(FlowLayout.LEFT));
g.setColor(oldColor); jp.add(comp);
} return jp;
} }
} @Override
protected static JPanel groupPane(JComponent comp) {
JPanel jp = new JPanel();
jp.setBorder(null);
jp.setLayout(new FlowLayout(FlowLayout.LEFT));
jp.add(comp);
return jp;
}
@Override
/** /**
* 是否为该类型 * 是否为该类型
* @param ob 对象 * @param ob 对象
* @return 同上 * @return 同上
* *
*/ */
public boolean accept(Object ob) { public boolean accept(Object ob) {
return ob instanceof CurrencyLinePresent; return ob instanceof CurrencyLinePresent;
} }
/** /**
* 重置 * 重置
*/ */
public void reset() { public void reset() {
this.intPartSpinner.setValue(9); this.intPartSpinner.setValue(9);
this.deciPartSpinner.setValue(3); this.deciPartSpinner.setValue(3);
} }
@Override @Override
public void populateBean(CurrencyLinePresent ob) { public void populateBean(CurrencyLinePresent ob) {
CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr(); CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr();
if (currencyLine == null) { if (currencyLine == null) {
currencyLine = new CurrencyLineAttr(); currencyLine = new CurrencyLineAttr();
} }
this.intPartSpinner.setValue(new Integer(currencyLine.getintPart())); this.intPartSpinner.setValue(new Integer(currencyLine.getintPart()));
this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart())); this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart()));
} }
@Override @Override
public CurrencyLinePresent updateBean() { public CurrencyLinePresent updateBean() {
CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); CurrencyLineAttr currencylineAttr = new CurrencyLineAttr();
currencylineAttr.setintPart(((Integer)this.intPartSpinner.getValue()).intValue()); currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue());
currencylineAttr.setdeciPart(((Integer)this.deciPartSpinner.getValue()).intValue()); currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue());
return new CurrencyLinePresent(currencylineAttr); return new CurrencyLinePresent(currencylineAttr);
} }
} }

72
designer_base/src/com/fr/design/data/datapane/VerticalChoosePane.java

@ -1,69 +1,67 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import java.awt.*;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
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.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.Inter;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
public class VerticalChoosePane extends ChoosePane implements DesignerBean{ public class VerticalChoosePane extends ChoosePane implements DesignerBean {
public VerticalChoosePane(Previewable previewable) { public VerticalChoosePane(Previewable previewable) {
this(previewable, -1); this(previewable, -1);
} }
public VerticalChoosePane(Previewable previewable, int labelSize) { public VerticalChoosePane(Previewable previewable, int labelSize) {
super(previewable, labelSize); super(previewable, labelSize);
DesignerContext.setDesignerBean("databasename", this); DesignerContext.setDesignerBean("databasename", this);
} }
@Override @Override
protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) { protected void initComponentsLayout(PreviewLabel previewLabel, int labelSize) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f }; double[] columnSize = {p, f};
double[] rowSize = { p, p, p }; double[] rowSize = {p, p, p};
JPanel rs = new JPanel(new BorderLayout(0, 0)); JPanel rs = new JPanel(new BorderLayout(0, 0));
rs.add(tableNameComboBox, BorderLayout.CENTER); rs.add(tableNameComboBox, BorderLayout.CENTER);
rs.add(GUICoreUtils.createFlowPane(new Component[]{new RefreshLabel(this), previewLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST); rs.add(GUICoreUtils.createFlowPane(new Component[]{new RefreshLabel(this), previewLabel}, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST);
UILabel l1 = new UILabel(Inter.getLocText("Database") + ":", UILabel.RIGHT); UILabel l1 = new UILabel(Inter.getLocText("FR-Designer_Database"), UILabel.LEFT);
UILabel l2 = new UILabel(Inter.getLocText("Model") + ":", UILabel.RIGHT); UILabel l2 = new UILabel(Inter.getLocText("FR-Designer_Model"), UILabel.LEFT);
UILabel l3 = new UILabel(Inter.getLocText(new String[]{"Database", "Table"}) + ":", UILabel.RIGHT); UILabel l3 = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Database", "FR-Designer_Table"}), UILabel.LEFT);
if (labelSize > 0) { if (labelSize > 0) {
Dimension pSize = new Dimension(labelSize, 20); Dimension pSize = new Dimension(labelSize, 20);
l1.setPreferredSize(pSize); l1.setPreferredSize(pSize);
l2.setPreferredSize(pSize); l2.setPreferredSize(pSize);
l3.setPreferredSize(pSize); l3.setPreferredSize(pSize);
} }
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{l1, dsNameComboBox}, new Component[]{l1, dsNameComboBox},
new Component[]{l2, schemaBox}, new Component[]{l2, schemaBox},
new Component[]{l3, rs} new Component[]{l3, rs}
}; };
JPanel content = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel content = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(content,BorderLayout.CENTER); this.add(content, BorderLayout.CENTER);
} }
@Override @Override
public void refreshBeanElement() { public void refreshBeanElement() {
initDsNameComboBox(); initDsNameComboBox();
} }
} }

418
designer_base/src/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -0,0 +1,418 @@
package com.fr.design.editor;
import com.fr.base.Formula;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.*;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by MoMeak on 2017/7/26.
*/
public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, GlobalNameObserver {
private static final int CENTERPANE_WIDTH = 200;
private Editor[] cards;
private Editor currentEditor;
private UIButton arrowButton;
private JPopupMenu menu;
private JPanel centerPane;
private CardLayout cardLayout;
private Object value;
private UIButtonGroup upButton;
private GlobalNameListener globalNameListener = null;
private UIObserverListener uiObserverListener = null;
public DoubleDeckValueEditorPane(Editor[] cards) {
this(cards, null, null);
}
public DoubleDeckValueEditorPane(Editor[] cards, String popupName, String textEditorValue) {
initComponents(cards, popupName, textEditorValue, CENTERPANE_WIDTH);
}
public DoubleDeckValueEditorPane(Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) {
initComponents(cards, popupName, textEditorValue, centerPaneWidth);
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula"))}), BorderLayout.NORTH);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
private void initComponents(final Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) {
this.setLayout(new BorderLayout(0, 4));
this.cards = cards;
final String[] nameArray = new String[cards.length];
for (int i = 0; i < cards.length; i++) {
nameArray[i] = cards[i].getName();
}
upButton = new UIButtonGroup(nameArray);
upButton.setAllToolTips(nameArray);
this.add(upButton, BorderLayout.NORTH);
centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
setCurrentEditor(0);
centerPane.setPreferredSize(new Dimension(centerPaneWidth, centerPane.getPreferredSize().height));
menu = createPopMenu();
upButton.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (globalNameListener != null) {
globalNameListener.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy"));
}
Object oldValue = currentEditor.getValue();
setCurrentEditor(upButton.getSelectedIndex());
currentEditor.selected();
value = currentEditor.getValue();
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
DoubleDeckValueEditorPane.this.firePropertyChange("value", oldValue, value);
}
});
this.add(centerPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Values-Editor");
}
public Editor getCurrentEditor() {
return currentEditor;
}
public int getCurrentEditorIndex() {
for (int i = 0; i < cards.length; i++) {
if (cards[i].getClass() == currentEditor.getClass()) {
return i;
}
}
return 0;
}
public void setCurrentEditor(int i) {
currentEditor = this.cards[i];
centerPane.removeAll();
centerPane.add(currentEditor);
centerPane.validate();
centerPane.repaint();
}
public void setCurrentEditor(Class editorClass) {
for (int i = 0; i < cards.length; i++) {
if (cards[i].getClass() == editorClass) {
setCurrentEditor(i);
break;
}
}
}
private JPopupMenu createPopMenu() {
JPopupMenu scate = new JPopupMenu();
if (this.cards == null) {
return scate;
}
for (int i = 0; i < this.cards.length; i++) {
UIMenuItem item = new UIMenuItem(cards[i].getName());
final int j = i;
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (globalNameListener != null) {
globalNameListener.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy"));
}
Object oldValue = currentEditor.getValue();
setCurrentEditor(j);
currentEditor.selected();
value = currentEditor.getValue();
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
DoubleDeckValueEditorPane.this.firePropertyChange("value", oldValue, value);
}
});
scate.add(item);
if (i < cards.length - 1) {
scate.addSeparator();
}
}
return scate;
}
public void populate(Object object) {
for (int i = 0; i < cards.length; i++) {
if (cards[i].accept(object)) {
setCardValue(i, object);
break;
}
}
}
public void populate(Object object, String name) {
for (int i = 0; i < cards.length; i++) {
if (cards[i].accept(object) && ComparatorUtils.equals(cards[i].getName(), name)) {
setCardValue(i, object);
break;
}
}
}
private void setCardValue(int i, Object object) {
setCurrentEditor(i);
cards[i].setValue(object);
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
// 一定是最后的Editor哦.
for (int j = 0; j < cards.length; j++) {
if (i == j) {
upButton.setSelectedIndex(i);
continue;
}
this.cards[j].setValue(null);
}
}
public Object update() {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
//bug86542,这边为啥要new一个公式出来,只保留content,其他属性全不要了?
// if (ComparatorUtils.equals(name, Inter.getLocText("Formula"))) {
// columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
// }
return columnIndex;
}
public Object update(String makeAdiff) {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
}
if (currentEditor instanceof ColumnNameEditor) {
columnName = ((ColumnNameEditor) currentEditor).getColumnName();
}
return new Object[]{columnIndex, columnName};
}
public Object update(boolean isXMLA) {
String name = currentEditor.getName();
Object columnIndex = currentEditor.getValue();
Object columnName = StringUtils.EMPTY;
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) {
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString());
}
if (isXMLA) {
columnName = ((XMLANameEditor) currentEditor).getColumnName();
}
return new Object[]{columnIndex, columnName};
}
public void setEditors(Editor[] editors, Object obj) {
this.cards = editors;
this.populate(obj);
}
/**
* 检查是否有效
*
* @throws Exception 异常
*/
public void checkValid() throws Exception {
if (!(currentEditor instanceof TextEditor)) {
return;
}
int i;
boolean containFormulaType = false;
for (i = 0; i < cards.length; i++) {
if (ComparatorUtils.equals(cards[i].getName(), Inter.getLocText("FR-Engine_Parameter-Formula"))) {
containFormulaType = true;
break;
}
}
if (!containFormulaType) {
return;
}
final int j = i;
if (!(currentEditor instanceof TextEditor)) {
return;
}
String string = (String) currentEditor.getValue();
if (isFormula(string)) {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
if (designerEnvManager.isSupportStringToFormula()) {
if (!designerEnvManager.isDefaultStringToFormula()) {
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Edit_String_To_Formula")
+ "?", Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j);
Formula formula = new Formula(string);
currentEditor.setValue(formula);
}
} else {
setCurrentEditor(j);
Formula formula = new Formula(string);
currentEditor.setValue(formula);
}
}
}
}
private boolean isFormula(String string) {
return StringUtils.isNotBlank(string) && (string.length() > 0 && string.charAt(0) == '=');
}
@Override
public void setEnabled(boolean enabled) {
arrowButton.setEnabled(enabled);
for (Editor card : cards) {
card.setEnabled(enabled);
}
}
/**
* 重置组件
*/
public void resetComponets() {
for (Editor card : cards) {
card.reset();
}
}
/**
* 清除组件数据
*/
public void clearComponentsData() {
for (Editor card : cards) {
card.clearData();
}
}
public Editor[] getCards() {
return this.cards;
}
public JPopupMenu getMenu() {
return this.menu;
}
/**
* 注册全局名字监听事件
*
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 是否对名字listener监听器做出响应
*
* @return 如果要做出响应则返回true
*/
public boolean shouldResponseNameListener() {
return false;
}
public void setGlobalName(String name) {
for (Editor card : cards) {
setComponentGlobalName(card, name);
}
}
private void setComponentGlobalName(Container card, String name) {
for (int i = 0, len = card.getComponentCount(); i < len; i++) {
Component component = card.getComponent(i);
if (component instanceof GlobalNameObserver) {
((GlobalNameObserver) component).setGlobalName(name);
} else {
setComponentGlobalName((Container) component, name);
}
}
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
for (Editor card : cards) {
doLoop(card, listener);
}
}
private void doLoop(Container card, UIObserverListener listener) {
for (int i = 0, len = card.getComponentCount(); i < len; i++) {
Component component = card.getComponent(i);
if (component instanceof UIObserver) {
((UIObserver) component).registerChangeListener(listener);
} else {
doLoop((Container) component, listener);
}
}
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
public boolean shouldResponseChangeListener() {
return true;
}
}

23
designer_base/src/com/fr/design/locale/designer.properties

@ -2069,3 +2069,26 @@ FR-Designer_StyleAlignment_Wrap_Text=Wrap_Text
FR-Designer_StyleAlignment_Single_Line=Single_Line FR-Designer_StyleAlignment_Single_Line=Single_Line
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font)
FR-Designer_Auto_Adjust_Height=Auto_Adjust_Height
FR-Designer_Auto_Adjust_Wdith=Auto_Adjust_Wdith
FR-Designer_Type_Set=Type_Set
FR-Designer_Dic_Data_Query=Data_Query
FR-Designer_Dictionary_Dynamic_SQL=Dictionary_Dynamic_SQL
FR-Designer_Datasource_From_Database=Datasource_From_Database
FR-Designer_CellWrite_InsertRow_NULL=InsertRow_NULL
FR-Designer_CellWrite_InsertRow_COPY=InsertRow_COPY
FR-Designer_CellWrite_InsertRow_Policy=InsertRow_Policy
FR-Designer_CellWrite_Page_Before_Row=Page_Before_Row
FR-Designer_CellWrite_Page_After_Row=Page_After_Row
FR-Designer_CellWrite_Page_Before_Column=Page_Before_Column
FR-Designer_CellWrite_Page_After_Column=Page_After_Column
FR-Designer_CellPage_Can_Break_On_Paginate=Can_Break_On_Paginate
FR-Designer_CellPage_Repeat_Content_When_Paging=Repeat_Content_When_Paging
FR-Designer_CellWrite_Preview_Cell_Content=Preview_Cell_Content
FR-Designer_CellWrite_Print_Content=CellWrite_Print_Content
FR-Designer_CellWrite_Print_Background=CellWrite_Print_Background
FR-Designer_CellWrite_Show_As_Image=CellWrite_Show_As_Image
FR-Designer_CellWrite_Show_As_HTML=CellWrite_Show_As_HTML
FR-Designer_Datasource_Other_Attributes=Other_Attributes
FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing
FR-Designer_CellElement_Property_Table=CellElement_Property_Table

23
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2070,3 +2070,26 @@ FR-Designer_StyleAlignment_Wrap_Text=Wrap_Text
FR-Designer_StyleAlignment_Single_Line=Single_Line FR-Designer_StyleAlignment_Single_Line=Single_Line
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=Single_Line(Adjust_Font)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=Multi_Line(Adjust_Font)
FR-Designer_Auto_Adjust_Height=Auto_Adjust_Height
FR-Designer_Auto_Adjust_Wdith=Auto_Adjust_Wdith
FR-Designer_Type_Set=Type_Set
FR-Designer_Dic_Data_Query=Data_Query
FR-Designer_Dictionary_Dynamic_SQL=Dictionary_Dynamic_SQL
FR-Designer_Datasource_From_Database=Datasource_From_Database
FR-Designer_CellWrite_InsertRow_NULL=InsertRow_NULL
FR-Designer_CellWrite_InsertRow_COPY=InsertRow_COPY
FR-Designer_CellWrite_InsertRow_Policy=InsertRow_Policy
FR-Designer_CellWrite_Page_Before_Row=Page_Before_Row
FR-Designer_CellWrite_Page_After_Row=Page_After_Row
FR-Designer_CellWrite_Page_Before_Column=Page_Before_Column
FR-Designer_CellWrite_Page_After_Column=Page_After_Column
FR-Designer_CellPage_Can_Break_On_Paginate=Can_Break_On_Paginate
FR-Designer_CellPage_Repeat_Content_When_Paging=Repeat_Content_When_Paging
FR-Designer_CellWrite_Preview_Cell_Content=Preview_Cell_Content
FR-Designer_CellWrite_Print_Content=CellWrite_Print_Content
FR-Designer_CellWrite_Print_Background=CellWrite_Print_Background
FR-Designer_CellWrite_Show_As_Image=CellWrite_Show_As_Image
FR-Designer_CellWrite_Show_As_HTML=CellWrite_Show_As_HTML
FR-Designer_Datasource_Other_Attributes=Other_Attributes
FR-Designer_Not_use_a_cell_attribute_table_editing=Not_use_a_cell_attribute_table_editing
FR-Designer_CellElement_Property_Table=CellElement_Property_Table

23
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2052,3 +2052,26 @@ FR-Designer_StyleAlignment_Wrap_Text=
FR-Designer_StyleAlignment_Single_Line= FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)= FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)= FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith=
FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL=
FR-Designer_Datasource_From_Database=
FR-Designer_CellWrite_InsertRow_NULL=
FR-Designer_CellWrite_InsertRow_COPY=
FR-Designer_CellWrite_InsertRow_Policy=
FR-Designer_CellWrite_Page_Before_Row=
FR-Designer_CellWrite_Page_After_Row=
FR-Designer_CellWrite_Page_Before_Column=
FR-Designer_CellWrite_Page_After_Column=
FR-Designer_CellPage_Can_Break_On_Paginate=
FR-Designer_CellPage_Repeat_Content_When_Paging=
FR-Designer_CellWrite_Preview_Cell_Content=
FR-Designer_CellWrite_Print_Content=
FR-Designer_CellWrite_Print_Background=
FR-Designer_CellWrite_Show_As_Image=
FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=

23
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2050,3 +2050,26 @@ FR-Designer_StyleAlignment_Wrap_Text=
FR-Designer_StyleAlignment_Single_Line= FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)= FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)= FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith=
FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL=
FR-Designer_Datasource_From_Database=
FR-Designer_CellWrite_InsertRow_NULL=
FR-Designer_CellWrite_InsertRow_COPY=
FR-Designer_CellWrite_InsertRow_Policy=
FR-Designer_CellWrite_Page_Before_Row=
FR-Designer_CellWrite_Page_After_Row=
FR-Designer_CellWrite_Page_Before_Column=
FR-Designer_CellWrite_Page_After_Column=
FR-Designer_CellPage_Can_Break_On_Paginate=
FR-Designer_CellPage_Repeat_Content_When_Paging=
FR-Designer_CellWrite_Preview_Cell_Content=
FR-Designer_CellWrite_Print_Content=
FR-Designer_CellWrite_Print_Background=
FR-Designer_CellWrite_Show_As_Image=
FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=

23
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2069,3 +2069,26 @@ FR-Designer_StyleAlignment_Wrap_Text=\u81EA\u52A8\u6362\u884C
FR-Designer_StyleAlignment_Single_Line=\u5355\u884C\u663E\u793A FR-Designer_StyleAlignment_Single_Line=\u5355\u884C\u663E\u793A
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u5355\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53) FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=\u5355\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53)
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53) FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=\u591A\u884C\u663E\u793A(\u8C03\u6574\u5B57\u4F53)
FR-Designer_Auto_Adjust_Height=\u81EA\u52A8\u8C03\u6574\u884C\u9AD8
FR-Designer_Auto_Adjust_Wdith=\u81EA\u52A8\u8C03\u6574\u5217\u5BBD
FR-Designer_Type_Set=\u7C7B\u578B\u8BBE\u7F6E
FR-Designer_Dic_Data_Query=\u6570\u636E\u67E5\u8BE2
FR-Designer_Dictionary_Dynamic_SQL=\u52A8\u6001SQL
FR-Designer_Datasource_From_Database=\u6570\u636E\u5E93\u8868
FR-Designer_CellWrite_InsertRow_NULL=\u7A7A\u503C
FR-Designer_CellWrite_InsertRow_COPY=\u539F\u503C
FR-Designer_CellWrite_InsertRow_Policy=\u63D2\u5165\u884C\u7B56\u7565
FR-Designer_CellWrite_Page_Before_Row=\u884C\u524D\u5206\u9875
FR-Designer_CellWrite_Page_After_Row=\u884C\u540E\u5206\u9875
FR-Designer_CellWrite_Page_Before_Column=\u5217\u524D\u5206\u9875
FR-Designer_CellWrite_Page_After_Column=\u5217\u540E\u5206\u9875
FR-Designer_CellPage_Can_Break_On_Paginate=\u5206\u9875\u65F6\u53EF\u4EE5\u65AD\u5F00
FR-Designer_CellPage_Repeat_Content_When_Paging=\u5206\u9875\u65AD\u5F00\u65F6\u503C\u91CD\u590D\u663E\u793A
FR-Designer_CellWrite_Preview_Cell_Content=\u9884\u89C8\u5355\u5143\u683C\u5185\u5BB9
FR-Designer_CellWrite_Print_Content=\u6253\u5370/\u5BFC\u51FA\u5355\u5143\u683C\u5185\u5BB9
FR-Designer_CellWrite_Print_Background=\u6253\u5370/\u5BFC\u51FA\u5355\u5143\u683C\u80CC\u666F
FR-Designer_CellWrite_Show_As_Image=\u7528\u56FE\u7247\u663E\u793A\u5185\u5BB9
FR-Designer_CellWrite_Show_As_HTML=\u7528HTML\u663E\u793A\u5185\u5BB9
FR-Designer_Datasource_Other_Attributes=\u5176\u4ED6\u5C5E\u6027
FR-Designer_Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5355\u5143\u683C\u5C5E\u6027\u8868\u7F16\u8F91
FR-Designer_CellElement_Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868

23
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2069,3 +2069,26 @@ FR-Designer_StyleAlignment_Wrap_Text=
FR-Designer_StyleAlignment_Single_Line= FR-Designer_StyleAlignment_Single_Line=
FR-Designer_StyleAlignment_Single_Line(Adjust_Font)= FR-Designer_StyleAlignment_Single_Line(Adjust_Font)=
FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)= FR-Designer_StyleAlignment_Multi_Line(Adjust_Font)=
FR-Designer_Auto_Adjust_Height=
FR-Designer_Auto_Adjust_Wdith=
FR-Designer_Type_Set=
FR-Designer_Dic_Data_Query=
FR-Designer_Dictionary_Dynamic_SQL=
FR-Designer_Datasource_From_Database=
FR-Designer_CellWrite_InsertRow_NULL=
FR-Designer_CellWrite_InsertRow_COPY=
FR-Designer_CellWrite_InsertRow_Policy=
FR-Designer_CellWrite_Page_Before_Row=
FR-Designer_CellWrite_Page_After_Row=
FR-Designer_CellWrite_Page_Before_Column=
FR-Designer_CellWrite_Page_After_Column=
FR-Designer_CellPage_Can_Break_On_Paginate=
FR-Designer_CellPage_Repeat_Content_When_Paging=
FR-Designer_CellWrite_Preview_Cell_Content=
FR-Designer_CellWrite_Print_Content=
FR-Designer_CellWrite_Print_Background=
FR-Designer_CellWrite_Show_As_Image=
FR-Designer_CellWrite_Show_As_HTML=
FR-Designer_Datasource_Other_Attributes=
FR-Designer_Not_use_a_cell_attribute_table_editing=
FR-Designer_CellElement_Property_Table=

2
designer_base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -41,7 +41,7 @@ public class JFormSliderPane extends JPanel {
private static final int THREE_HUNDRED = 300; private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 150; private static final int DIALOG_WIDTH = 150;
private static final int DIALOG_HEIGHT = 240; private static final int DIALOG_HEIGHT = 220;
private static final int SHOWVALBUTTON_WIDTH = 70; private static final int SHOWVALBUTTON_WIDTH = 70;
private static final int SHOWVALBUTTON_HEIGHTH = 25; private static final int SHOWVALBUTTON_HEIGHTH = 25;
public int showValue = 100; public int showValue = 100;

147
designer_base/src/com/fr/design/present/dict/DatabaseDictPane.java

@ -1,48 +1,45 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.ItemSelectable;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.ChoosePane; import com.fr.design.data.datapane.ChoosePane;
import com.fr.design.data.datapane.DataBaseItems; import com.fr.design.data.datapane.DataBaseItems;
import com.fr.design.data.datapane.VerticalChoosePane; import com.fr.design.data.datapane.VerticalChoosePane;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.data.impl.DatabaseDictionary; import com.fr.design.editor.DoubleDeckValueEditorPane;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; 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.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> implements Previewable, UIObserver { public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> implements Previewable, UIObserver {
/** /**
* richer:数据字典和数据链面板 * richer:数据字典和数据链面板
*/ */
protected com.fr.data.impl.Connection database; protected com.fr.data.impl.Connection database;
protected ValueEditorPane keyColumnPane; protected DoubleDeckValueEditorPane keyColumnPane;
protected ValueEditorPane valueDictPane; protected DoubleDeckValueEditorPane valueDictPane;
protected ChoosePane chooseTable; protected ChoosePane chooseTable;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
@ -61,10 +58,12 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
private void initBasicComponet() { private void initBasicComponet() {
keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); // keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Engine_Parameter-Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); // valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
} }
private void initComponet() { private void initComponet() {
@ -72,13 +71,15 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p, p, p, p};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("Actual_Value") + ":"), keyColumnPane}, new Component[]{null, null},
new Component[]{new UILabel(" " + Inter.getLocText("Display_Value") + ":"), valueDictPane} new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + " ", UILabel.LEFT), keyColumnPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + " ", UILabel.LEFT), valueDictPane}
}; };
JPanel dbDictPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel dbDictPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
this.add(chooseTable, BorderLayout.NORTH); this.add(chooseTable, BorderLayout.NORTH);
this.add(dbDictPanel, BorderLayout.CENTER); this.add(dbDictPanel, BorderLayout.CENTER);
@ -114,7 +115,7 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
* *
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Datasource-From_Database"); return Inter.getLocText("FR-Designer_Datasource_From_Database");
} }
public void populateBean(DatabaseDictionary dbDict) { public void populateBean(DatabaseDictionary dbDict) {
@ -135,30 +136,30 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName())); this.chooseTable.populateBean(new DataBaseItems(dbName, dbDict.getSchema(), dbDict.getTableName()));
if(this.database == null){ if (this.database == null) {
return; return;
} }
// richer:这个也要+1才行 // richer:这个也要+1才行
if(StringUtils.isNotEmpty(dbDict.getKeyColumnName())){ if (StringUtils.isNotEmpty(dbDict.getKeyColumnName())) {
this.keyColumnPane.populate(dbDict.getKeyColumnName()); this.keyColumnPane.populate(dbDict.getKeyColumnName());
}else{ } else {
this.keyColumnPane.populate(dbDict.getKeyColumnIndex() + 1); this.keyColumnPane.populate(dbDict.getKeyColumnIndex() + 1);
} }
if(StringUtils.isNotEmpty(dbDict.getValueColumnName())){ if (StringUtils.isNotEmpty(dbDict.getValueColumnName())) {
this.valueDictPane.populate(dbDict.getValueColumnName()); this.valueDictPane.populate(dbDict.getValueColumnName());
}else{ } else {
Object value = null; Object value = null;
if (dbDict.getFormula() != null) { if (dbDict.getFormula() != null) {
value = dbDict.getFormula(); value = dbDict.getFormula();
} else { } else {
// alex:因为显示到界面上的index是以1为始的 // alex:因为显示到界面上的index是以1为始的
value = dbDict.getValueColumnIndex() + 1; value = dbDict.getValueColumnIndex() + 1;
} }
this.valueDictPane.populate(value); this.valueDictPane.populate(value);
} }
} }
public DatabaseDictionary updateBean() { public DatabaseDictionary updateBean() {
@ -177,27 +178,27 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
dbDict.setSchema(para.getSchemaName()); dbDict.setSchema(para.getSchemaName());
dbDict.setTableName(para.getTableName()); dbDict.setTableName(para.getTableName());
// alex:因为显示到界面上的index是以1为始的,所以要减1 // alex:因为显示到界面上的index是以1为始的,所以要减1
if (this.keyColumnPane.update() != null && (Integer) this.keyColumnPane.update() - 1 >= 0) { if (this.keyColumnPane.update() != null && (Integer) this.keyColumnPane.update() - 1 >= 0) {
int keyColumnIndex = (Integer) this.keyColumnPane.update() - 1; int keyColumnIndex = (Integer) this.keyColumnPane.update() - 1;
String keyColumnName = StringUtils.EMPTY; String keyColumnName = StringUtils.EMPTY;
if (this.keyColumnPane.getCurrentEditor() instanceof ColumnNameEditor) { if (this.keyColumnPane.getCurrentEditor() instanceof ColumnNameEditor) {
keyColumnName = ((ColumnNameEditor) this.keyColumnPane.getCurrentEditor()).getColumnName(); keyColumnName = ((ColumnNameEditor) this.keyColumnPane.getCurrentEditor()).getColumnName();
keyColumnIndex = -1; keyColumnIndex = -1;
} }
dbDict.setKeyColumnIndex(keyColumnIndex); dbDict.setKeyColumnIndex(keyColumnIndex);
dbDict.setKeyColumnName(keyColumnName); dbDict.setKeyColumnName(keyColumnName);
} }
Object value = this.valueDictPane.update(); Object value = this.valueDictPane.update();
if (value instanceof Integer) { if (value instanceof Integer) {
int valueColumnIndex = (Integer) this.valueDictPane.update() - 1; int valueColumnIndex = (Integer) this.valueDictPane.update() - 1;
String valueColumnName = StringUtils.EMPTY; String valueColumnName = StringUtils.EMPTY;
if (this.valueDictPane.getCurrentEditor() instanceof ColumnNameEditor) { if (this.valueDictPane.getCurrentEditor() instanceof ColumnNameEditor) {
valueColumnName = ((ColumnNameEditor) this.valueDictPane.getCurrentEditor()).getColumnName(); valueColumnName = ((ColumnNameEditor) this.valueDictPane.getCurrentEditor()).getColumnName();
valueColumnIndex = -1; valueColumnIndex = -1;
} }
dbDict.setValueColumnIndex(valueColumnIndex); dbDict.setValueColumnIndex(valueColumnIndex);
dbDict.setValueColumnName(valueColumnName); dbDict.setValueColumnName(valueColumnName);
} else { } else {
dbDict.setFormula(((Formula) value)); dbDict.setFormula(((Formula) value));
} }
@ -217,7 +218,7 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
String columnNameValue = columnNames.length > 0 ? columnNames[0] : StringUtils.EMPTY; String columnNameValue = columnNames.length > 0 ? columnNames[0] : StringUtils.EMPTY;
keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNameValue); keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNameValue);
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Engine_Parameter-Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
formulaEditor.addChangeListener(new ChangeListener() { formulaEditor.addChangeListener(new ChangeListener() {

86
designer_base/src/com/fr/design/present/dict/DictionaryPane.java

@ -1,42 +1,50 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
import com.fr.data.impl.DynamicSQLDict; import com.fr.data.impl.DynamicSQLDict;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/** /**
*
* @author zhou * @author zhou
* @since 2012-5-31下午12:20:41 * @since 2012-5-31下午12:20:41
*/ */
public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI { public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI {
private TableDataDictPane tableDataDictPane; private TableDataDictPane tableDataDictPane;
@Override @Override
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(0,4)); this.setLayout(new BorderLayout(0, 4));
JPanel northPane = new JPanel(new BorderLayout(4, 0)); // JPanel northPane = new JPanel(new BorderLayout(4, 0));
northPane.add(new UILabel(Inter.getLocText("Type_Set")+":", UILabel.RIGHT),BorderLayout.WEST); // northPane.add(new UILabel(Inter.getLocText("Type_Set"), UILabel.LEFT),BorderLayout.WEST);
northPane.add(jcb,BorderLayout.CENTER); // northPane.add(jcb,BorderLayout.CENTER);
this.add(northPane,BorderLayout.NORTH); double p = TableLayout.PREFERRED;
this.add(cardPane,BorderLayout.CENTER); double f = TableLayout.FILL;
} double[] columnSize = {p, f};
double[] rowSize = {p};
@Override Component[][] components = new Component[][]{
protected String title4PopupWindow() { new Component[]{new UILabel(Inter.getLocText("FR-Designer_Type_Set"), UILabel.LEFT), jcb},
return Inter.getLocText("DS-Dictionary"); };
} JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_DS-Dictionary");
}
@Override @Override
public JComponent toSwingComponent() { public JComponent toSwingComponent() {
@ -44,7 +52,7 @@ public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCr
} }
@Override @Override
public void populateBean(Dictionary ob) { public void populateBean(Dictionary ob) {
for (int i = 0; i < this.cards.size(); i++) { for (int i = 0; i < this.cards.size(); i++) {
FurtherBasicBeanPane pane = cards.get(i); FurtherBasicBeanPane pane = cards.get(i);
if (pane.accept(ob)) { if (pane.accept(ob)) {
@ -54,19 +62,19 @@ public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCr
pane.reset(); pane.reset();
} }
} }
if(ob instanceof DynamicSQLDict){ if (ob instanceof DynamicSQLDict) {
jcb.setSelectedIndex(1); jcb.setSelectedIndex(1);
tableDataDictPane.populateBean((DynamicSQLDict)ob); tableDataDictPane.populateBean((DynamicSQLDict) ob);
} }
} }
@Override @Override
protected List<FurtherBasicBeanPane<? extends Dictionary>> initPaneList() { protected List<FurtherBasicBeanPane<? extends Dictionary>> initPaneList() {
List<FurtherBasicBeanPane<? extends Dictionary>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Dictionary>>(); List<FurtherBasicBeanPane<? extends Dictionary>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Dictionary>>();
paneList.add( new DatabaseDictPane()); paneList.add(new DatabaseDictPane());
paneList.add(tableDataDictPane = new TableDataDictPane()); paneList.add(tableDataDictPane = new TableDataDictPane());
paneList.add( new CustomDictPane()); paneList.add(new CustomDictPane());
paneList.add( new FormulaDictPane()); paneList.add(new FormulaDictPane());
return paneList; return paneList;
} }
} }

194
designer_base/src/com/fr/design/present/dict/FormulaDictPane.java

@ -1,107 +1,123 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.*; import com.fr.base.BaseUtils;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.event.DocumentListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.FormulaDictionary;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.editor.editor.FormulaEditor;
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.design.editor.editor.FormulaEditor; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.DocumentListener;
import java.awt.*;
public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> { public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> {
private FormulaEditor keyFormulaEditor;
private FormulaEditor valueFormulaEditor;
public FormulaDictPane() { private static final int EDITOR_COLUMN = 15;
initComponents(); private FormulaEditor keyFormulaEditor;
} private FormulaEditor valueFormulaEditor;
public FormulaDictPane() {
initComponents();
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FormulaDictPane(), BorderLayout.NORTH);
GUICoreUtils.centerWindow(jf);
jf.setSize(250, 400);
jf.setVisible(true);
}
private void initComponents() {
keyFormulaEditor = new FormulaEditor();
keyFormulaEditor.setColumns(EDITOR_COLUMN);
JPanel keyFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT));
keyFormulaEditor.setPreferredSize(new Dimension(148, 20));
Icon icon = BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png");
keyFormulaContainer.add(new JLabel(icon));
keyFormulaContainer.add(keyFormulaEditor);
valueFormulaEditor = new FormulaEditor();
valueFormulaEditor.setColumns(EDITOR_COLUMN);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p};
UILabel tag = new UILabel(Inter.getLocText("Formula_Dictionary_Display_Examples_Html"));
JPanel t = new JPanel(new BorderLayout());
t.add(tag, BorderLayout.NORTH);
Formula vf = new Formula("$$$");
valueFormulaEditor = new FormulaEditor("", vf);
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT));
valueFormulaEditor.setPreferredSize(new Dimension(148, 20));
valueFormulaContainer.add(new JLabel(icon));
valueFormulaContainer.add(valueFormulaEditor);
private void initComponents() {
keyFormulaEditor = new FormulaEditor();
keyFormulaEditor.setColumns(15);
valueFormulaEditor = new FormulaEditor();
valueFormulaEditor.setColumns(15);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { f };
double[] rowSize = { p,p,p,p,p };
// ActionLabel tips = new ActionLabel("(对应实际值范围内的每个值)") {
// @Override
// public JToolTip createToolTip() {
// MultiLineToolTip tip = new MultiLineToolTip();
// tip.setComponent(this);
// tip.setOpaque(false);
// return tip;
// }
// };
// tips.setToolTipText(Inter.getLocText("Formula_Dictionary_Display_Examples"));
// JPanel cc = new JPanel(new BorderLayout());
// cc.add(tips, BorderLayout.WEST);
UILabel tag = new UILabel(Inter.getLocText("Formula_Dictionary_Display_Examples_Html"));
JPanel t = new JPanel(new BorderLayout());
t.add(tag, BorderLayout.WEST);
Formula vf = new Formula("$$$");
valueFormulaEditor = new FormulaEditor("",vf);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Actual_Value") + ":")}, new Component[]{null, null},
new Component[]{keyFormulaEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value"), UILabel.LEFT), keyFormulaContainer},
new Component[]{new UILabel(Inter.getLocText("Display_Value") + ":")}, new Component[]{null, null},
new Component[]{valueFormulaEditor}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value"), UILabel.LEFT), valueFormulaContainer},
new Component[]{t} new Component[]{null, null},
new Component[]{t, null}
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
public void addChangeListener(DocumentListener l) { public void addChangeListener(DocumentListener l) {
keyFormulaEditor.addDocumentListener(l); keyFormulaEditor.addDocumentListener(l);
valueFormulaEditor.addDocumentListener(l); valueFormulaEditor.addDocumentListener(l);
} }
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Formula"); return Inter.getLocText("FR-Designer_Formula");
} }
@Override @Override
public void populateBean(FormulaDictionary dict) { public void populateBean(FormulaDictionary dict) {
keyFormulaEditor.setValue(new Formula(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula())); keyFormulaEditor.setValue(new Formula(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula()));
valueFormulaEditor.setValue(new Formula(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula())); valueFormulaEditor.setValue(new Formula(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula()));
} }
@Override @Override
public FormulaDictionary updateBean() { public FormulaDictionary updateBean() {
FormulaDictionary dict = new FormulaDictionary(); FormulaDictionary dict = new FormulaDictionary();
if (keyFormulaEditor.getValue() != null) { if (keyFormulaEditor.getValue() != null) {
dict.setProduceFormula(keyFormulaEditor.getValue().getContent()); dict.setProduceFormula(keyFormulaEditor.getValue().getContent());
} }
if (valueFormulaEditor.getValue() != null) { if (valueFormulaEditor.getValue() != null) {
dict.setExcuteFormula(valueFormulaEditor.getValue().getContent()); dict.setExcuteFormula(valueFormulaEditor.getValue().getContent());
} }
return dict; return dict;
} }
@Override @Override
public boolean accept(Object ob) { public boolean accept(Object ob) {
return ob instanceof FormulaDictionary; return ob instanceof FormulaDictionary;
} }
@Override @Override
public void reset() { public void reset() {
keyFormulaEditor.reset(); keyFormulaEditor.reset();
valueFormulaEditor.reset(); valueFormulaEditor.reset();
} }
} }

97
designer_base/src/com/fr/design/present/dict/TableDataDictPane.java

@ -1,48 +1,46 @@
package com.fr.design.present.dict; package com.fr.design.present.dict;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.data.impl.DynamicSQLDict; import com.fr.data.impl.DynamicSQLDict;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TableDataDictionary;
import com.fr.design.DesignModelAdapter;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.DesignModelAdapter; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.editor.DoubleDeckValueEditorPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.ColumnIndexEditor; import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor; import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
/** /**
* 数据字典的数据查询面板 * 数据字典的数据查询面板
@ -56,8 +54,8 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
private static final long serialVersionUID = -5469742115988153206L; private static final long serialVersionUID = -5469742115988153206L;
private static final int SELECTED_NO_TABLEDATA = -2; private static final int SELECTED_NO_TABLEDATA = -2;
public TableDataComboBox tableDataNameComboBox; public TableDataComboBox tableDataNameComboBox;
private ValueEditorPane keyColumnPane; private DoubleDeckValueEditorPane keyColumnPane;
private ValueEditorPane valueDictPane; private DoubleDeckValueEditorPane valueDictPane;
private ItemListener itemListener; private ItemListener itemListener;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
@ -67,6 +65,17 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
iniListener(); iniListener();
} }
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new TableDataDictPane(), BorderLayout.NORTH);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
private void initBasicComponets() { private void initBasicComponets() {
tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableDataNameComboBox.addItemListener(new ItemListener() { tableDataNameComboBox.addItemListener(new ItemListener() {
@ -76,10 +85,12 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
} }
} }
}); });
keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); // keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula"));
formulaEditor.setEnabled(true); formulaEditor.setEnabled(true);
valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); // valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
} }
private void initComponents() { private void initComponents() {
@ -87,20 +98,20 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p, p, p};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}};
JPanel firstLine = new JPanel(new BorderLayout(4, 0)); JPanel firstLine = new JPanel(new BorderLayout(4, 0));
firstLine.add(tableDataNameComboBox, BorderLayout.CENTER); firstLine.add(tableDataNameComboBox, BorderLayout.CENTER);
firstLine.add(new PreviewLabel(this), BorderLayout.EAST); firstLine.add(new PreviewLabel(this), BorderLayout.EAST);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_DS_TableData") + ":", UILabel.RIGHT), firstLine}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS_TableData") + " ", UILabel.LEFT), firstLine},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + ":", UILabel.RIGHT), keyColumnPane}, new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + " ", UILabel.LEFT), keyColumnPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + ":", UILabel.RIGHT), valueDictPane} new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + " ", UILabel.LEFT), valueDictPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
} }
@ -133,10 +144,11 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
* 该面板标题 * 该面板标题
*
* @return 返回是窗口显示的标题 * @return 返回是窗口显示的标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("Dic-Data_Query"); return Inter.getLocText("FR-Designer_Dic_Data_Query");
} }
private void tdChange(final ItemEvent e) { private void tdChange(final ItemEvent e) {
@ -239,14 +251,14 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
TableDataSource dataSource = DesignTableDataManager.getEditingTableDataSource(); TableDataSource dataSource = DesignTableDataManager.getEditingTableDataSource();
if (dataSource != null) { if (dataSource != null) {
for (int i = BEGIN; i < END; i++) { for (int i = BEGIN; i < END; i++) {
TableData td = dataSource.getTableData(Inter.getLocText("Dictionary-Dynamic_SQL") + i); TableData td = dataSource.getTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i);
if (td == null) { if (td == null) {
name = Inter.getLocText("Dictionary-Dynamic_SQL") + i; name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i;
dataSource.putTableData(Inter.getLocText("Dictionary-Dynamic_SQL") + i, db); dataSource.putTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i, db);
break; break;
} else { } else {
if (ComparatorUtils.equals(td, db)) { if (ComparatorUtils.equals(td, db)) {
name = Inter.getLocText("Dictionary-Dynamic_SQL") + i; name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i;
break; break;
} else { } else {
continue; continue;
@ -319,6 +331,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
* 判断ob是否是TableDataDictionary类型 * 判断ob是否是TableDataDictionary类型
*
* @param ob 用于判断的Object * @param ob 用于判断的Object
* @return 如果是TableDataDictionary类型则返回true * @return 如果是TableDataDictionary类型则返回true
*/ */
@ -338,7 +351,8 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
*给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
@ -347,6 +361,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
/** /**
* 是否应该相应listener事件 * 是否应该相应listener事件
*
* @return 要是响应listener事件则返回true * @return 要是响应listener事件则返回true
*/ */
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {

Loading…
Cancel
Save