diff --git a/designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java b/designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java index 0036b2806..8143409cf 100644 --- a/designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java +++ b/designer/src/com/fr/design/actions/columnrow/DSColumnConditionAction.java @@ -1,36 +1,33 @@ package com.fr.design.actions.columnrow; import com.fr.base.BaseUtils; -import com.fr.design.data.DesignTableDataManager; import com.fr.design.actions.cell.AbstractCellElementAction; -import com.fr.design.dscolumn.DSColumnConditionsPane; +import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicPane; -import com.fr.general.Inter; +import com.fr.design.dscolumn.DSColumnConditionsPane; import com.fr.design.mainframe.ElementCasePane; +import com.fr.general.Inter; import com.fr.report.cell.TemplateCellElement; public class DSColumnConditionAction extends AbstractCellElementAction { - private boolean returnValue = false; - private TemplateCellElement editCellElement; - public DSColumnConditionAction(ElementCasePane t) { - super(t); - + super(t); + this.setName(Inter.getLocText("Filter")); this.setMnemonic('E'); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); } @Override - protected BasicPane populateBasicPane(TemplateCellElement cellElement) { + protected BasicPane populateBasicPane(TemplateCellElement cellElement) { DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); return dSColumnConditionsPane; } @Override - protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { + protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { ((DSColumnConditionsPane) bp).update(cellElement); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java b/designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java deleted file mode 100644 index 57af1a340..000000000 --- a/designer/src/com/fr/design/dscolumn/DSColumnAdvancedEditorPane.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.fr.design.dscolumn; - -import com.fr.design.mainframe.cell.CellEditorPane; -import com.fr.report.cell.TemplateCellElement; - - -/** - * 单元格元素 数据列 基本设置内容面板 - * - * @author yaoh.wu - * @version 2017年7月25日 - * @since 9.0 - */ -public class DSColumnAdvancedEditorPane extends CellEditorPane { - - - @Override - public String getIconPath() { - return "Advanced"; - } - - @Override - public String title4PopupWindow() { - return "Advanced"; - } - - - @Override - public void update() { - - } - - @Override - public void populate(TemplateCellElement cellElement) { - - } - -} diff --git a/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java b/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java deleted file mode 100644 index ef0c5e0b5..000000000 --- a/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.fr.design.dscolumn; - -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.cell.CellEditorPane; -import com.fr.report.cell.TemplateCellElement; - -import javax.swing.*; -import java.awt.*; - -/** - * 单元格元素 数据列 高级设置内容面板 - * - * @author yaoh.wu - * @version 2017年7月25日 - * @since 9.0 - */ -public class DSColumnBasicEditorPane extends CellEditorPane { - - //数据集和数据列 - private SelectedDataColumnPane dataPane; - //数据分组设置 - private ResultSetGroupDockingPane groupPane; - //当前编辑的单元格 - private TemplateCellElement cellElement; - //条件过滤按钮面板 - private JPanel conditionPane; - - public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) { - this.setLayout(new BorderLayout()); - this.cellElement = cellElement; - this.dataPane = dataPane; - this.groupPane = groupPane; - this.conditionPane = conditionPane; - this.add(this.createContentPane(), BorderLayout.CENTER); - } - - - @Override - public String getIconPath() { - return "Basic"; - } - - @Override - public String title4PopupWindow() { - return "Basic"; - } - - - @Override - public void update() { - dataPane.update(this.cellElement); - groupPane.update(); - } - - @Override - public void populate(TemplateCellElement cellElement) { - this.cellElement = cellElement; - dataPane.populate(null, cellElement); - groupPane.populate(cellElement); - } - - - /** - * 创建有内容的面板显示信息 - * - * @return content JPanel - */ - private JPanel createContentPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p, p, p}; - Component[][] components = new Component[][]{ - //数据集列选择 - new Component[]{this.dataPane}, - //数据分组设置 - new Component[]{this.groupPane}, - //条件过滤 - new Component[]{this.conditionPane} - }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - } -} diff --git a/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java b/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java index 9ba61e547..603356a88 100644 --- a/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java +++ b/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java @@ -1,25 +1,23 @@ package com.fr.design.dscolumn; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.BorderFactory; - import com.fr.data.TableDataSource; +import com.fr.design.dialog.BasicPane; import com.fr.design.expand.ConditionParentPane; import com.fr.design.expand.ExpandDirectionPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.dialog.BasicPane; -import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; -import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; public class DSColumnBasicPane extends BasicPane { @@ -30,54 +28,54 @@ public class DSColumnBasicPane extends BasicPane { private CellElement cellElement; public DSColumnBasicPane() { - this(DSColumnPane.SETTING_ALL); + this(DSColumnPane.SETTING_ALL); } - + public DSColumnBasicPane(int setting) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); if (setting > DSColumnPane.SETTING_DSRELATED) { - selectDataColumnPane = new SelectedDataColumnPane(); + selectDataColumnPane = new SelectedDataColumnPane(); } else { - selectDataColumnPane = new SelectedConfirmedDataColumnPane(); + selectDataColumnPane = new SelectedConfirmedDataColumnPane(); } - + selectDataColumnPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Select_DataColumn"), null)); if (setting > DSColumnPane.SETTING_DSRELATED) { - conditionParentPane = new ConditionParentPane(); - conditionParentPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ParentCell_Setting"), null)); + conditionParentPane = new ConditionParentPane(); + conditionParentPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ParentCell_Setting"), null)); } - + resultSetGroupPane = new ResultSetGroupPopUpPane(setting > DSColumnPane.SETTING_DSRELATED); resultSetGroupPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Data_Setting"), null)); if (setting > DSColumnPane.SETTING_DSRELATED) { - expandDirectionPane = new ExpandDirectionPane(); - expandDirectionPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ExpandD-Expand_Direction"), null)); + expandDirectionPane = new ExpandDirectionPane(); + expandDirectionPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("ExpandD-Expand_Direction"), null)); } - + double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, - TableLayout.PREFERRED, TableLayout.PREFERRED}; + TableLayout.PREFERRED, TableLayout.PREFERRED}; double[] columnSize = {TableLayout.FILL}; - + Component[][] components = null; - + if (setting > DSColumnPane.SETTING_DSRELATED) { - components = new Component[][]{ - {selectDataColumnPane}, - {conditionParentPane}, - {resultSetGroupPane}, - {expandDirectionPane} - }; + components = new Component[][]{ + {selectDataColumnPane}, + {conditionParentPane}, + {resultSetGroupPane}, + {expandDirectionPane} + }; } else { - components = new Component[][]{ - {selectDataColumnPane}, - {resultSetGroupPane}, - }; + components = new Component[][]{ + {selectDataColumnPane}, + {resultSetGroupPane}, + }; } - + this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); this.resultSetGroupPane.addListeners(summary_direction_ActionListener, otherGroup_direction_ActionListener, sdcUpdate_ActionListener); @@ -85,24 +83,24 @@ public class DSColumnBasicPane extends BasicPane { @Override protected String title4PopupWindow() { - return Inter.getLocText("Basic"); + return Inter.getLocText("Basic"); } - + public void populate(TableDataSource source, TemplateCellElement cellElement) { if (cellElement == null) { return; } this.cellElement = cellElement; - + selectDataColumnPane.populate(source, cellElement); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); if (conditionParentPane != null) { - conditionParentPane.populate(cellExpandAttr); + conditionParentPane.populate(cellExpandAttr); } if (expandDirectionPane != null) { - expandDirectionPane.populate(cellExpandAttr); + expandDirectionPane.populate(cellExpandAttr); } resultSetGroupPane.populate(cellElement); @@ -128,27 +126,28 @@ public class DSColumnBasicPane extends BasicPane { } if (conditionParentPane != null) { - conditionParentPane.update(cellExpandAttr); + conditionParentPane.update(cellExpandAttr); } if (expandDirectionPane != null) { - expandDirectionPane.update(cellExpandAttr); + expandDirectionPane.update(cellExpandAttr); } resultSetGroupPane.update(); } + ActionListener summary_direction_ActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { - if (expandDirectionPane != null) { - expandDirectionPane.setNoneRadioButtonSelected(true); - } + if (expandDirectionPane != null) { + expandDirectionPane.setNoneRadioButtonSelected(true); + } } }; ActionListener otherGroup_direction_ActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { - if (expandDirectionPane != null) { - expandDirectionPane.setNoneRadioButtonSelected(false); - } + if (expandDirectionPane != null) { + expandDirectionPane.setNoneRadioButtonSelected(false); + } } }; ActionListener sdcUpdate_ActionListener = new ActionListener() { @@ -157,14 +156,16 @@ public class DSColumnBasicPane extends BasicPane { selectDataColumnPane.update(cellElement); } }; - public void putElementcase(ElementCasePane t){ - if (conditionParentPane != null) { - conditionParentPane.putElementcase(t); - } - } - public void putCellElement(TemplateCellElement tplEC2) { - if (conditionParentPane != null) { - conditionParentPane.putCellElement(tplEC2); - } - } + + public void putElementcase(ElementCasePane t) { + if (conditionParentPane != null) { + conditionParentPane.putElementcase(t); + } + } + + public void putCellElement(TemplateCellElement tplCE) { + if (conditionParentPane != null) { + conditionParentPane.putCellElement(tplCE); + } + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/dscolumn/DSColumnPane.java b/designer/src/com/fr/design/dscolumn/DSColumnPane.java index 74bc68165..68b49b1af 100644 --- a/designer/src/com/fr/design/dscolumn/DSColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/DSColumnPane.java @@ -148,7 +148,7 @@ public class DSColumnPane extends BasicPane { basicPane.putElementcase(t); } - public void putCellElement(TemplateCellElement tplEC2) { - basicPane.putCellElement(tplEC2); + public void putCellElement(TemplateCellElement tplCE) { + basicPane.putCellElement(tplCE); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java b/designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java index b7cc3b5ae..ed4c24cba 100644 --- a/designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java +++ b/designer/src/com/fr/design/dscolumn/ResultSetGroupDockingPane.java @@ -1,35 +1,31 @@ package com.fr.design.dscolumn; -import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; - - import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.FunctionComboBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; -import com.fr.report.cell.cellattr.core.group.CustomGrouper; -import com.fr.report.cell.cellattr.core.group.DSColumn; -import com.fr.report.cell.cellattr.core.group.FunctionGrouper; -import com.fr.report.cell.cellattr.core.group.RecordGrouper; -import com.fr.report.cell.cellattr.core.group.SummaryGrouper; +import com.fr.report.cell.cellattr.core.group.*; import com.fr.stable.Constants; -import com.fr.design.utils.gui.GUICoreUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; /** * 这个pane是选中数据列后,在上方QuickRegion处显示的pane * - * @author zhou + * @author zhou, yaoh.wu + * @version 2017年8月2日14点55分 + * @since 8.0 */ public class ResultSetGroupDockingPane extends ResultSetGroupPane { private static final int BIND_GROUP = 0; @@ -42,7 +38,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { private CardLayout cardLayout; private UIComboBox goBox; - ItemListener l; + private ItemListener listener; public ResultSetGroupDockingPane(ElementCasePane ePane) { super(); @@ -58,15 +54,14 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { } private JPanel layoutPane() { - double vs = 4; - double vg = 6; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - + UILabel dataSetLabel = new UILabel(Inter.getLocText("Data_Setting")); + dataSetLabel.setPreferredSize(new Dimension(60, 20)); Component[][] components = new Component[][] { - new Component[]{new UILabel(Inter.getLocText("Data_Setting")), goBox}, - new Component[]{cardPane, null} + new Component[]{dataSetLabel, goBox}, + new Component[]{null, cardPane} }; goBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ee) { @@ -74,10 +69,13 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { int i = goBox.getSelectedIndex(); if (i == BIND_GROUP) { cardLayout.show(cardPane, "groupPane"); + cardPane.setPreferredSize(new Dimension(155, 20)); } else if (i == BIND_SELECTED) { cardLayout.show(cardPane, "listPane"); + cardPane.setPreferredSize(new Dimension(0, 0)); } else if (i == BIND_SUMMARY) { cardLayout.show(cardPane, "summaryPane"); + cardPane.setPreferredSize(new Dimension(155, 20)); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); cellExpandAttr.setDirection(Constants.NONE); } @@ -86,7 +84,7 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { double[] columnSize = {p, f}; double[] rowSize = {p, p}; - return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } private void initCardPane() { @@ -190,15 +188,15 @@ public class ResultSetGroupDockingPane extends ResultSetGroupPane { } } - public void addListener(ItemListener l) { - goBox.addItemListener(l); - groupComboBox.addItemListener(l); - functionComboBox.addItemListener(l); - this.l = l; + public void addListener(ItemListener listener) { + goBox.addItemListener(listener); + groupComboBox.addItemListener(listener); + functionComboBox.addItemListener(listener); + this.listener = listener; } void fireTargetChanged() { - l.itemStateChanged(null); + listener.itemStateChanged(null); } @Override diff --git a/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java index 282367d27..e71f539eb 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java @@ -1,45 +1,45 @@ package com.fr.design.dscolumn; -import java.awt.Dimension; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.Iterator; - import com.fr.data.TableDataSource; import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.main.impl.WorkBook; import com.fr.report.cell.TemplateCellElement; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Iterator; + public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { - public SelectedConfirmedDataColumnPane () { - super(false); - } - - protected void initTableNameComboBox() { - tableNameComboBox = new TableDataComboBox(new WorkBook()); - tableNameComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - columnNameComboBox.setLoaded(false); - } - }); - tableNameComboBox.setPreferredSize(new Dimension(100, 20)); - } - - public void populate(TableDataSource source, TemplateCellElement cell) { - tableNameComboBox.refresh(source); - tableNameComboBox.setEditable(false); - tableNameComboBox.setEnabled(false); - super.populate(source, cell); - try { - Iterator it = source.getTableDataNameIterator(); - String name = (String)it.next(); - TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); - tableNameComboBox.setSelectedItem(wrapper); - tableNameComboBox.getModel().setSelectedItem(wrapper); - } catch (Exception e) { - } - } + public SelectedConfirmedDataColumnPane() { + super(false); + } + + protected void initTableNameComboBox() { + tableNameComboBox = new TableDataComboBox(new WorkBook()); + tableNameComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + columnNameComboBox.setLoaded(false); + } + }); + tableNameComboBox.setPreferredSize(new Dimension(100, 20)); + } + + public void populate(TableDataSource source, TemplateCellElement cell) { + tableNameComboBox.refresh(source); + tableNameComboBox.setEditable(false); + tableNameComboBox.setEnabled(false); + super.populate(source, cell); + try { + Iterator it = source.getTableDataNameIterator(); + String name = (String) it.next(); + TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); + tableNameComboBox.setSelectedItem(wrapper); + tableNameComboBox.getModel().setSelectedItem(wrapper); + } catch (Exception e) { + } + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index dd583e1ef..682f9a930 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -17,6 +17,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.ElementCasePane; import com.fr.general.Inter; import com.fr.general.data.TableDataColumn; import com.fr.report.cell.CellElement; @@ -39,8 +40,8 @@ import java.util.regex.Pattern; * 数据集列动态参数设置组件 * * @author yaoh.wu - * @version 2017年7月26日 - * 9.0设计器更新,修改动态参数注入按钮部分,使其显示动态参数按钮时能在右侧边栏正常显示 + * @version 2017年8月3日 + * 复用对话框代码,保留对话框原始布局 * @since 8.0 */ public class SelectedDataColumnPane extends BasicPane { @@ -54,11 +55,20 @@ public class SelectedDataColumnPane extends BasicPane { private UIButton paramButton; public SelectedDataColumnPane() { - this(true); + this(true, false, null, null); } - SelectedDataColumnPane(boolean showParameterButton) { - initComponent(showParameterButton); + + public SelectedDataColumnPane(boolean showParameterButton) { + this(showParameterButton, false, null, null); + } + + public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane, TemplateCellElement cellElement) { + if (verticalLayout) { + initComponentVerticalLayout(casePane, cellElement); + } else { + initComponent(showParameterButton); + } } /** @@ -72,33 +82,32 @@ public class SelectedDataColumnPane extends BasicPane { initWithParameterButton(); } columnNameComboBox = new LazyComboBox() { + @Override public Object[] load() { List l = calculateColumnNameList(); return l.toArray(new String[l.size()]); } + }; columnNameComboBox.setEditable(true); - double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - UILabel label1 = new UILabel(Inter.getLocText("TableData")); - UILabel label3 = new UILabel(Inter.getLocText("DataColumn")); + UILabel dsLabel = new UILabel(Inter.getLocText("TableData") + ":"); + UILabel dcLabel = new UILabel(Inter.getLocText("DataColumn") + ":"); if (showParameterButton) { - //todo 国际化 - UILabel label2 = new UILabel("param"); - Component[][] components = { - {label1, tableNameComboBox}, - {label2, paramButton}, - {label3, columnNameComboBox} - }; - this.setLayout(new BorderLayout()); - this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f})); + dsLabel.setPreferredSize(new Dimension(200, 25)); + dcLabel.setPreferredSize(new Dimension(200, 25)); + } + if (showParameterButton) { + Component[][] comps = {{dsLabel, null, dcLabel}, {tableNameComboBox, paramButton, columnNameComboBox}}; + this.add(TableLayoutHelper.createTableLayoutPane(comps, new double[]{p, p}, new double[]{p, p, p})); } else { + double f = TableLayout.FILL; double[] columnSize = {p, f}; double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{label1, tableNameComboBox}, - new Component[]{label3, columnNameComboBox} + new Component[]{dsLabel, tableNameComboBox}, + new Component[]{dcLabel, columnNameComboBox} }; JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); @@ -107,6 +116,39 @@ public class SelectedDataColumnPane extends BasicPane { } + /** + * 初始化竖直布局的组件 + */ + public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) { + initTableNameComboBox(); + initWithParameterButton(casePane, cellElement); + columnNameComboBox = new LazyComboBox() { + @Override + public Object[] load() { + List l = calculateColumnNameList(); + return l.toArray(new String[l.size()]); + } + }; + columnNameComboBox.setEditable(true); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + UILabel dsLabel = new UILabel(Inter.getLocText("TableData")); + UILabel dpLabel = new UILabel(Inter.getLocText("FR-Designer_Dynamic_Parameter")); + UILabel dcLabel = new UILabel(Inter.getLocText("DataColumn")); + dsLabel.setPreferredSize(new Dimension(60, 20)); + dpLabel.setPreferredSize(new Dimension(60, 20)); + dcLabel.setPreferredSize(new Dimension(60, 20)); + Component[][] components = { + {dsLabel, tableNameComboBox}, + {dpLabel, paramButton}, + {dcLabel, columnNameComboBox} + }; + this.setLayout(new BorderLayout()); + this.add(TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f})); + + } + + public void populate(TableDataSource source, TemplateCellElement cellElement) { if (cellElement == null) { return; @@ -237,6 +279,27 @@ public class SelectedDataColumnPane extends BasicPane { }); } + private void initWithParameterButton(ElementCasePane casePane, TemplateCellElement cellElement) { + SelectedDataColumnPane that = this; + editorPane = new UITableEditorPane(new ParameterTableModel()); + paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting")); + paramButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + BasicDialog paramDialog = editorPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + List parameterList = editorPane.update(); + ps = parameterList.toArray(new Parameter[parameterList.size()]); + that.update(cellElement); + casePane.fireTargetModified(); + } + }); + editorPane.populate(ps == null ? new Parameter[0] : ps); + paramDialog.setVisible(true); + } + }); + } + private boolean isColumnName(String columnExp) { return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); diff --git a/designer/src/com/fr/design/mainframe/cell/CellEditorPane.java b/designer/src/com/fr/design/mainframe/cell/CellEditorPane.java index b0f09af43..48b6d8a17 100644 --- a/designer/src/com/fr/design/mainframe/cell/CellEditorPane.java +++ b/designer/src/com/fr/design/mainframe/cell/CellEditorPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.cell; import com.fr.design.dialog.BasicPane; -import com.fr.report.cell.TemplateCellElement; /** * 右侧单元格元素面板抽象类 @@ -24,7 +23,6 @@ public abstract class CellEditorPane extends BasicPane { /** * 更新面板数据 * - * @param cellElement 单元格 */ - public abstract void populate(TemplateCellElement cellElement); + public abstract void populate(); } diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index 12ada2f02..bf96db2af 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/designer/src/com/fr/design/module/DesignerModule.java @@ -111,7 +111,7 @@ public class DesignerModule extends DesignModule { private void registerCellEditor() { ActionFactory.registerCellEditor(String.class, CellStringQuickEditor.class); ActionFactory.registerCellEditor(Number.class, CellStringQuickEditor.class); - ActionFactory.registerCellEditor(Formula.class, CellStringQuickEditor.class); + ActionFactory.registerCellEditor(Formula.class, CellFormulaQuickEditor.class); ActionFactory.registerCellEditor(SubReport.class, CellSubReportEditor.class); ActionFactory.registerCellEditor(RichText.class, CellRichTextEditor.class); ActionFactory.registerCellEditor(DSColumn.class, CellDSColumnEditor.class); @@ -212,7 +212,7 @@ public class DesignerModule extends DesignModule { } }); } - + private static abstract class AbstractWorkBookApp implements App { @Override @@ -234,10 +234,10 @@ public class DesignerModule extends DesignModule { public void process() { } - + @Override public void undo() { - + } } @@ -385,7 +385,7 @@ public class DesignerModule extends DesignModule { } public Class[] actionsForInsertCellElement() { - return (Class[])ArrayUtils.addAll(new Class[]{ + return (Class[]) ArrayUtils.addAll(new Class[]{ DSColumnCellAction.class, GeneralCellAction.class, RichTextCellAction.class, diff --git a/designer/src/com/fr/design/present/BarCodePane.java b/designer/src/com/fr/design/present/BarCodePane.java index db894b203..583982bcb 100644 --- a/designer/src/com/fr/design/present/BarCodePane.java +++ b/designer/src/com/fr/design/present/BarCodePane.java @@ -1,376 +1,376 @@ -package com.fr.design.present; - -import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.border.UIRoundedBorder; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; -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.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.Inter; -import com.fr.report.cell.cellattr.BarcodeAttr; -import com.fr.report.cell.cellattr.BarcodePresent; -import com.fr.report.cell.painter.barcode.BarcodeImpl; -import com.fr.report.cell.painter.barcode.core.BarCodeUtils; -import com.fr.stable.pinyin.ChineseHelper; - -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 - * @since 2012-6-4下午6:49:59 - */ -public class BarCodePane extends FurtherBasicBeanPane { - private final int NUM16 = 16; - private BarCodePreviewPane barCodePreviewPane; - private UIComboBox typeComboBox; - private UIBasicSpinner barWidthSpinner; - private UIBasicSpinner barHeightSpinner; - private UIBasicSpinner RCodesizespinner; - private UICheckBox drawingTextCheckBox; - private UIComboBox RCodeVersionComboBox; - private UIComboBox RCodeErrorCorrectComboBox; - private UILabel typeSetLabel; - - private String testText = "12345"; - - public BarCodePane() { - this.initComponents(); - 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() { - barCodePreviewPane = new BarCodePreviewPane(); - this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(10.0, 1, 100, 1.0)); - this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1)); - this.barWidthSpinner.setPreferredSize(new Dimension(60, 20)); - this.barHeightSpinner.setPreferredSize(new Dimension(60, 20)); - 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); - borderPane.setBorder(titledBorder); - borderPane.add(barCodePreviewPane, BorderLayout.CENTER); - setTypeComboBox(); - setSome(); - RCodesizespinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 6, 1)); - RCodeVersionComboBox = new UIComboBox(); - RCodeErrorCorrectComboBox = new UIComboBox(); - typeSetLabel = new UILabel(Inter.getLocText("Type_Set") + ":", UILabel.RIGHT); - initVersionComboBox(); - initErrorCorrectComboBox(); - - drawingTextCheckBox = new UICheckBox(Inter.getLocText("BarCodeD-Drawing_Text")); - drawingTextCheckBox.setSelected(true); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p, p, p, p, p}; - barCodePreviewPane.setPreferredSize(new Dimension(0, 125)); - final JPanel centerPane = new JPanel(new CardLayout()); - - Component[][] components = new Component[][]{ - new Component[]{typeSetLabel, typeComboBox}, - new Component[]{borderPane, null}, - new Component[]{centerPane, null} - }; - JPanel barCode = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - centerPane.add(getNormalPane(), "normal"); - centerPane.add(getSpecialPane(), "special"); - typeComboBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - CardLayout cardLayout = (CardLayout) centerPane.getLayout(); - cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == NUM16 ? "special" : "normal"); - setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex())); - repaintPreviewBarCode(); - } - }); - this.setLayout(new BorderLayout()); - this.add(barCode, BorderLayout.CENTER); - } - - private void setTypeComboBox() { - typeComboBox = new UIComboBox(BarCodeUtils.getAllSupportedBarCodeTypeArray()); - typeComboBox.setRenderer(new UIComboBoxRenderer() { - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof Integer) { - this.setText(" " + BarCodeUtils.getBarCodeTypeName(((Integer) value).intValue())); - } - return this; - } - }); - } - - private void setSome() { - JFormattedTextField heightTextField = ((JSpinner.DefaultEditor) barHeightSpinner.getEditor()).getTextField(); - heightTextField.setColumns(2); - - JFormattedTextField widthTextField = ((JSpinner.DefaultEditor) barWidthSpinner.getEditor()).getTextField(); - widthTextField.setColumns(2); - } - - private JPanel getNormalPane() { - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - 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)); - barWidthContainer.add(barWidthSpinner); - JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); - barHeightContainer.add(barHeightSpinner); - UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); - uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - Component[][] components_normal = new Component[][]{ - new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer}, - new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)}, - new Component[]{drawingTextCheckBox, null, null} - }; - - - JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); - return normalPane; - } - - - private JPanel getSpecialPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize1 = {p, p}; - double[] rowSize = {p, p, p, p, p, p, p, p}; - UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion") + ":", UILabel.RIGHT); - uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - Component[][] components_special = new Component[][]{ - new Component[]{uiLabel, RCodeVersionComboBox}, - new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect") + ":", UILabel.RIGHT), RCodeErrorCorrectComboBox}, - new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix") + ":", UILabel.RIGHT), RCodesizespinner} - }; - - JPanel specialPane = TableLayoutHelper.createTableLayoutPane(components_special, rowSize, columnSize1); - return specialPane; - } - - private void addlistener() { - RCodesizespinner.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - repaintPreviewBarCode(); - } - }); - RCodeVersionComboBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - repaintPreviewBarCode(); - } - }); - RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - repaintPreviewBarCode(); - } - }); - this.barWidthSpinner.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - repaintPreviewBarCode(); - } - }); - this.barHeightSpinner.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - repaintPreviewBarCode(); - } - }); - drawingTextCheckBox.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - repaintPreviewBarCode(); - } - }); - repaintPreviewBarCode(); - } - - @Override - /** - * - */ - public String title4PopupWindow() { - return Inter.getLocText("Highlight-Barcode"); - } - - private void initVersionComboBox() { - String[] array = {Inter.getLocText(new String[]{"Auto", "Choose"}), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; - initcombobox(this.RCodeVersionComboBox, array, 0); - } - - private void initErrorCorrectComboBox() { - String[] array = {"L" + Inter.getLocText("Level") + "7%", "M" + Inter.getLocText("Level") + "15%", "Q" + Inter.getLocText("Level") + "25%", "H" + Inter.getLocText("Level") + "30%"}; - initcombobox(this.RCodeErrorCorrectComboBox, array, 1); - } - - private void initcombobox(UIComboBox combobox, String[] array, int index) { - combobox.removeAllItems(); - for (int i = 0; i < array.length; i++) { - combobox.addItem(array[i]); - } - combobox.setSelectedIndex(index); - } - - private void repaintPreviewBarCode() { - try { - // carl:不支持中文转条形码 - if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != NUM16) { - throw new Exception("Illegal Character."); - } - this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText())); - } catch (Exception exp) { - this.barCodePreviewPane.setObject(Inter.getLocText("Error") + ": " + exp.getMessage()); - } - } - - /** - * - */ - public void reset() { - populateBean(new BarcodePresent()); - } - - @Override - public void populateBean(BarcodePresent ob) { - BarcodeAttr barcodeAttr = ob.getBarcode(); - if (barcodeAttr == null) { - barcodeAttr = new BarcodeAttr(); - } - this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType())); - this.typeComboBox.setSelectedIndex(barcodeAttr.getType()); - this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth())); - this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); - this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); - this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); - this.repaintPreviewBarCode(); - } - - @Override - public BarcodePresent updateBean() { - BarcodeAttr barcodeAttr = new BarcodeAttr(); - if ((typeComboBox.getSelectedIndex() == NUM16)) { - barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); - barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); - barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue()); - } - barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); - barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); - barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue()); - barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); - return new BarcodePresent(barcodeAttr); - } - - public void setTestText(String testText) { - this.testText = testText; - } - - public String getTestText() { - return testText; - } - - private static class BarCodePreviewPane extends JPanel { - private Object obj; - - public BarCodePreviewPane() { -// setBackground(Color.WHITE); - } - - /** - * BarcodeImpl or Error String. - */ - public void setObject(Object obj) { - this.obj = obj; - GUICoreUtils.repaint(this); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - if (obj == null) { - return; - } - if (obj instanceof BarcodeImpl) { - BarcodeImpl barcodeImpl = (BarcodeImpl) obj; - Dimension size = this.getSize(); - barcodeImpl.draw((Graphics2D) g, (int) (size.getWidth() - barcodeImpl.getWidth()) / 2, (int) (size.getHeight() - barcodeImpl.getHeight()) / 2); - } else { - // 在中央画出字符. - Graphics2D graphics2D = (Graphics2D) g; - graphics2D.setPaint(Color.RED); - Map map = new HashMap(); - map.put(TextAttribute.SIZE, new Float(14.0)); - AttributedString vanGogh = new AttributedString(obj.toString(), map); - AttributedCharacterIterator paragraph = vanGogh.getIterator(); - int paragraphStart = paragraph.getBeginIndex(); - int paragraphEnd = paragraph.getEndIndex(); - // Create a new LineBreakMeasurer from the paragraph. - AffineTransform tx = null; - LineBreakMeasurer lineMeasurer = new LineBreakMeasurer(paragraph, new FontRenderContext(tx, false, false)); - // Set formatting width to width of Component. - Dimension size = getSize(); - float formatWidth = size.width; - float drawPosY = 0; - lineMeasurer.setPosition(paragraphStart); - // Get lines from lineMeasurer until the entire - // paragraph has been displayed. - while (lineMeasurer.getPosition() < paragraphEnd) { - // Retrieve next layout. - TextLayout layout = lineMeasurer.nextLayout(formatWidth); - // Move y-coordinate by the ascent of the layout. - drawPosY += layout.getAscent(); - // Compute pen x position. If the paragraph is - // right-to-left, we want to align the TextLayouts - // to the right edge of the panel. - float drawPosX; - if (layout.isLeftToRight()) { - drawPosX = 0; - } else { - drawPosX = formatWidth - layout.getAdvance(); - } - // Draw the TextLayout at (drawPosX, drawPosY). - layout.draw(graphics2D, drawPosX, drawPosY); - // Move y-coordinate in preparation for next layout. - drawPosY += layout.getDescent() + layout.getLeading(); - } - } - } - } - - @Override - /** - * - */ - public boolean accept(Object ob) { - return ob instanceof BarcodePresent; - } +package com.fr.design.present; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +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.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.report.cell.cellattr.BarcodeAttr; +import com.fr.report.cell.cellattr.BarcodePresent; +import com.fr.report.cell.painter.barcode.BarcodeImpl; +import com.fr.report.cell.painter.barcode.core.BarCodeUtils; +import com.fr.stable.pinyin.ChineseHelper; + +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 + * @since 2012-6-4下午6:49:59 + */ +public class BarCodePane extends FurtherBasicBeanPane { + private final int NUM16 = 16; + private BarCodePreviewPane barCodePreviewPane; + private UIComboBox typeComboBox; + private UIBasicSpinner barWidthSpinner; + private UIBasicSpinner barHeightSpinner; + private UIBasicSpinner RCodesizespinner; + private UICheckBox drawingTextCheckBox; + private UIComboBox RCodeVersionComboBox; + private UIComboBox RCodeErrorCorrectComboBox; + private UILabel typeSetLabel; + + private String testText = "12345"; + + public BarCodePane() { + this.initComponents(); + 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() { + barCodePreviewPane = new BarCodePreviewPane(); + this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(10.0, 1, 100, 1.0)); + this.barHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(30, 1, 100, 1)); + this.barWidthSpinner.setPreferredSize(new Dimension(60, 20)); + this.barHeightSpinner.setPreferredSize(new Dimension(60, 20)); + 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); + borderPane.setBorder(titledBorder); + borderPane.add(barCodePreviewPane, BorderLayout.CENTER); + setTypeComboBox(); + setSome(); + RCodesizespinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 6, 1)); + RCodeVersionComboBox = new UIComboBox(); + RCodeErrorCorrectComboBox = new UIComboBox(); + typeSetLabel = new UILabel(Inter.getLocText("Type_Set"), UILabel.RIGHT); + initVersionComboBox(); + initErrorCorrectComboBox(); + + drawingTextCheckBox = new UICheckBox(Inter.getLocText("BarCodeD-Drawing_Text")); + drawingTextCheckBox.setSelected(true); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p, p, p, p, p, p, p}; + barCodePreviewPane.setPreferredSize(new Dimension(0, 125)); + final JPanel centerPane = new JPanel(new CardLayout()); + + Component[][] components = new Component[][]{ + new Component[]{typeSetLabel, typeComboBox}, + new Component[]{borderPane, null}, + new Component[]{centerPane, null} + }; + JPanel barCode = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + centerPane.add(getNormalPane(), "normal"); + centerPane.add(getSpecialPane(), "special"); + typeComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + cardLayout.show(centerPane, typeComboBox.getSelectedIndex() == NUM16 ? "special" : "normal"); + setTestText(BarCodeUtils.getTestTextByBarCode(typeComboBox.getSelectedIndex())); + repaintPreviewBarCode(); + } + }); + this.setLayout(new BorderLayout()); + this.add(barCode, BorderLayout.CENTER); + } + + private void setTypeComboBox() { + typeComboBox = new UIComboBox(BarCodeUtils.getAllSupportedBarCodeTypeArray()); + typeComboBox.setRenderer(new UIComboBoxRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof Integer) { + this.setText(" " + BarCodeUtils.getBarCodeTypeName(((Integer) value).intValue())); + } + return this; + } + }); + } + + private void setSome() { + JFormattedTextField heightTextField = ((JSpinner.DefaultEditor) barHeightSpinner.getEditor()).getTextField(); + heightTextField.setColumns(2); + + JFormattedTextField widthTextField = ((JSpinner.DefaultEditor) barWidthSpinner.getEditor()).getTextField(); + widthTextField.setColumns(2); + } + + private JPanel getNormalPane() { + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + 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)); + barWidthContainer.add(barWidthSpinner); + JPanel barHeightContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); + barHeightContainer.add(barHeightSpinner); + UILabel uiLabel = new UILabel(Inter.getLocText("Tree-Width") + ":", UILabel.RIGHT); + uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); + Component[][] components_normal = new Component[][]{ + new Component[]{new UILabel("条形码大小", UILabel.LEFT), barWidthContainer, barHeightContainer}, + new Component[]{null, new UILabel(Inter.getLocText("Tree-Width"), UILabel.CENTER), new UILabel(Inter.getLocText("Height"), UILabel.CENTER)}, + new Component[]{drawingTextCheckBox, null, null} + }; + + + JPanel normalPane = TableLayoutHelper.createTableLayoutPane(components_normal, rowSize, columnSize1); + return normalPane; + } + + + private JPanel getSpecialPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize1 = {p, p}; + double[] rowSize = {p, p, p, p, p, p, p, p}; + UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion") + ":", UILabel.RIGHT); + uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); + Component[][] components_special = new Component[][]{ + new Component[]{uiLabel, RCodeVersionComboBox}, + new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect") + ":", UILabel.RIGHT), RCodeErrorCorrectComboBox}, + new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix") + ":", UILabel.RIGHT), RCodesizespinner} + }; + + JPanel specialPane = TableLayoutHelper.createTableLayoutPane(components_special, rowSize, columnSize1); + return specialPane; + } + + private void addlistener() { + RCodesizespinner.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + repaintPreviewBarCode(); + } + }); + RCodeVersionComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + repaintPreviewBarCode(); + } + }); + RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + repaintPreviewBarCode(); + } + }); + this.barWidthSpinner.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + repaintPreviewBarCode(); + } + }); + this.barHeightSpinner.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + repaintPreviewBarCode(); + } + }); + drawingTextCheckBox.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + repaintPreviewBarCode(); + } + }); + repaintPreviewBarCode(); + } + + @Override + /** + * + */ + public String title4PopupWindow() { + return Inter.getLocText("Highlight-Barcode"); + } + + private void initVersionComboBox() { + String[] array = {Inter.getLocText(new String[]{"Auto", "Choose"}), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; + initcombobox(this.RCodeVersionComboBox, array, 0); + } + + private void initErrorCorrectComboBox() { + String[] array = {"L" + Inter.getLocText("Level") + "7%", "M" + Inter.getLocText("Level") + "15%", "Q" + Inter.getLocText("Level") + "25%", "H" + Inter.getLocText("Level") + "30%"}; + initcombobox(this.RCodeErrorCorrectComboBox, array, 1); + } + + private void initcombobox(UIComboBox combobox, String[] array, int index) { + combobox.removeAllItems(); + for (int i = 0; i < array.length; i++) { + combobox.addItem(array[i]); + } + combobox.setSelectedIndex(index); + } + + private void repaintPreviewBarCode() { + try { + // carl:不支持中文转条形码 + if (ChineseHelper.containChinese(getTestText()) && this.typeComboBox.getSelectedIndex() != NUM16) { + throw new Exception("Illegal Character."); + } + this.barCodePreviewPane.setObject(BarCodeUtils.getBarcodeImpl(this.updateBean().getBarcode(), getTestText())); + } catch (Exception exp) { + this.barCodePreviewPane.setObject(Inter.getLocText("Error") + ": " + exp.getMessage()); + } + } + + /** + * + */ + public void reset() { + populateBean(new BarcodePresent()); + } + + @Override + public void populateBean(BarcodePresent ob) { + BarcodeAttr barcodeAttr = ob.getBarcode(); + if (barcodeAttr == null) { + barcodeAttr = new BarcodeAttr(); + } + this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType())); + this.typeComboBox.setSelectedIndex(barcodeAttr.getType()); + this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth())); + this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); + this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); + this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); + this.repaintPreviewBarCode(); + } + + @Override + public BarcodePresent updateBean() { + BarcodeAttr barcodeAttr = new BarcodeAttr(); + if ((typeComboBox.getSelectedIndex() == NUM16)) { + barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); + barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); + barcodeAttr.setRcodeDrawPix(((Integer) this.RCodesizespinner.getValue()).intValue()); + } + barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); + barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); + barcodeAttr.setBarHeight(((Integer) this.barHeightSpinner.getValue()).intValue()); + barcodeAttr.setDrawingText(this.drawingTextCheckBox.isSelected()); + return new BarcodePresent(barcodeAttr); + } + + public void setTestText(String testText) { + this.testText = testText; + } + + public String getTestText() { + return testText; + } + + private static class BarCodePreviewPane extends JPanel { + private Object obj; + + public BarCodePreviewPane() { +// setBackground(Color.WHITE); + } + + /** + * BarcodeImpl or Error String. + */ + public void setObject(Object obj) { + this.obj = obj; + GUICoreUtils.repaint(this); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + if (obj == null) { + return; + } + if (obj instanceof BarcodeImpl) { + BarcodeImpl barcodeImpl = (BarcodeImpl) obj; + Dimension size = this.getSize(); + barcodeImpl.draw((Graphics2D) g, (int) (size.getWidth() - barcodeImpl.getWidth()) / 2, (int) (size.getHeight() - barcodeImpl.getHeight()) / 2); + } else { + // 在中央画出字符. + Graphics2D graphics2D = (Graphics2D) g; + graphics2D.setPaint(Color.RED); + Map map = new HashMap(); + map.put(TextAttribute.SIZE, new Float(14.0)); + AttributedString vanGogh = new AttributedString(obj.toString(), map); + AttributedCharacterIterator paragraph = vanGogh.getIterator(); + int paragraphStart = paragraph.getBeginIndex(); + int paragraphEnd = paragraph.getEndIndex(); + // Create a new LineBreakMeasurer from the paragraph. + AffineTransform tx = null; + LineBreakMeasurer lineMeasurer = new LineBreakMeasurer(paragraph, new FontRenderContext(tx, false, false)); + // Set formatting width to width of Component. + Dimension size = getSize(); + float formatWidth = size.width; + float drawPosY = 0; + lineMeasurer.setPosition(paragraphStart); + // Get lines from lineMeasurer until the entire + // paragraph has been displayed. + while (lineMeasurer.getPosition() < paragraphEnd) { + // Retrieve next layout. + TextLayout layout = lineMeasurer.nextLayout(formatWidth); + // Move y-coordinate by the ascent of the layout. + drawPosY += layout.getAscent(); + // Compute pen x position. If the paragraph is + // right-to-left, we want to align the TextLayouts + // to the right edge of the panel. + float drawPosX; + if (layout.isLeftToRight()) { + drawPosX = 0; + } else { + drawPosX = formatWidth - layout.getAdvance(); + } + // Draw the TextLayout at (drawPosX, drawPosY). + layout.draw(graphics2D, drawPosX, drawPosY); + // Move y-coordinate in preparation for next layout. + drawPosY += layout.getDescent() + layout.getLeading(); + } + } + } + } + + @Override + /** + * + */ + public boolean accept(Object ob) { + return ob instanceof BarcodePresent; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/present/CurrencyLinePane.java b/designer/src/com/fr/design/present/CurrencyLinePane.java index b6e0ff853..7922f2186 100644 --- a/designer/src/com/fr/design/present/CurrencyLinePane.java +++ b/designer/src/com/fr/design/present/CurrencyLinePane.java @@ -1,231 +1,231 @@ -package com.fr.design.present; - -import com.fr.design.beans.FurtherBasicBeanPane; -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.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.Inter; -import com.fr.report.cell.cellattr.CurrencyLineAttr; -import com.fr.report.cell.cellattr.CurrencyLinePresent; -import com.fr.report.cell.painter.barcode.BarcodeException; -import com.fr.report.core.CurrencyLineImpl; - -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 - * @since 2012-6-4下午7:34:52 - */ -public class CurrencyLinePane extends FurtherBasicBeanPane { - private static final int VS_NUM = 4; - private static final int VG_NUM = 6; - private UIBasicSpinner intPartSpinner; - private UIBasicSpinner deciPartSpinner; - private UITextField textField; - private CurrencyLinePreviewPane CurrencyLinePreviewPane; - private int intPart = 9; - private int deciPart = 3; - - private static final int POSITION = 8; - ChangeListener listener2 = new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); - } - - }; - - DocumentListener listener = new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); - } - - @Override - public void removeUpdate(DocumentEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); - } - - @Override - public void changedUpdate(DocumentEvent e) { - CurrencyLinePreviewPane.setObject(textField.getText(), update()); - } - }; - - public CurrencyLinePane() { - this.initComponents(); - } - - protected void initComponents() { - // 整数位选择 - intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); - intPartSpinner.setPreferredSize(new Dimension(135, 20)); - - // 小数位选择 - deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); - deciPartSpinner.setPreferredSize(new Dimension(135, 20)); - // 预览区域 - textField = new UITextField(10); - - CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); - CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); - 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); - borderPane.setBorder(titledBorder); - borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); - - textField.requestFocus(); - - double vs = VS_NUM; - double vg = VG_NUM; - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p, p, p}; - - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("Data"), UILabel.LEFT), textField}, - new Component[]{borderPane, null}, - new Component[]{new UILabel(Inter.getLocText("IntPart"), UILabel.LEFT), groupPane(intPartSpinner)}, - new Component[]{new UILabel(Inter.getLocText("DeciPart"), UILabel.LEFT), groupPane(deciPartSpinner)} - - }; - - JPanel linePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.setLayout(new BorderLayout()); - this.add(linePane, BorderLayout.CENTER); - - - textField.getDocument().addDocumentListener(listener); - intPartSpinner.addChangeListener(listener2); - deciPartSpinner.addChangeListener(listener2); - textField.setText("123456.78"); - } - - @Override - /** - * 窗口名 - * @return 同上 - */ - public String title4PopupWindow() { - return Inter.getLocText("Currency_Line"); - } - - /** - * - */ - public CurrencyLineAttr update() { - CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); - currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); - currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); - return currencylineAttr; - } - - /** - * - */ - public void setintPart(int intpart) { - this.intPart = intpart; - } - - /** - * - */ - public void setdeciPart(int decipart) { - this.deciPart = decipart; - } - - private class CurrencyLinePreviewPane extends JPanel { - private String text; - CurrencyLineAttr currencyLineAttr; - - public CurrencyLinePreviewPane() { -// setBackground(Color.WHITE); - } - - public void setObject(String text, CurrencyLineAttr currencyLineAttr) { - this.text = text; - this.currencyLineAttr = currencyLineAttr; - GUICoreUtils.repaint(this); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - if (text == null) { - 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); - } - } - - } - - 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 对象 - * @return 同上 - * - */ - public boolean accept(Object ob) { - return ob instanceof CurrencyLinePresent; - } - - /** - * 重置 - */ - public void reset() { - this.intPartSpinner.setValue(9); - this.deciPartSpinner.setValue(3); - } - - @Override - public void populateBean(CurrencyLinePresent ob) { - CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr(); - if (currencyLine == null) { - currencyLine = new CurrencyLineAttr(); - } - this.intPartSpinner.setValue(new Integer(currencyLine.getintPart())); - this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart())); - } - - @Override - public CurrencyLinePresent updateBean() { - CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); - currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); - currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); - return new CurrencyLinePresent(currencylineAttr); - } - +package com.fr.design.present; + +import com.fr.design.beans.FurtherBasicBeanPane; +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.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.Inter; +import com.fr.report.cell.cellattr.CurrencyLineAttr; +import com.fr.report.cell.cellattr.CurrencyLinePresent; +import com.fr.report.cell.painter.barcode.BarcodeException; +import com.fr.report.core.CurrencyLineImpl; + +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 + * @since 2012-6-4下午7:34:52 + */ +public class CurrencyLinePane extends FurtherBasicBeanPane { + private static final int VS_NUM = 4; + private static final int VG_NUM = 6; + private UIBasicSpinner intPartSpinner; + private UIBasicSpinner deciPartSpinner; + private UITextField textField; + private CurrencyLinePreviewPane CurrencyLinePreviewPane; + private int intPart = 9; + private int deciPart = 3; + + private static final int POSITION = 8; + ChangeListener listener2 = new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + CurrencyLinePreviewPane.setObject(textField.getText(), update()); + } + + }; + + DocumentListener listener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + CurrencyLinePreviewPane.setObject(textField.getText(), update()); + } + + @Override + public void removeUpdate(DocumentEvent e) { + CurrencyLinePreviewPane.setObject(textField.getText(), update()); + } + + @Override + public void changedUpdate(DocumentEvent e) { + CurrencyLinePreviewPane.setObject(textField.getText(), update()); + } + }; + + public CurrencyLinePane() { + this.initComponents(); + } + + protected void initComponents() { + // 整数位选择 + intPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(9, 1, 20, 1)); + intPartSpinner.setPreferredSize(new Dimension(158, 20)); + + // 小数位选择 + deciPartSpinner = new UIBasicSpinner(new SpinnerNumberModel(2, 1, 10, 1)); + deciPartSpinner.setPreferredSize(new Dimension(158, 20)); + // 预览区域 + textField = new UITextField(10); + + CurrencyLinePreviewPane = new CurrencyLinePreviewPane(); + CurrencyLinePreviewPane.setPreferredSize(new Dimension(0, 145)); + 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); + borderPane.setBorder(titledBorder); + borderPane.add(CurrencyLinePreviewPane, BorderLayout.CENTER); + + textField.requestFocus(); + + double vs = VS_NUM; + double vg = VG_NUM; + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p, p, p}; + + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Data"), UILabel.LEFT), textField}, + new Component[]{borderPane, null}, + new Component[]{new UILabel(Inter.getLocText("IntPart"), UILabel.LEFT), groupPane(intPartSpinner)}, + new Component[]{new UILabel(Inter.getLocText("DeciPart"), UILabel.LEFT), groupPane(deciPartSpinner)} + + }; + + JPanel linePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(linePane, BorderLayout.CENTER); + + + textField.getDocument().addDocumentListener(listener); + intPartSpinner.addChangeListener(listener2); + deciPartSpinner.addChangeListener(listener2); + textField.setText("123456.78"); + } + + @Override + /** + * 窗口名 + * @return 同上 + */ + public String title4PopupWindow() { + return Inter.getLocText("Currency_Line"); + } + + /** + * + */ + public CurrencyLineAttr update() { + CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); + currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); + currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); + return currencylineAttr; + } + + /** + * + */ + public void setintPart(int intpart) { + this.intPart = intpart; + } + + /** + * + */ + public void setdeciPart(int decipart) { + this.deciPart = decipart; + } + + private class CurrencyLinePreviewPane extends JPanel { + private String text; + CurrencyLineAttr currencyLineAttr; + + public CurrencyLinePreviewPane() { +// setBackground(Color.WHITE); + } + + public void setObject(String text, CurrencyLineAttr currencyLineAttr) { + this.text = text; + this.currencyLineAttr = currencyLineAttr; + GUICoreUtils.repaint(this); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + if (text == null) { + 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); + } + } + + } + + 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 对象 + * @return 同上 + * + */ + public boolean accept(Object ob) { + return ob instanceof CurrencyLinePresent; + } + + /** + * 重置 + */ + public void reset() { + this.intPartSpinner.setValue(9); + this.deciPartSpinner.setValue(3); + } + + @Override + public void populateBean(CurrencyLinePresent ob) { + CurrencyLineAttr currencyLine = ob.getCurrencyLineAttr(); + if (currencyLine == null) { + currencyLine = new CurrencyLineAttr(); + } + this.intPartSpinner.setValue(new Integer(currencyLine.getintPart())); + this.deciPartSpinner.setValue(new Integer(currencyLine.getdeciPart())); + } + + @Override + public CurrencyLinePresent updateBean() { + CurrencyLineAttr currencylineAttr = new CurrencyLineAttr(); + currencylineAttr.setintPart(((Integer) this.intPartSpinner.getValue()).intValue()); + currencylineAttr.setdeciPart(((Integer) this.deciPartSpinner.getValue()).intValue()); + return new CurrencyLinePresent(currencylineAttr); + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/DataModify.java b/designer/src/com/fr/design/widget/DataModify.java deleted file mode 100644 index e2fd92b98..000000000 --- a/designer/src/com/fr/design/widget/DataModify.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.fr.design.widget; - -import com.fr.design.data.DataCreatorUI; -import com.fr.design.gui.frpane.TreeSettingPane; -import com.fr.design.present.dict.DictionaryPane; -import com.fr.form.ui.Widget; - -import javax.swing.*; - -public interface DataModify { - - void populateBean(T ob); - - T updateBean(); - - void checkValid() throws Exception; - - DataCreatorUI dataUI(); - - JComponent toSwingComponent(); -} \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/Operator.java b/designer/src/com/fr/design/widget/Operator.java deleted file mode 100644 index f8aad788e..000000000 --- a/designer/src/com/fr/design/widget/Operator.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fr.design.widget; - -import com.fr.design.data.DataCreatorUI; - -/** - * Created by richie on 15/11/16. - */ -public interface Operator { - - void did(DataCreatorUI ui, String cardName); -} \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java b/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java index 3d2b53d45..b02ef38f4 100644 --- a/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java +++ b/designer/src/com/fr/design/widget/ui/ButtonGroupDictPane.java @@ -1,59 +1,63 @@ -package com.fr.design.widget.ui; - - -import java.awt.event.ActionEvent; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import java.awt.event.ActionListener; - -import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; -import javax.swing.SpinnerNumberModel; - -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.form.ui.ButtonGroup; -import com.fr.general.Inter; - - -public class ButtonGroupDictPane extends JPanel { - private UIBasicSpinner columnSpinner; - private UICheckBox adaptiveCheckbox; - private UILabel columnLabel; - - public ButtonGroupDictPane() { - this.initComponents(); - } - - /** - * - */ - public void initComponents() { - this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); - adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); - adaptiveCheckbox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); - columnLabel.setVisible(!adaptiveCheckbox.isSelected()); - } - }); - this.add(adaptiveCheckbox); - - this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns") + ":"); - this.add(columnLabel); - columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); - this.add(columnSpinner); - } - - public void populate(ButtonGroup buttonGroup) { - adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); - columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); - columnLabel.setVisible(!adaptiveCheckbox.isSelected()); - columnSpinner.setValue(buttonGroup.getColumnsInRow()); - } - - public void update(ButtonGroup buttonGroup) { - buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); - buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); - } - +package com.fr.design.widget.ui; + + +import java.awt.*; +import java.awt.event.ActionEvent; +import com.fr.design.gui.ispinner.UIBasicSpinner; +import java.awt.event.ActionListener; + +import com.fr.design.gui.ilable.UILabel; +import javax.swing.JPanel; +import javax.swing.SpinnerNumberModel; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.ButtonGroup; +import com.fr.general.Inter; + + +public class ButtonGroupDictPane extends JPanel { + private UIBasicSpinner columnSpinner; + private UICheckBox adaptiveCheckbox; + private UILabel columnLabel; + + public ButtonGroupDictPane() { + this.initComponents(); + } + + /** + * + */ + public void initComponents() { + this.setLayout(new FlowLayout(0)); + JPanel pane = new JPanel(new FlowLayout()); + adaptiveCheckbox = new UICheckBox(Inter.getLocText("Adaptive"), true); + adaptiveCheckbox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); + columnLabel.setVisible(!adaptiveCheckbox.isSelected()); + } + }); + + this.columnLabel = new UILabel(Inter.getLocText("Button-Group-Display-Columns")); + columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); + pane.add(adaptiveCheckbox); + pane.add(columnLabel); + pane.add(columnSpinner); + + this.add(pane); + } + + public void populate(ButtonGroup buttonGroup) { + adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); + columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); + columnLabel.setVisible(!adaptiveCheckbox.isSelected()); + columnSpinner.setValue(buttonGroup.getColumnsInRow()); + } + + public void update(ButtonGroup buttonGroup) { + buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); + buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java b/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java index abcc5f986..98a1539ad 100644 --- a/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/CheckBoxDefinePane.java @@ -1,48 +1,62 @@ package com.fr.design.widget.ui; +import com.fr.design.constants.LayoutConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; - -import javax.swing.*; - import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.CheckBox; import com.fr.general.Inter; +import javax.swing.*; +import java.awt.*; + public class CheckBoxDefinePane extends AbstractDataModify { - private UITextField text; - - public CheckBoxDefinePane() { - this.iniComoponents(); - } - - private void iniComoponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); - JPanel textPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - textPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, textPane); - textPane.add(new UILabel(Inter.getLocText("Text") + ":")); - text = new UITextField(8); - textPane.add(text); - this.add(uiExpandablePane); - } - - @Override - protected String title4PopupWindow() { - return "CheckBox"; - } - - @Override - public void populateBean(CheckBox check) { - text.setText(check.getText()); - } - - @Override - public CheckBox updateBean() { - CheckBox box = new CheckBox(); - box.setText(text.getText()); - return box; - } + private UITextField text; + + public CheckBoxDefinePane() { + this.iniComoponents(); + } + + private void iniComoponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + text = new UITextField(8); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(text, BorderLayout.CENTER); + panel.setBorder(BorderFactory.createEmptyBorder(0, 35, 0, 0)); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Text")), panel}, + }; + double[] rowSize = {p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}}; + JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); + + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, pane); + pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15)); + + this.add(uiExpandablePane); + } + + @Override + protected String title4PopupWindow() { + return "CheckBox"; + } + + @Override + public void populateBean(CheckBox check) { + text.setText(check.getText()); + } + + @Override + public CheckBox updateBean() { + CheckBox box = new CheckBox(); + box.setText(text.getText()); + return box; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java index 18ef5d899..43405fa91 100644 --- a/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/DirectWriteEditorDefinePane.java @@ -22,7 +22,7 @@ public abstract class DirectWriteEditorDefinePane e @Override protected JPanel setFirstContentPane() { JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); directWriteCheckBox = new UICheckBox(Inter.getLocText("Form-Allow_Edit"), false); directWriteCheckBox.setPreferredSize(new Dimension(100, 30)); diff --git a/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java index cf7797e81..359c8c636 100644 --- a/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/IframeEditorDefinePane.java @@ -1,17 +1,13 @@ package com.fr.design.widget.ui; -import java.awt.*; -import java.util.List; - -import javax.swing.BorderFactory; - import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.DialogActionListener; +import com.fr.design.dialog.UIDialog; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; - import com.fr.design.gui.frpane.ReportletParameterViewPane; +import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -20,68 +16,114 @@ import com.fr.form.ui.IframeEditor; import com.fr.general.Inter; import com.fr.stable.ParameterProvider; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + public class IframeEditorDefinePane extends AbstractDataModify { - private UITextField srcTextField; - private ReportletParameterViewPane parameterViewPane; - private UICheckBox horizontalCheck; - private UICheckBox verticalCheck; - - public IframeEditorDefinePane() { - this.initComponents(); - } - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); - JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); - attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); - contentPane.add(attr); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] rowSize = { p, p, p, p }; - double[] columnSize = { p, f }; - - java.awt.Component[][] coms = { - { horizontalCheck, null }, - { verticalCheck, null }, - { new UILabel(Inter.getLocText("Form-Url") + ":"), srcTextField = new UITextField() }, - { new UILabel(Inter.getLocText("Parameter") + ":"), parameterViewPane = new ReportletParameterViewPane() } }; - int[][] rowCount = {{1, 1},{1, 1},{1, 1}, {1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); - - - contentPane.add(panel); - - UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 20, contentPane); - this.add(uiExpandablePane, BorderLayout.NORTH); - - } - - - @Override - protected String title4PopupWindow() { - return "iframe"; - } - - @Override - public void populateBean(IframeEditor e) { - srcTextField.setText(e.getSrc()); - parameterViewPane.populate(e.getParameters()); - this.horizontalCheck.setSelected(e.isOverflowx()); - this.verticalCheck.setSelected(e.isOverflowy()); - } - - @Override - public IframeEditor updateBean() { - IframeEditor ob = new IframeEditor(); - ob.setSrc(srcTextField.getText()); - List parameterList = parameterViewPane.update(); - ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); - ob.setOverflowx(this.horizontalCheck.isSelected()); - ob.setOverflowy(this.verticalCheck.isSelected()); - return ob; - } + + private static final int P_W = 610; + private static final int P_H = 580; + private UITextField srcTextField; + private ReportletParameterViewPane parameterViewPane; + private UICheckBox horizontalCheck; + private UICheckBox verticalCheck; + private UIButton parameterViewPaneButton; + private List list; + + + public IframeEditorDefinePane() { + this.initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + contentPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0)); + JPanel attr = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); + attr.add(horizontalCheck = new UICheckBox(Inter.getLocText("Preference-Horizontal_Scroll_Bar_Visible"))); + attr.add(verticalCheck = new UICheckBox(Inter.getLocText("Preference-Vertical_Scroll_Bar_Visible"))); + contentPane.add(attr); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p, f}; + + parameterViewPaneButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); + parameterViewPaneButton.addActionListener(parameterListener); + parameterViewPane = new ReportletParameterViewPane(); + + java.awt.Component[][] coms = { + {horizontalCheck, null}, + {verticalCheck, null}, + {new UILabel(Inter.getLocText("Form-Url")), srcTextField = new UITextField()}, + {new UILabel(Inter.getLocText("FR-Designer_Parameters")), parameterViewPaneButton}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(coms, rowSize, columnSize, rowCount, 45, LayoutConstants.VGAP_LARGE); + + + contentPane.add(panel); + + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"), 280, 24, contentPane); + this.add(uiExpandablePane, BorderLayout.NORTH); + + } + + ActionListener parameterListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + List paraList = parameterViewPane.update(); + list = new ArrayList(); + ParameterProvider pr = null; + for (ParameterProvider parameterProvider : paraList) { + try { + pr = (ParameterProvider) parameterProvider.clone(); + } catch (CloneNotSupportedException e1) { + e1.printStackTrace(); + } + list.add(pr); + } + + UIDialog dialog = parameterViewPane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { + @Override + public void doOk() { + } + + @Override + public void doCancel() { + parameterViewPane.update(list); + } + }); + dialog.setSize(P_W, P_H); + dialog.setVisible(true); + } + }; + + @Override + protected String title4PopupWindow() { + return "iframe"; + } + + @Override + public void populateBean(IframeEditor e) { + srcTextField.setText(e.getSrc()); + parameterViewPane.populate(e.getParameters()); + this.horizontalCheck.setSelected(e.isOverflowx()); + this.verticalCheck.setSelected(e.isOverflowy()); + } + + @Override + public IframeEditor updateBean() { + IframeEditor ob = new IframeEditor(); + ob.setSrc(srcTextField.getText()); + List parameterList = parameterViewPane.update(); + ob.setParameters(parameterList.toArray(new ParameterProvider[parameterList.size()])); + ob.setOverflowx(this.horizontalCheck.isSelected()); + ob.setOverflowy(this.verticalCheck.isSelected()); + return ob; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java index 818f4ec11..1f23e18dd 100644 --- a/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/ListEditorDefinePane.java @@ -25,8 +25,8 @@ public class ListEditorDefinePane extends WriteUnableRepeatEditorPane { - private DictionaryComboBox acceptType; - private UICheckBox singleFileCheckBox; - private UINumberField fileSizeField; - - public MultiFileEditorPane() { - this.initComponents(); - } - - - @Override - protected String title4PopupWindow() { - return "file"; - } - - @Override - protected JPanel setFirstContentPane() { - acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); - acceptType.setPreferredSize(new Dimension(200, 18)); - singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); - fileSizeField = new UINumberField(); - fileSizeField.setPreferredSize(new Dimension(80, 18)); - - - JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - singleFilePane.add(singleFileCheckBox); - - JPanel allowTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - allowTypePane.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); - allowTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - allowTypePane.add(new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":")); - allowTypePane.add(acceptType); - - JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); - fileSizePane.add(fileSizeField); - fileSizePane.add(new UILabel(" KB")); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - Component[][] components = new Component[][]{ - new Component[]{singleFileCheckBox, null }, - new Component[]{new UILabel(" " + Inter.getLocText("File-Allow_Upload_Files") + ":"), acceptType}, - new Component[]{new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":"), fileSizeField}, - }; - double[] rowSize = {p, p,p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1},{1, 1},{1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, 5); - - - return panel; - } - - @Override - protected void populateSubFieldEditorBean(MultiFileEditor e) { - // 这里存在兼容问题 getAccept可能没在待选项目中 - acceptType.setSelectedItem(e.getAccept()); - singleFileCheckBox.setSelected(e.isSingleFile()); - fileSizeField.setValue(e.getMaxSize()); - } - - @Override - protected MultiFileEditor updateSubFieldEditorBean() { - MultiFileEditor ob = new MultiFileEditor(); - ob.setAccept((String) acceptType.getSelectedItem()); - ob.setSingleFile(singleFileCheckBox.isSelected()); - ob.setMaxSize(fileSizeField.getValue()); - return ob; - } - +package com.fr.design.widget.ui; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.DictionaryComboBox; +import com.fr.design.gui.icombobox.DictionaryConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.form.ui.MultiFileEditor; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +public class MultiFileEditorPane extends FieldEditorDefinePane { + private DictionaryComboBox acceptType; + private UICheckBox singleFileCheckBox; + private UISpinner fileSizeField; + + public MultiFileEditorPane() { + this.initComponents(); + } + + + @Override + protected String title4PopupWindow() { + return "file"; + } + + @Override + protected JPanel setFirstContentPane() { + JPanel contenter = new JPanel(new BorderLayout()); + + singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); + acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); +// acceptType.setPreferredSize(new Dimension(100, 20)); + fileSizeField = new UISpinner(0, Integer.MAX_VALUE, 1, -1); + fileSizeField.setPreferredSize(new Dimension(140, 20)); + + JPanel fileSizePane = new JPanel(new BorderLayout()); + UILabel fileTypeLabel = new UILabel(Inter.getLocText("Utils-File_type")); + UILabel fileSizeLabel = new UILabel(Inter.getLocText("FR-Designer_Size_Limit")); + fileSizePane.add(fileSizeField, BorderLayout.CENTER); + fileSizePane.add(new UILabel(" KB"), BorderLayout.EAST); + + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + Component[][] components = new Component[][]{ + new Component[]{singleFileCheckBox, null}, + new Component[]{fileTypeLabel, acceptType}, + new Component[]{fileSizeLabel, fileSizePane}, + }; + double[] rowSize = {p, p, p}; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 22, 10); + + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 00)); + contenter.add(panel, BorderLayout.CENTER); + + return contenter; + } + + @Override + protected void populateSubFieldEditorBean(MultiFileEditor e) { + // 这里存在兼容问题 getAccept可能没在待选项目中 + acceptType.setSelectedItem(e.getAccept()); + singleFileCheckBox.setSelected(e.isSingleFile()); + fileSizeField.setValue(e.getMaxSize()); + } + + @Override + protected MultiFileEditor updateSubFieldEditorBean() { + MultiFileEditor ob = new MultiFileEditor(); + ob.setAccept((String) acceptType.getSelectedItem()); + ob.setSingleFile(singleFileCheckBox.isSelected()); + ob.setMaxSize(fileSizeField.getValue()); + return ob; + } + } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 86a8bf50f..a955939f0 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -3,11 +3,15 @@ package com.fr.design.widget.ui; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFormattedTextField; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; import javax.swing.JPanel; @@ -26,7 +30,7 @@ import com.fr.general.Inter; public class NumberEditorDefinePane extends FieldEditorDefinePane { /** - * + * FieldEditorDefinePane */ private static final long serialVersionUID = 8011242951911686805L; private UICheckBox allowDecimalsCheckBox; @@ -37,7 +41,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane private SpinnerNumberModel maxValueModel; private UIBasicSpinner minValueSpinner; private SpinnerNumberModel minValueModel; - private com.fr.design.editor.editor.IntegerEditor decimalLength; + private UIBasicSpinner decimalLength; private JPanel limitNumberPane; private WaterMarkDictPane waterMarkDictPane; @@ -78,7 +82,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane }; - private ActionListener actionListener3 = new ActionListener() { + public ActionListener actionListener3 = new ActionListener() { public void actionPerformed(ActionEvent e) { if (setMaxValueCheckBox.isSelected()) { maxValueSpinner.setVisible(true); @@ -142,7 +146,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane }; public NumberEditorDefinePane() { - super(); +// super(); + this.initComponents(); } @@ -166,46 +171,60 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane public JPanel setValidatePane() { - this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); - this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); - this.decimalLength.setColumns(4); + this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Decimals")); + this.decimalLength = new UIBasicSpinner(new SpinnerNumberModel(16, 0, Integer.MAX_VALUE, 1)); + this.decimalLength.setPreferredSize(new Dimension(155, 20)); + this.allowDecimalsCheckBox.addActionListener(actionListener1); - this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("Allow_Negative")); + this.allowNegativeCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Negative")); this.allowNegativeCheckBox.addActionListener(actionListener2); - this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("Need_Max_Value"), false); + this.setMaxValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Max_Value"), false); this.maxValueSpinner = new UIBasicSpinner(maxValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); - maxValueSpinner.setPreferredSize(new Dimension(120, 20)); + maxValueSpinner.setPreferredSize(new Dimension(155, 20)); setNotAllowsInvalid(this.maxValueSpinner); this.maxValueSpinner.setVisible(false); this.setMaxValueCheckBox.addActionListener(actionListener3); this.maxValueSpinner.addChangeListener(changeListener1); - this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("Need_Min_Value"), false); + this.setMinValueCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Min_Value"), false); this.minValueSpinner = new UIBasicSpinner(minValueModel = new SpinnerNumberModel(0D, -Double.MAX_VALUE, Double.MAX_VALUE, 1D)); - minValueSpinner.setPreferredSize(new Dimension(120, 20)); + minValueSpinner.setPreferredSize(new Dimension(155, 20)); setNotAllowsInvalid(this.minValueSpinner); this.minValueSpinner.setVisible(false); this.setMinValueCheckBox.addActionListener(actionListener4); this.minValueSpinner.addChangeListener(changeListener2); + UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"})); + numberLabel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + + JPanel decimalPane = new JPanel(new BorderLayout()); + decimalPane.add(decimalLength, BorderLayout.CENTER); + decimalPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + JPanel maxValueSpinnerPane = new JPanel(new BorderLayout()); + maxValueSpinnerPane.add(maxValueSpinner, BorderLayout.CENTER); + maxValueSpinnerPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + JPanel minValueSpinnerPane = new JPanel(new BorderLayout()); + minValueSpinnerPane.add(minValueSpinner, BorderLayout.CENTER); + minValueSpinnerPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{allowDecimalsCheckBox, null }, - new Component[]{new UILabel(Inter.getLocText(new String[]{"Double", "Numbers"})), decimalLength }, + new Component[]{allowDecimalsCheckBox, null}, + new Component[]{numberLabel, decimalPane}, new Component[]{allowNegativeCheckBox, null}, - new Component[]{setMaxValueCheckBox, maxValueSpinner}, - new Component[]{setMinValueCheckBox, minValueSpinner}, + new Component[]{setMaxValueCheckBox, maxValueSpinnerPane}, + new Component[]{setMinValueCheckBox, minValueSpinnerPane}, }; double[] rowSize = {p, p, p, p, p}; - double[] columnSize = {p,f}; - int[][] rowCount = {{1, 1},{1, 1},{1, 1},{1, 1},{1, 1}}; - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 1); - return panel; + double[] columnSize = {p, f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; + JPanel pane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); + pane.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 0)); + return pane; } @@ -250,7 +269,7 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane NumberEditor ob = new NumberEditor(); ob.setAllowDecimals(allowDecimalsCheckBox.isSelected()); if (allowDecimalsCheckBox.isSelected()) { - ob.setMaxDecimalLength(this.decimalLength.getValue()); + ob.setMaxDecimalLength((Integer) this.decimalLength.getValue()); } ob.setAllowNegative(allowNegativeCheckBox.isSelected()); diff --git a/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java b/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java index 460065ba6..43dc848a7 100644 --- a/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/RadioGroupDefinePane.java @@ -1,63 +1,63 @@ -package com.fr.design.widget.ui; - -import java.awt.FlowLayout; - -import javax.swing.JPanel; - -import com.fr.design.data.DataCreatorUI; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.present.dict.DictionaryPane; -import com.fr.form.ui.RadioGroup; - -public class RadioGroupDefinePane extends FieldEditorDefinePane { - private DictionaryPane dictPane; - - private ButtonGroupDictPane buttonGroupDictPane; - - public RadioGroupDefinePane() { - this.initComponents(); - } - - @Override - protected void initComponents() { - super.initComponents(); - - dictPane = new DictionaryPane(); - } - - @Override - protected JPanel setFirstContentPane() { - - JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - buttonGroupDictPane = new ButtonGroupDictPane(); - buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); - centerPane.add(buttonGroupDictPane); - return centerPane; - } - - @Override - protected RadioGroup updateSubFieldEditorBean() { - RadioGroup ob = new RadioGroup(); - - ob.setDictionary(this.dictPane.updateBean()); - this.buttonGroupDictPane.update(ob); - - return ob; - } - - @Override - protected String title4PopupWindow() { - return "radiogroup"; - } - - @Override - protected void populateSubFieldEditorBean(RadioGroup ob) { - this.dictPane.populateBean(ob.getDictionary()); - this.buttonGroupDictPane.populate(ob); - } - - @Override - public DataCreatorUI dataUI() { - return dictPane; - } +package com.fr.design.widget.ui; + +import java.awt.FlowLayout; + +import javax.swing.JPanel; + +import com.fr.design.data.DataCreatorUI; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.present.dict.DictionaryPane; +import com.fr.form.ui.RadioGroup; + +public class RadioGroupDefinePane extends FieldEditorDefinePane { + private DictionaryPane dictPane; + + private ButtonGroupDictPane buttonGroupDictPane; + + public RadioGroupDefinePane() { + this.initComponents(); + } + + @Override + protected void initComponents() { + super.initComponents(); + + dictPane = new DictionaryPane(); + } + + @Override + protected JPanel setFirstContentPane() { + + JPanel centerPane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); + buttonGroupDictPane = new ButtonGroupDictPane(); + buttonGroupDictPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + centerPane.add(buttonGroupDictPane); + return centerPane; + } + + @Override + protected RadioGroup updateSubFieldEditorBean() { + RadioGroup ob = new RadioGroup(); + + ob.setDictionary(this.dictPane.updateBean()); + this.buttonGroupDictPane.update(ob); + + return ob; + } + + @Override + protected String title4PopupWindow() { + return "radiogroup"; + } + + @Override + protected void populateSubFieldEditorBean(RadioGroup ob) { + this.dictPane.populateBean(ob.getDictionary()); + this.buttonGroupDictPane.populate(ob); + } + + @Override + public DataCreatorUI dataUI() { + return dictPane; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java index f68c45ccc..1c0f8967a 100644 --- a/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/TreeEditorDefinePane.java @@ -5,6 +5,9 @@ import com.fr.design.gui.frpane.TreeSettingPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itree.refreshabletree.TreeRootPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.FRLeftFlowLayout; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.TreeEditor; import com.fr.general.Inter; @@ -46,13 +49,14 @@ public class TreeEditorDefinePane extends FieldEditorDefinePane { @Override protected JPanel setFirstContentPane() { - return this.setSecondContentPane(); - } + return this.setSecondContentPane(); + } protected JPanel setSecondContentPane() { JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); + JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); + contentPane.add(contenter,BorderLayout.NORTH); removeRepeatCheckBox = new UICheckBox(Inter.getLocText("Form-Remove_Repeat_Data"), false); contenter.add(removeRepeatCheckBox); diff --git a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java index e95d5cee1..1eef2b164 100644 --- a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java +++ b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java @@ -39,7 +39,7 @@ public class WaterMarkDictPane extends JPanel { int[][] rowCount = {{1, 1}}; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); // JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0)); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.add(panel, BorderLayout.CENTER); } diff --git a/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java index c13577393..f27b30857 100644 --- a/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/WritableRepeatEditorPane.java @@ -15,7 +15,7 @@ public abstract class WritableRepeatEditorPane @Override protected JPanel setSecondContentPane() { - JPanel contentPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel contentPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); JPanel otherContentPane = this.setThirdContentPane(); if (otherContentPane != null) { diff --git a/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java b/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java index 633572e0f..33b8e3f88 100644 --- a/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/WriteUnableRepeatEditorPane.java @@ -20,9 +20,8 @@ public abstract class WriteUnableRepeatEditorPane { protected UITextField columnRowTextField; - private UIButton cellElementEditButton; protected TemplateCellElement cellElement; protected UIComboBox comboBox; private UpdateAction[] cellInsertActions; @@ -44,18 +43,38 @@ public abstract class CellQuickEditor extends QuickEditor { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(" " + Inter.getLocText("Cell")), columnRowTextField = initColumnRowTextField()}, - new Component[]{new UILabel(Inter.getLocText("HF-Insert_Content") + " "), initCellElementEditComboBox()}, + new Component[]{initTopContent(), null}, new Component[]{createCenterBody(), null} }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.add(panel, BorderLayout.CENTER); } + + private JPanel initTopContent() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + UILabel cellLabel = new UILabel(Inter.getLocText("Cell")); + cellLabel.setPreferredSize(new Dimension(60, 20)); + UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content")); + insertContentLabel.setPreferredSize(new Dimension(60, 20)); + UIComboBox cellElementEditButton = initCellElementEditComboBox(); + Component[][] components = new Component[][]{ + new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()}, + new Component[]{insertContentLabel, cellElementEditButton}, + }; + JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + return topContent; + } + + /** * 初始化添加按钮 * diff --git a/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java index 058d137d2..261a1111a 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java @@ -1,6 +1,5 @@ package com.fr.quickeditor.cellquick; -import com.fr.base.BaseUtils; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.BiasCellAction; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; @@ -8,34 +7,35 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.painter.BiasTextPainter; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * 单元格元素斜线编辑器 - * TODO 9.0 大体没有改动 */ public class CellBiasTextPainterEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { - UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); - editbutton.addActionListener(new ActionListener() { - + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); + editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showEditingDialog(); } }); - editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - editbutton.setMargin(null); - editbutton.setOpaque(false); - return editbutton; + editButton.setOpaque(false); + content.add(editButton, BorderLayout.CENTER); + return content; } @Override @@ -63,8 +63,6 @@ public class CellBiasTextPainterEditor extends CellQuickEditor { @Override protected void refreshDetails() { - // TODO Auto-generated method stub - } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 860de6730..127cfd632 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -1,23 +1,45 @@ package com.fr.quickeditor.cellquick; +import com.fr.base.Formula; import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.DSColumnCellAction; -import com.fr.design.dscolumn.DSColumnAdvancedEditorPane; -import com.fr.design.dscolumn.DSColumnBasicEditorPane; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dscolumn.DSColumnAdvancedPane; import com.fr.design.dscolumn.ResultSetGroupDockingPane; import com.fr.design.dscolumn.SelectedDataColumnPane; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.CustomVariableResolver; +import com.fr.design.formula.FormulaFactory; +import com.fr.design.formula.UIFormula; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.cell.CellEditorPane; -import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.IOUtils; +import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; +import com.fr.report.cell.CellElement; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.cell.cellattr.CellExpandAttr; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.cell.cellattr.core.group.SelectCount; 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; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; @@ -31,75 +53,33 @@ import java.util.ArrayList; */ public class CellDSColumnEditor extends CellQuickEditor { + private static final double P = TableLayout.PREFERRED, F = TableLayout.FILL; + + private enum FilterType { + //前N个 后N个 奇数 偶数 自定义 未定义 + TOP, BOTTOM, ODD, EVEN, SPECIFY, UNDEFINE + } + private JPanel dsColumnRegion; private JPanel centerPane; - //数据集列选择组件 - private SelectedDataColumnPane dataPane; - //数据分组设置组件 - private ResultSetGroupDockingPane groupPane; - //过滤条件面板 - private JPanel conditionPane; + // 基本和高级设置 private ArrayList paneList; // 基本和高级设置 卡片布局 private CardLayout card; // 基本和高级设置 容器面板 - private JPanel center; + private JPanel cardContainer; // 卡片布局TAB切换按钮 private UIHeadGroup tabsHeaderIconPane; - // 分组设置监听器 - private ItemListener groupListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e == null) { - //分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存 - groupPane.update(); - fireTargetModified(); - return; - } - if (e.getStateChange() == ItemEvent.DESELECTED) { - if (!isEditing) { - return; - } - groupPane.update(); - fireTargetModified(); - } - } - }; - //数据集列设置监听器 - private ItemListener dataListener = new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - if (!isEditing) { - return; - } - dataPane.update(cellElement); - fireTargetModified(); - } - } - }; + // 数据列基本设置 + private DSColumnBasicEditorPane cellDSColumnBasicPane; + // 数据列高级设置 + private DSColumnAdvancedEditorPane cellDSColumnAdvancedPane; private CellDSColumnEditor() { super(); } - /** - * Test Main - * - * @param args 参数 - */ - public static void main(String[] args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(new BorderLayout()); - content.add(new CellDSColumnEditor(), BorderLayout.CENTER); - GUICoreUtils.centerWindow(jf); - jf.setSize(220, 400); - jf.setVisible(true); - } - /** * 创建面板占位 * @@ -111,7 +91,7 @@ public class CellDSColumnEditor extends CellQuickEditor { this.createSwitchTab(); dsColumnRegion = new JPanel(new BorderLayout()); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); - dsColumnRegion.add(center, BorderLayout.CENTER); + dsColumnRegion.add(cardContainer, BorderLayout.CENTER); centerPane = new JPanel(new BorderLayout()); centerPane.add(dsColumnRegion, BorderLayout.CENTER); return centerPane; @@ -123,17 +103,16 @@ public class CellDSColumnEditor extends CellQuickEditor { */ @Override protected void refreshDetails() { - this.createPanes(); this.createSwitchTab(); dsColumnRegion = new JPanel(new BorderLayout()); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); - dsColumnRegion.add(center, BorderLayout.CENTER); + dsColumnRegion.add(cardContainer, BorderLayout.CENTER); //必须removeAll之后再添加;重新再实例化一个centerJPanel,因为对象变了会显示不出来 centerPane.removeAll(); centerPane.add(dsColumnRegion, BorderLayout.CENTER); for (CellEditorPane cellEditorPane : paneList) { - cellEditorPane.populate(cellElement); + cellEditorPane.populate(); } this.validate(); } @@ -155,18 +134,18 @@ public class CellDSColumnEditor extends CellQuickEditor { private void createSwitchTab() { String[] iconArray = new String[paneList.size()]; card = new CardLayout(); - center = new JPanel(card); - center.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + cardContainer = new JPanel(card); + cardContainer.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); for (int i = 0; i < paneList.size(); i++) { CellEditorPane pane = paneList.get(i); iconArray[i] = pane.getIconPath(); - center.add(pane, pane.title4PopupWindow()); + cardContainer.add(pane, pane.title4PopupWindow()); } tabsHeaderIconPane = new UIHeadGroup(iconArray) { @Override public void tabChanged(int index) { - card.show(center, paneList.get(index).title4PopupWindow()); - paneList.get(index).populate(cellElement); + card.show(cardContainer, paneList.get(index).title4PopupWindow()); + paneList.get(index).populate(); } }; tabsHeaderIconPane.setNeedLeftRightOutLine(false); @@ -177,28 +156,832 @@ public class CellDSColumnEditor extends CellQuickEditor { */ private void createPanes() { paneList = new ArrayList<>(); - /*基本设置面板*/ - this.dataPane = new SelectedDataColumnPane(); - this.groupPane = new ResultSetGroupDockingPane(tc); - double p = TableLayout.PREFERRED, f = TableLayout.FILL; - double[] rowSize = {p}, columnSize = {p, f}; - UILabel uiLabel = new UILabel("filter"); - UIButton uiButton = new UIButton(); - if (tc != null) { - //第一次初始化时tc为空,引发NullPointerException - uiButton = new UIButton(new DSColumnConditionAction(tc)); - } - Component[][] components = new Component[][]{ - new Component[]{uiLabel, uiButton} + cellDSColumnBasicPane = new DSColumnBasicEditorPane(); + paneList.add(cellDSColumnBasicPane); + /*高级设置面板*/ + cellDSColumnAdvancedPane = new DSColumnAdvancedEditorPane(); + paneList.add(cellDSColumnAdvancedPane); + } + + + /** + * 单元格元素 数据列 高级设置内容面板 + * + * @author yaoh.wu + * @version 2017年7月25日 + * @since 9.0 + */ + class DSColumnBasicEditorPane extends CellEditorPane { + + //数据集和数据列 + private SelectedDataColumnPane dataPane; + //数据分组设置 + private ResultSetGroupDockingPane groupPane; + //条件过滤按钮面板 + private JPanel conditionPane; + + // 分组设置监听器 + private ItemListener groupListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e == null) { + //分组-高级-自定义点确定的时候传进来null的e,但是这时候应该触发保存 + groupPane.update(); + fireTargetModified(); + return; + } + if (e.getStateChange() == ItemEvent.DESELECTED) { + groupPane.update(); + fireTargetModified(); + } + } + }; + //数据集列设置监听器 + private ItemListener dataListener = new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + dataPane.update(cellElement); + fireTargetModified(); + } + } }; - this.conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - dataPane.addListener(dataListener); - groupPane.addListener(groupListener); - paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane, conditionPane)); - /*高级设置面板*/ - paneList.add(new DSColumnAdvancedEditorPane()); + DSColumnBasicEditorPane() { + this.setLayout(new BorderLayout()); + dataPane = new SelectedDataColumnPane(true, true, tc, cellElement); + groupPane = new ResultSetGroupDockingPane(tc); + dataPane.addListener(dataListener); + groupPane.addListener(groupListener); + + double[] rowSize = {P}, columnSize = {P, F}; + UILabel uiLabel = new UILabel(Inter.getLocText("FR-Designer_Filter_Conditions")); + uiLabel.setPreferredSize(new Dimension(60, 20)); + UIButton uiButton = new UIButton(); + if (tc != null) { + //第一次初始化时tc为空,引发NullPointerException + uiButton = new UIButton(new DSColumnConditionAction(tc)); + } + Component[][] components = new Component[][]{ + new Component[]{uiLabel, uiButton} + }; + conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + this.add(this.createContentPane(), BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + } + + + @Override + public String getIconPath() { + return Inter.getLocText("FR-Designer_Basic"); + } + + @Override + public String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Basic"); + } + + + @Override + public void update() { + dataPane.update(cellElement); + groupPane.update(); + } + + @Override + public void populate() { + dataPane.populate(null, cellElement); + groupPane.populate(cellElement); + } + + + /** + * 创建有内容的面板显示信息 + * + * @return content JPanel + */ + private JPanel createContentPane() { + + double[] columnSize = {F}; + double[] rowSize = {P, P, P}; + Component[][] components = new Component[][]{ + //数据集列选择 + new Component[]{this.dataPane}, + //数据分组设置 + new Component[]{this.groupPane}, + //条件过滤 + new Component[]{this.conditionPane} + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + } + + + class DSColumnAdvancedEditorPane extends CellEditorPane { + + private static final String INSET_TEXT = " "; + + //排列顺序 + private ResultSetSortConfigPane sortPane; + //结果集筛选 + private ResultSetFilterConfigPane filterPane; + //自定义值显示 + private CustomValuePane valuePane; + //横向可扩展性 + private UICheckBox heCheckBox; + //纵向可扩展性 + private UICheckBox veCheckBox; + //补充空白数据 + private UICheckBox useMultiplyNumCheckBox; + //补充空白数据书目输入框 + private UISpinner multiNumSpinner; + + + public DSColumnAdvancedEditorPane() { + this.setLayout(new BorderLayout()); + this.add(this.createContentPane(), BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + } + + + @Override + public String getIconPath() { + return Inter.getLocText("FR-Designer_Advanced"); + } + + @Override + public String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Advanced"); + } + + + @Override + public void update() { + if (cellElement != null) { + sortPane.update(cellElement); + valuePane.update(cellElement); + filterPane.update(cellElement); + //更新单元格扩展属性 + updateExtendConfig(); + + //更新补充空白设置 + updateMultipleConfig(); + } + } + + @SuppressWarnings("Duplicates") + @Override + public void populate() { + if (cellElement != null) { + sortPane.populate(cellElement); + valuePane.populate(cellElement); + filterPane.populate(cellElement); + CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); + if (cellExpandAttr == null) { + cellExpandAttr = new CellExpandAttr(); + cellElement.setCellExpandAttr(cellExpandAttr); + } + // extendable + switch (cellExpandAttr.getExtendable()) { + case CellExpandAttr.Both_EXTENDABLE: + heCheckBox.setSelected(true); + veCheckBox.setSelected(true); + break; + case CellExpandAttr.Vertical_EXTENDABLE: + heCheckBox.setSelected(false); + veCheckBox.setSelected(true); + break; + case CellExpandAttr.Horizontal_EXTENDABLE: + heCheckBox.setSelected(true); + veCheckBox.setSelected(false); + break; + default: { + heCheckBox.setSelected(false); + veCheckBox.setSelected(false); + } + } + if (cellExpandAttr.getMultipleNumber() == -1) { + useMultiplyNumCheckBox.setSelected(false); + } else { + useMultiplyNumCheckBox.setSelected(true); + multiNumSpinner.setValue(cellExpandAttr.getMultipleNumber()); + } + this.checkButtonEnabled(); + } + } + + /** + * 更新单元格扩展属性 + */ + @SuppressWarnings("Duplicates") + private void updateExtendConfig() { + CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); + if (cellExpandAttr == null) { + cellExpandAttr = new CellExpandAttr(); + cellElement.setCellExpandAttr(cellExpandAttr); + } + if (heCheckBox.isSelected()) { + if (veCheckBox.isSelected()) { + cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE); + } else { + cellExpandAttr.setExtendable(CellExpandAttr.Horizontal_EXTENDABLE); + } + } else { + if (veCheckBox.isSelected()) { + cellExpandAttr.setExtendable(CellExpandAttr.Vertical_EXTENDABLE); + } else { + cellExpandAttr.setExtendable(CellExpandAttr.None_EXTENDABLE); + } + } + } + + /** + * 更新补充空白处的配置 + */ + private void updateMultipleConfig() { + CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); + if (this.useMultiplyNumCheckBox.isSelected()) { + cellExpandAttr.setMultipleNumber((int) multiNumSpinner.getValue()); + } else { + cellExpandAttr.setMultipleNumber(-1); + } + + } + + /** + * 创建内容 + * + * @return 内容面板 + */ + private JPanel createContentPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + //结果集排序 + sortPane = new ResultSetSortConfigPane(); + sortPane.addListener(new UIObserverListener() { + @Override + public void doChange() { + sortPane.update(cellElement); + fireTargetModified(); + } + }, new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + sortPane.update(cellElement); + fireTargetModified(); + } + } + ); + //结果筛选 + filterPane = new ResultSetFilterConfigPane(); + filterPane.addListener(new UIObserverListener() { + @Override + public void doChange() { + filterPane.update(cellElement); + fireTargetModified(); + } + }, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + filterPane.update(cellElement); + fireTargetModified(); + } + } + ); + //自定义值显示 + valuePane = new CustomValuePane(); + valuePane.addListener(new UIObserverListener() { + @Override + public void doChange() { + valuePane.update(cellElement); + fireTargetModified(); + } + }); + + //可扩展性 + JPanel extendableDirectionPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable"))); + extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable"))); + heCheckBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + cellDSColumnAdvancedPane.updateExtendConfig(); + fireTargetModified(); + } + }); + veCheckBox.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + cellDSColumnAdvancedPane.updateExtendConfig(); + fireTargetModified(); + } + }); + + //补充空白数据 + JPanel multiNumPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); + useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple")); + multiNumPane.add(useMultiplyNumCheckBox); + multiNumPane.add(new UILabel(INSET_TEXT)); + multiNumSpinner = new UISpinner(1, 10000, 1, 1); + multiNumPane.add(multiNumSpinner); + useMultiplyNumCheckBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + checkButtonEnabled(); + cellDSColumnAdvancedPane.updateMultipleConfig(); + fireTargetModified(); + } + }); + multiNumSpinner.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + cellDSColumnAdvancedPane.updateMultipleConfig(); + fireTargetModified(); + } + }); + + + double[] rowSize = {P, P, P, P, P, P}; + double[] columnSize = {F}; + + Component[][] components = new Component[][]{ + {sortPane}, + {filterPane}, + {valuePane}, + {extendableDirectionPane}, + {multiNumPane} + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + + private void checkButtonEnabled() { + if (useMultiplyNumCheckBox.isSelected()) { + multiNumSpinner.setEnabled(true); + } else { + multiNumSpinner.setEnabled(false); + } + } + + /** + * 单元格元素>数据集>高级设置>结果排序设置面板 + * + * @see com.fr.design.expand.SortExpandAttrPane + * @see DSColumnAdvancedPane.SortPane + */ + public class ResultSetSortConfigPane extends JPanel { + //面板 + private UIButtonGroup sortTypePane; + private JFormulaField formulaField; + private CardLayout cardLayout; + private JPanel centerPane; + + + public ResultSetSortConfigPane() { + this.setLayout(new BorderLayout()); + Icon[] iconArray = { + IOUtils.readIcon("/com/fr/design/images/expand/none16x16.png"), + IOUtils.readIcon("/com/fr/design/images/expand/asc.png"), + IOUtils.readIcon("/com/fr/design/images/expand/des.png") + }; + String[] nameArray = {Inter.getLocText("Sort-Original"), Inter.getLocText("Sort-Ascending"), Inter.getLocText("Sort-Descending")}; + sortTypePane = new UIButtonGroup(iconArray); + sortTypePane.setAllToolTips(nameArray); + sortTypePane.setGlobalName(Inter.getLocText("ExpandD-Sort_After_Expand")); + + cardLayout = new CardLayout(); + centerPane = new JPanel(cardLayout); + formulaField = new JFormulaField(""); + centerPane.add(new JPanel(), "none"); + centerPane.add(formulaField, "content"); + UILabel sortLabel = new UILabel(Inter.getLocText("Sort-Sort_Order")); + sortLabel.setPreferredSize(new Dimension(60, 20)); + sortTypePane.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean noContent = sortTypePane.getSelectedIndex() == 0; + cardLayout.show(centerPane, noContent ? "none" : "content"); + if (noContent) { + centerPane.setPreferredSize(new Dimension(0, 0)); + } else { + centerPane.setPreferredSize(new Dimension(165, 20)); + } + } + }); + + Component[][] components = new Component[][]{ + new Component[]{sortLabel, sortTypePane}, + new Component[]{null, centerPane} + }; + + double[] rowSize = {P, P}, columnSize = {P, F}; + this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); + } + + + /** + * 刷新面板信息 + * + * @param cellElement 单元格 + */ + public void populate(TemplateCellElement cellElement) { + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dSColumn = (DSColumn) value; + int sort = dSColumn.getOrder(); + this.sortTypePane.setSelectedIndex(sort); + boolean noContent = sortTypePane.getSelectedIndex() == 0; + cardLayout.show(centerPane, noContent ? "none" : "content"); + if (noContent) { + centerPane.setPreferredSize(new Dimension(0, 0)); + } else { + centerPane.setPreferredSize(new Dimension(155, 20)); + } + String sortFormula = dSColumn.getSortFormula(); + if (sortFormula != null && sortFormula.length() >= 1) { + this.formulaField.populate(sortFormula); + } + } + } + } + + /** + * 保存面板配置信息 + * + * @param cellElement 单元格 + */ + public void update(CellElement cellElement) { + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dSColumn = (DSColumn) (cellElement.getValue()); + dSColumn.setOrder(this.sortTypePane.getSelectedIndex()); + dSColumn.setSortFormula(this.formulaField.getFormulaText()); + } + } + } + + /** + * 添加事件监听器 + * + * @param formulaChangeListener 公式输入框改动事件监听器 + * @param changeListener 排序类型下拉框改动事件监听器 + */ + public void addListener(UIObserverListener formulaChangeListener, ChangeListener changeListener) { + formulaField.addListener(formulaChangeListener); + sortTypePane.addChangeListener(changeListener); + } + } + + /** + * 单元格元素>数据集>高级设置>结果集筛选设置面板 + * + * @see DSColumnAdvancedPane.SelectCountPane + */ + public class ResultSetFilterConfigPane extends JPanel { + + private UIComboBox rsComboBox; + private JPanel setCardPane; + private JPanel tipCardPane; + private UITextField serialTextField; + private JFormulaField topFormulaPane; + private JFormulaField bottomFormulaPane; + + public ResultSetFilterConfigPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + UILabel filterLabel = new UILabel(Inter.getLocText("BindColumn-Results_Filter")); + //结果集筛选下拉框 + rsComboBox = new UIComboBox(new String[]{ + Inter.getLocText("Undefined"), + Inter.getLocText("BindColumn-Top_N"), + Inter.getLocText("BindColumn-Bottom_N"), + Inter.getLocText("Odd"), + Inter.getLocText("Even"), + Inter.getLocText("Specify") + }); + rsComboBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + int selectIndex = rsComboBox.getSelectedIndex(); + CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); + CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); + if (selectIndex == 1) { + //前N个 + setCardPaneLayout.show(setCardPane, FilterType.TOP.name()); + tipCardPaneLayout.show(tipCardPane, FilterType.TOP.name()); + //隐藏tip 显示set + setCardPane.setPreferredSize(new Dimension(155, 20)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + } else if (selectIndex == 2) { + //后N个 + setCardPaneLayout.show(setCardPane, FilterType.BOTTOM.name()); + tipCardPaneLayout.show(tipCardPane, FilterType.BOTTOM.name()); + //隐藏tip 显示set + setCardPane.setPreferredSize(new Dimension(155, 20)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + } else if (selectIndex == 3) { + //奇数 + setCardPaneLayout.show(setCardPane, FilterType.ODD.name()); + tipCardPaneLayout.show(tipCardPane, FilterType.ODD.name()); + //隐藏set 显示tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(221, 15)); + } else if (selectIndex == 4) { + setCardPaneLayout.show(setCardPane, FilterType.EVEN.name()); + tipCardPaneLayout.show(tipCardPane, FilterType.EVEN.name()); + //隐藏set 显示tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(221, 15)); + } else if (selectIndex == 5) { + setCardPaneLayout.show(setCardPane, FilterType.SPECIFY.name()); + tipCardPaneLayout.show(tipCardPane, FilterType.SPECIFY.name()); + //显示set和tip + setCardPane.setPreferredSize(new Dimension(155, 20)); + tipCardPane.setPreferredSize(new Dimension(221, 15)); + } else { + setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name()); + tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name()); + //隐藏set和tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + } + + } + }); + //配置展示CardLayout + setCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + //提示信息展示CardLayout + tipCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + + //前N个 + topFormulaPane = new JFormulaField("="); + setCardPane.add(topFormulaPane, FilterType.TOP.name()); + tipCardPane.add(new JPanel(), FilterType.TOP.name()); + + //后N个 + bottomFormulaPane = new JFormulaField("="); + setCardPane.add(bottomFormulaPane, FilterType.BOTTOM.name()); + tipCardPane.add(new JPanel(), FilterType.BOTTOM.name()); + + //自定义值下方没有提示信息,也没有输入框 + setCardPane.add(new JPanel(), FilterType.UNDEFINE.name()); + tipCardPane.add(new JPanel(), FilterType.UNDEFINE.name()); + + //奇数 UILabel 占一行作为提示信息 + setCardPane.add(new JPanel(), FilterType.ODD.name()); + tipCardPane.add(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1") + + "," + Inter.getLocText("BindColumn-Odd_Selected_(1,3,5...)")), FilterType.ODD.name()); + + + //偶数 UILabel 占一行作为提示信息 + setCardPane.add(new JPanel(), FilterType.EVEN.name()); + tipCardPane.add(new UILabel(Inter.getLocText("BindColumn-Result_Serial_Number_Start_From_1") + + "," + Inter.getLocText("BindColumn-Even_Selected_(2,4,6...)")), FilterType.EVEN.name()); + + //输入框占用右半边,提示信息占一行 + serialTextField = new UITextField(16); + setCardPane.add(serialTextField, FilterType.SPECIFY.name()); + tipCardPane.add(new UILabel( + Inter.getLocText(new String[]{ + "Format", "BindColumn-Result_Serial_Number_Start_From_1", "Inner_Parameter", "Group_Count"}, + new String[]{": 1,2-3,5,8 ", ",", "$__count__"})), FilterType.SPECIFY.name()); + + this.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{ + {filterLabel, rsComboBox}, + {null, setCardPane}, + {tipCardPane, null} + }, new double[]{P, P, P}, new double[]{P, F}), BorderLayout.CENTER); + } + + public void populate(CellElement cellElement) { + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dSColumn = (DSColumn) (cellElement.getValue()); + SelectCount selectCount = dSColumn.getSelectCount(); + this.topFormulaPane.populateElement(cellElement); + this.bottomFormulaPane.populateElement(cellElement); + if (selectCount != null) { + int selectCountType = selectCount.getType(); + this.rsComboBox.setSelectedIndex(selectCountType); + switch (selectCountType) { + case SelectCount.TOP: + this.topFormulaPane.populate(selectCount.getFormulaCount()); + //隐藏tip 显示set + setCardPane.setPreferredSize(new Dimension(155, 20)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + break; + case SelectCount.BOTTOM: + this.bottomFormulaPane.populate(selectCount.getFormulaCount()); + //隐藏tip 显示set + setCardPane.setPreferredSize(new Dimension(155, 20)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + break; + case SelectCount.SPECIFY: + this.serialTextField.setText(selectCount.getSerial()); + //显示set和tip + setCardPane.setPreferredSize(new Dimension(155, 20)); + tipCardPane.setPreferredSize(new Dimension(221, 15)); + break; + case SelectCount.EVEN: + //隐藏set 显示tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(221, 15)); + break; + case SelectCount.ODD: + //隐藏set 显示tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(221, 15)); + break; + default: + //隐藏set和tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + } + } else { + //隐藏set和tip + setCardPane.setPreferredSize(new Dimension(0, 0)); + tipCardPane.setPreferredSize(new Dimension(0, 0)); + } + } + } + } + + public void update(CellElement cellElement) { + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dSColumn = (DSColumn) (cellElement.getValue()); + int selectedFilterIndex = this.rsComboBox.getSelectedIndex(); + if (selectedFilterIndex == 0) { + dSColumn.setSelectCount(null); + } else { + SelectCount selectCount = new SelectCount(); + selectCount.setType(selectedFilterIndex); + dSColumn.setSelectCount(selectCount); + if (selectedFilterIndex == SelectCount.TOP) { + selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); + } else if (selectedFilterIndex == SelectCount.BOTTOM) { + selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); + } else if (selectedFilterIndex == SelectCount.SPECIFY) { + selectCount.setSerial(this.serialTextField.getText()); + } + } + } + } + } + + /** + * 添加事件监听器 + * + * @param formulaListener 公式输入框改动事件监听器 + * @param actionListener 筛选类型下拉框改动事件监听器 + */ + public void addListener(UIObserverListener formulaListener, ActionListener actionListener) { + topFormulaPane.addListener(formulaListener); + bottomFormulaPane.addListener(formulaListener); + rsComboBox.addActionListener(actionListener); + } + } + + /** + * 单元格元素>数据集>高级设置>公式输入框 + * + * @see DSColumnAdvancedPane.JFormulaField + */ + public class JFormulaField extends JPanel { + private CellElement cellElement; + private UITextField formulaTextField; + private String defaultValue; + + public JFormulaField(String defaultValue) { + + this.defaultValue = defaultValue; + formulaTextField = new UITextField(); + formulaTextField.setText(defaultValue); + JPanel textFieldPane = new JPanel(new BorderLayout()); + textFieldPane.add(formulaTextField, BorderLayout.CENTER); + textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + formulaButton.setToolTipText(Inter.getLocText("Formula") + "..."); + formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height)); + formulaButton.addActionListener(formulaButtonActionListener); + + JPanel pane = new JPanel(new BorderLayout()); + pane.add(textFieldPane, BorderLayout.CENTER); + pane.add(formulaButton, BorderLayout.EAST); + this.setLayout(new BorderLayout()); + this.add(pane, BorderLayout.NORTH); + } + + public void populate(String formulaContent) { + this.formulaTextField.setText(formulaContent); + } + + public void populateElement(CellElement cellElement) { + this.cellElement = cellElement; + } + + public String getFormulaText() { + return this.formulaTextField.getText().trim(); + } + + /** + * 添加事件监听器 + * + * @param listener 公式文本输入框改动事件监听器 + */ + public void addListener(UIObserverListener listener) { + this.formulaTextField.registerChangeListener(listener); + } + + private ActionListener formulaButtonActionListener = new ActionListener() { + public void actionPerformed(ActionEvent evt) { + Formula valueFormula = new Formula(); + String text = formulaTextField.getText(); + if (text == null || text.length() <= 0) { + valueFormula.setContent(defaultValue); + } else { + valueFormula.setContent(text); + } + final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dsColumn = (DSColumn) value; + String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName()); + formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames, true)); + formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DSColumnAdvancedEditorPane.JFormulaField.this), new DialogActionAdapter() { + @Override + public void doOk() { + Formula valueFormula = formulaPane.update(); + if (valueFormula.getContent().length() <= 1) { + formulaTextField.setText(defaultValue); + } else { + formulaTextField.setText(valueFormula.getContent().substring(1)); + } + } + }).setVisible(true); + } + } + } + }; + } + + /** + * 单元格元素>数据集>高级设置>自定义值显示设置面板 + * + * @see DSColumnAdvancedPane.ValuePane + */ + public class CustomValuePane extends JPanel { + private JFormulaField formulaField; + + public CustomValuePane() { + this.setLayout(new BorderLayout()); + UILabel customValueLabel = new UILabel(Inter.getLocText("FR-Designer_Display_Value")); + customValueLabel.setPreferredSize(new Dimension(60, 20)); + formulaField = new JFormulaField("$$$"); + this.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{ + new Component[]{customValueLabel, formulaField}, + }, new double[]{P}, new double[]{P, F}), BorderLayout.CENTER); + } + + public void populate(CellElement cellElement) { + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dSColumn = (DSColumn) value; + + //formula + String valueFormula = dSColumn.getResult(); + if (valueFormula == null) { + valueFormula = "$$$"; + } + formulaField.populateElement(cellElement); + formulaField.populate(valueFormula); + } + } + } + + public void update(CellElement cellElement) { + if (cellElement != null) { + Object value = cellElement.getValue(); + if (value != null && value instanceof DSColumn) { + DSColumn dSColumn = (DSColumn) (cellElement.getValue()); + dSColumn.setResult(this.formulaField.getFormulaText()); + } + } + } + + /** + * 添加事件监听器 + * + * @param formulaListener 公式输入框改动事件监听器 + */ + public void addListener(UIObserverListener formulaListener) { + this.formulaField.addListener(formulaListener); + } + } } @Override diff --git a/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java new file mode 100644 index 000000000..07e2367ea --- /dev/null +++ b/designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java @@ -0,0 +1,152 @@ +package com.fr.quickeditor.cellquick; + +import com.fr.base.Formula; +import com.fr.base.Style; +import com.fr.base.TextFormat; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.grid.selection.CellSelection; +import com.fr.quickeditor.CellQuickEditor; +import com.fr.report.ReportHelper; +import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.stable.ColumnRow; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +/** + * 公式快速编辑面板,同文本数字编辑拆分 + * + * @author yaoh.wu + * @version 2017年8月7日10点44分 + * @since 9.0 + */ +public class CellFormulaQuickEditor extends CellQuickEditor { + //文本域 + private UITextField stringTextField; + //编辑状态 + private boolean isEditing = false; + + //编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。 + private boolean reserveInResult = false; + private boolean reserveOnWriteOrAnaly = true; + + private DocumentListener documentListener = new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + changeReportPaneCell(stringTextField.getText().trim()); + } + + @Override + public void removeUpdate(DocumentEvent e) { + changeReportPaneCell(stringTextField.getText().trim()); + } + + @Override + public void changedUpdate(DocumentEvent e) { + changeReportPaneCell(stringTextField.getText().trim()); + } + + }; + + private CellFormulaQuickEditor() { + super(); + } + + /** + * 详细信息面板 + */ + @Override + public JComponent createCenterBody() { + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + stringTextField = new UITextField(); + stringTextField.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + if (tc != null) { + tc.getGrid().dispatchEvent(e); + } + } + }); + content.add(stringTextField, BorderLayout.CENTER); + return content; + } + + + private void changeReportPaneCell(String tmpText) { + isEditing = true; + //refresh一下,如果单元格内有新添加的控件,此时并不知道 + CellSelection cs1 = (CellSelection) tc.getSelection(); + ColumnRow columnRow = ColumnRow.valueOf(cs1.getColumn(), cs1.getRow()); + columnRowTextField.setText(columnRow.toString()); + cellElement = tc.getEditingElementCase().getTemplateCellElement(cs1.getColumn(), cs1.getRow()); + + if (cellElement == null) { + CellSelection cs = (CellSelection) tc.getSelection(); + cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); + tc.getEditingElementCase().addCellElement(cellElement, false); + } + if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { + Formula textFormula = new Formula(tmpText); + textFormula.setReserveInResult(reserveInResult); + textFormula.setReserveOnWriteOrAnaly(reserveOnWriteOrAnaly); + cellElement.setValue(textFormula); + } else { + Style style = cellElement.getStyle(); + if (style != null && style.getFormat() != null && style.getFormat() == TextFormat.getInstance()) { + cellElement.setValue(tmpText); + } else { + cellElement.setValue(ReportHelper.convertGeneralStringAccordingToExcel(tmpText)); + } + } + fireTargetModified(); + stringTextField.requestFocus(); + isEditing = false; + } + + /** + * 刷新详细内容 + */ + @Override + protected void refreshDetails() { + String str; + if (cellElement == null) { + str = StringUtils.EMPTY; + } else { + Object value = cellElement.getValue(); + if (value == null) { + str = StringUtils.EMPTY; + } else if (value instanceof Formula) { + Formula formula = (Formula) value; + str = formula.getContent(); + reserveInResult = formula.isReserveInResult(); + reserveOnWriteOrAnaly = formula.isReserveOnWriteOrAnaly(); + } else { + str = value.toString(); + } + } + showText(str); + stringTextField.setEditable(tc.isSelectedOneCell()); + } + + /** + * 显示文本 + * + * @param str 文本 + */ + public void showText(String str) { + // 正在编辑时不处理 + if (isEditing) { + return; + } + stringTextField.getDocument().removeDocumentListener(documentListener); + stringTextField.setText(str); + stringTextField.getDocument().addDocumentListener(documentListener); + } + +} \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java index d53aff244..315e95c57 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java @@ -1,6 +1,5 @@ package com.fr.quickeditor.cellquick; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.ImageCellAction; @@ -9,27 +8,23 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.DesignerContext; import com.fr.design.report.SelectImagePane; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.cellattr.CellImage; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * 单元格元素图片编辑器 - * TODO 9.0大体上没有改动 + * + * @author yaoh.wu + * @version 2017年8月7日10点53分 */ public class CellImageQuickEditor extends CellQuickEditor { - private static CellImageQuickEditor THIS; - - public static final CellImageQuickEditor getInstance() { - if (THIS == null) { - THIS = new CellImageQuickEditor(); - } - return THIS; - } private CellImageQuickEditor() { super(); @@ -37,27 +32,27 @@ public class CellImageQuickEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { - UIButton editbutton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); - editbutton.addActionListener(new ActionListener() { - + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/image.png")); + editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showEditingDialog(); } }); - editbutton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - editbutton.setMargin(null); - editbutton.setOpaque(false); - return editbutton; + editButton.setOpaque(false); + content.add(editButton, BorderLayout.CENTER); + return content; } + @SuppressWarnings("Duplicates") private void showEditingDialog() { final SelectImagePane imageEditorPane = new SelectImagePane(); imageEditorPane.populate(cellElement); final Object oldValue = cellElement.getValue(); final Style oldStyle = cellElement.getStyle(); imageEditorPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override public void doOk() { CellImage cellImage = imageEditorPane.update(); @@ -67,7 +62,6 @@ public class CellImageQuickEditor extends CellQuickEditor { fireTargetModified(); } } - }).setVisible(true); } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java index 4d48539d7..a0cbf705b 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -7,38 +7,30 @@ import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; import javax.swing.*; +import java.awt.*; /** * 单元格元素富文本编辑器 - * TODO 9.0 大体上没有改动 + * + * @author yaoh.wu + * @version 2017年8月7日10点53分 */ public class CellRichTextEditor extends CellQuickEditor { - private UIButton subReportButton; - private static CellRichTextEditor THIS; - - public static final CellRichTextEditor getInstance() { - if (THIS == null) { - THIS = new CellRichTextEditor(); - } - return THIS; - } + private UIButton richTextButton; private CellRichTextEditor() { super(); } - /** - * 创建界面上中间的部分 - * - * @return 界面元素 - * @date 2014-12-7-下午9:41:52 - */ + @SuppressWarnings("Duplicates") + @Override public JComponent createCenterBody() { - subReportButton = new UIButton(); - subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - subReportButton.setMargin(null); - subReportButton.setOpaque(false); - return subReportButton; + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + richTextButton = new UIButton(); + richTextButton.setOpaque(false); + content.add(richTextButton, BorderLayout.CENTER); + return content; } @Override @@ -50,7 +42,7 @@ public class CellRichTextEditor extends CellQuickEditor { protected void refreshDetails() { RichTextCellAction subReportCellAction = new RichTextCellAction(tc); subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); - subReportButton.setAction(subReportCellAction); + richTextButton.setAction(subReportCellAction); } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java index a196f9fd1..68ce13eef 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java @@ -16,6 +16,7 @@ import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -23,6 +24,7 @@ import java.awt.event.KeyEvent; * */ public class CellStringQuickEditor extends CellQuickEditor { + private Object selectedItem; //instance private static CellStringQuickEditor THIS; @@ -32,12 +34,6 @@ public class CellStringQuickEditor extends CellQuickEditor { //编辑状态 private boolean isEditing = false; - public static CellStringQuickEditor getInstance() { - if (THIS == null) { - THIS = new CellStringQuickEditor(); - } - return THIS; - } //august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。 private boolean reserveInResult = false; @@ -67,10 +63,12 @@ public class CellStringQuickEditor extends CellQuickEditor { /** * 详细信息面板 - * todo 文本框可自适应大小,公式编辑也是在这边,如果是公式那么要加一个公式编辑器的触发按钮 + * todo 文本框可自适应大小,公式编辑新写一个 */ @Override public JComponent createCenterBody() { + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); stringTextField = new UITextField(); stringTextField.addKeyListener(new KeyAdapter() { @Override @@ -80,7 +78,8 @@ public class CellStringQuickEditor extends CellQuickEditor { } } }); - return stringTextField; + content.add(stringTextField, BorderLayout.CENTER); + return content; } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java index 353622d7a..3ef0cda8a 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -7,33 +7,31 @@ import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; import javax.swing.*; +import java.awt.*; /** * 单元格元素子报表编辑器 - * TODO 9.0大体上没有改动 + * + * @author yaoh.wu + * @version 2017年8月7日10点53分 */ public class CellSubReportEditor extends CellQuickEditor { private UIButton subReportButton; - private static CellSubReportEditor THIS; - public static final CellSubReportEditor getInstance() { - if (THIS == null) { - THIS = new CellSubReportEditor(); - } - return THIS; - } private CellSubReportEditor() { super(); } + @SuppressWarnings("Duplicates") @Override public JComponent createCenterBody() { + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); subReportButton = new UIButton(); - subReportButton.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - subReportButton.setMargin(null); subReportButton.setOpaque(false); - return subReportButton; + content.add(subReportButton, BorderLayout.CENTER); + return content; } @Override diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 46a883ab1..e283fce82 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -154,7 +154,7 @@ public interface UIConstants { public static final Color BARNOMAL = new Color(232, 232, 233); public static final Color COMPONENT_BACKGROUND_COLOR = new Color(237,237,238); public static final int ARC = 0; - public static final int BUTTON_GROUP_ARC = 6; + public static final int BUTTON_GROUP_ARC = 0; public static final int LARGEARC = 6; public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0); public static final Icon PREVIEW_DOWN = BaseUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png"); diff --git a/designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java b/designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java index a9cea2cf1..084b11ee4 100644 --- a/designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/ReportletParameterViewPane.java @@ -23,115 +23,124 @@ import java.util.List; /** * Defin hyperlink. * in fact,this is a TablEditorPane + * * @editor zhou * @since 2012-3-23下午3:48:10 */ public class ReportletParameterViewPane extends BasicPane { - private UITableEditorPane editorPane; + private UITableEditorPane editorPane; - public ReportletParameterViewPane() { - this(null, ParameterTableModel.NO_CHART_USE); - } + public ReportletParameterViewPane() { + this(null, ParameterTableModel.NO_CHART_USE); + } - // kunsnat: 控制是否用Chart的热点链接actions - public ReportletParameterViewPane(int useParaType) { - this(null, useParaType); - } + // kunsnat: 控制是否用Chart的热点链接actions + public ReportletParameterViewPane(int useParaType) { + this(null, useParaType); + } - public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType) { - this(actions, useParaType, ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType), - ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType)); - } + public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType) { + this(actions, useParaType, ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType), + ValueEditorPaneFactory.createVallueEditorPaneWithUseType(useParaType)); + } - public ReportletParameterViewPane(int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { - this(null, useParaType, valueEditorPane, valueRenderPane); - } + public ReportletParameterViewPane(int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { + this(null, useParaType, valueEditorPane, valueRenderPane); + } - public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { - this.initComponent(actions, useParaType, valueEditorPane, valueRenderPane); - } + public ReportletParameterViewPane(UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { + this.initComponent(actions, useParaType, valueEditorPane, valueRenderPane); + } /** * 初始化组件 - * @param actions Chart的热点链接actions - * @param useParaType 类型 + * + * @param actions Chart的热点链接actions + * @param useParaType 类型 */ - public void initComponent(final UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - if (useParaType != ParameterTableModel.NO_CHART_USE) { - ParameterTableModel model = new ParameterTableModel(valueEditorPane, valueRenderPane, this) { - @Override - public UITableEditAction[] createAction() { - UITableEditAction[] tableEditActions = new UITableEditAction[] { new AddChartParameterAction(), new DeleteAction(this.component), - new MoveUpAction(), new MoveDownAction() }; - return (UITableEditAction[]) ArrayUtils.addAll(tableEditActions, actions); - } - }; - editorPane = new UITableEditorPane(model); - } else { - editorPane = new UITableEditorPane(new ParameterTableModel() { - @Override - public UITableEditAction[] createAction() { - return (UITableEditAction[]) ArrayUtils.addAll(super.createAction(), actions); - } - }); - } - - this.add(editorPane, BorderLayout.CENTER); - } + public void initComponent(final UITableEditAction[] actions, int useParaType, ValueEditorPane valueEditorPane, ValueEditorPane valueRenderPane) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + if (useParaType != ParameterTableModel.NO_CHART_USE) { + ParameterTableModel model = new ParameterTableModel(valueEditorPane, valueRenderPane, this) { + @Override + public UITableEditAction[] createAction() { + UITableEditAction[] tableEditActions = new UITableEditAction[]{new AddChartParameterAction(), new DeleteAction(this.component), + new MoveUpAction(), new MoveDownAction()}; + return (UITableEditAction[]) ArrayUtils.addAll(tableEditActions, actions); + } + }; + editorPane = new UITableEditorPane(model); + } else { + editorPane = new UITableEditorPane(new ParameterTableModel() { + @Override + public UITableEditAction[] createAction() { + return (UITableEditAction[]) ArrayUtils.addAll(super.createAction(), actions); + } + }); + } + + this.add(editorPane, BorderLayout.CENTER); + } /** * 增加事件监听 - * @param l 加的东东 + * + * @param l 加的东东 */ - public void addTableEditorListener(TableModelListener l) { - editorPane.addTableListener(l); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("Parameters"); - } - - public void populate(ParameterProvider[] parameters) { - if (parameters == null) { - return; - } - editorPane.populate(parameters); - } - - public void populate(KV[] kv) { - if (kv == null) { - return; - } - Parameter[] parameters = new Parameter[kv.length]; - for (int i = 0; i < kv.length; i++) { - parameters[i] = new Parameter(kv[i].getKey(), kv[i].getValue()); - } - this.populate(parameters); - } - - public List update() { - return editorPane.update(); - } + public void addTableEditorListener(TableModelListener l) { + editorPane.addTableListener(l); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("Parameters"); + } + + public void populate(ParameterProvider[] parameters) { + if (parameters == null) { + return; + } + editorPane.populate(parameters); + } + + public void populate(KV[] kv) { + if (kv == null) { + return; + } + Parameter[] parameters = new Parameter[kv.length]; + for (int i = 0; i < kv.length; i++) { + parameters[i] = new Parameter(kv[i].getKey(), kv[i].getValue()); + } + this.populate(parameters); + } + + public List update() { + return editorPane.update(); + } + + public void update(List list) { + editorPane.update(list); + } + /** * 更新 - * @return 数组 + * + * @return 数组 */ - public KV[] updateKV() { - List list = this.update(); - int length = list.size(); - KV[] kv = new KV[length]; - for (int i = 0; i < length; i++) { - kv[i] = new KV(); - kv[i].setKey(list.get(i).getName()); - kv[i].setValue( list.get(i).getValue()); - } - return kv; - } + public KV[] updateKV() { + List list = this.update(); + int length = list.size(); + KV[] kv = new KV[length]; + for (int i = 0; i < length; i++) { + kv[i] = new KV(); + kv[i].setKey(list.get(i).getName()); + kv[i].setValue(list.get(i).getValue()); + } + return kv; + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java index a8a72fc1e..80bbcbe0a 100644 --- a/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java +++ b/designer_base/src/com/fr/design/gui/frpane/TreeSettingPane.java @@ -52,6 +52,7 @@ public class TreeSettingPane extends BasicPane implements DataCreatorUI { private void initComponents(boolean isEditor) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel buildWayPanel= FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); + buildWayPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); UILabel buildWayLabel = new UILabel(Inter.getLocText("FR-Designer_Build-Way") + " :"); buildWayPanel.add(buildWayLabel); buildBox = new UIComboBox(buildWay); diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java index a44dde725..ddd9d4494 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -153,14 +153,13 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { } protected void initButton(UIToggleButton labelButton) { - labelButton.setRoundBorder(true); labelButton.setBorderPainted(false); labelButtonList.add(labelButton); this.add(labelButton); } protected Border getGroupBorder() { - return BorderFactory.createEmptyBorder(1, 1, 1, 1); + return BorderFactory.createEmptyBorder(0, 0, 0, 0); } protected LayoutManager getGridLayout(int number) { diff --git a/designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java b/designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java index a0c09a848..c75f231d3 100644 --- a/designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java +++ b/designer_base/src/com/fr/design/gui/itableeditorpane/UITableEditorPane.java @@ -1,12 +1,12 @@ package com.fr.design.gui.itableeditorpane; -import com.fr.design.constants.UIConstants; import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.dialog.BasicPane; import com.fr.general.Inter; import javax.swing.*; @@ -16,56 +16,56 @@ import java.util.List; /** * 表格编辑面板,一般是两列.键-值 用泛型实现,用的时候请定义T.model里面的T要一样 - * + * * @editor zhou * @since 2012-3-28下午3:06:30 */ public class UITableEditorPane extends BasicPane { - /** - * - */ - private static final long serialVersionUID = 6855793816972735815L; - private JTable editTable; - // 放置action 的按钮. - private UITableModelAdapter tableModel; - private String leftLabelName; + /** + * + */ + private static final long serialVersionUID = 6855793816972735815L; + private JTable editTable; + // 放置action 的按钮. + private UITableModelAdapter tableModel; + private String leftLabelName; private JPanel buttonPane; - public UITableEditorPane(UITableModelAdapter model) { - this.tableModel = model; - this.initComponent(model.createAction()); - } - - public UITableEditorPane(UITableModelAdapter model, String s) { - leftLabelName = s; - this.tableModel = model; - this.initComponent(model.createAction()); - } - - private void initComponent(UITableEditAction[] action) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel pane = new JPanel(new BorderLayout(4, 4)); - this.add(pane, BorderLayout.CENTER); - - UILabel l = new UILabel(leftLabelName); - editTable = tableModel.createTable(); - - UIScrollPane scrollPane = new UIScrollPane(editTable); - scrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); - pane.add(scrollPane, BorderLayout.CENTER); - initbuttonPane(action); - JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - controlPane.add(buttonPane, BorderLayout.EAST); - controlPane.add(l, BorderLayout.WEST); - pane.add(controlPane, BorderLayout.NORTH); - - } - - public UITableModelAdapter getTableModel(){ + public UITableEditorPane(UITableModelAdapter model) { + this.tableModel = model; + this.initComponent(model.createAction()); + } + + public UITableEditorPane(UITableModelAdapter model, String s) { + leftLabelName = s; + this.tableModel = model; + this.initComponent(model.createAction()); + } + + private void initComponent(UITableEditAction[] action) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel pane = new JPanel(new BorderLayout(4, 4)); + this.add(pane, BorderLayout.CENTER); + + UILabel l = new UILabel(leftLabelName); + editTable = tableModel.createTable(); + + UIScrollPane scrollPane = new UIScrollPane(editTable); + scrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); + pane.add(scrollPane, BorderLayout.CENTER); + initbuttonPane(action); + JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + controlPane.add(buttonPane, BorderLayout.EAST); + controlPane.add(l, BorderLayout.WEST); + pane.add(controlPane, BorderLayout.NORTH); + + } + + public UITableModelAdapter getTableModel() { return tableModel; } - private void initbuttonPane(UITableEditAction[] action){ + private void initbuttonPane(UITableEditAction[] action) { buttonPane = new JPanel(); if (action != null) { @@ -87,54 +87,61 @@ public class UITableEditorPane extends BasicPane { /** * 增加事件监听 - * @param l 加的东东 + * + * @param l 加的东东 */ - public void addTableListener(TableModelListener l) { - tableModel.addTableModelListener(l); - } + public void addTableListener(TableModelListener l) { + tableModel.addTableModelListener(l); + } /** * 移除事件监听 - * @param l 去的东东 + * + * @param l 去的东东 */ - public void removeTableListener(TableModelListener l) { - tableModel.removeTableModelListener(l); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("TableData_Dynamic_Parameter_Setting"); - } - - public void populate(T[] objs) { - tableModel.clear(); - if(objs==null){ - return; - } - for (T obj : objs) { - tableModel.addRow(obj); - } - this.tableModel.fireTableDataChanged(); - if (objs.length > 0) { - this.editTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - - // TODO:august这个最好还是返回数组 - public List update() { - tableModel.stopCellEditing(); - return tableModel.getList(); - } - - public int getSelectedRow() { - return this.editTable.getSelectedRow(); - } - - public int getSelectedColumn() { - return this.editTable.getSelectedColumn(); - } - - public JPanel getbuttonPane(){ + public void removeTableListener(TableModelListener l) { + tableModel.removeTableModelListener(l); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("TableData_Dynamic_Parameter_Setting"); + } + + public void populate(T[] objs) { + tableModel.clear(); + if (objs == null) { + return; + } + for (T obj : objs) { + tableModel.addRow(obj); + } + this.tableModel.fireTableDataChanged(); + if (objs.length > 0) { + this.editTable.getSelectionModel().setSelectionInterval(0, 0); + } + } + + // TODO:august这个最好还是返回数组 + public List update() { + tableModel.stopCellEditing(); + return tableModel.getList(); + } + + public void update(List list) { + tableModel.stopCellEditing(); + tableModel.setList(list); + } + + public int getSelectedRow() { + return this.editTable.getSelectedRow(); + } + + public int getSelectedColumn() { + return this.editTable.getSelectedColumn(); + } + + public JPanel getbuttonPane() { return buttonPane; } diff --git a/designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java b/designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java index 1a1633c0b..4ffc762e0 100644 --- a/designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java +++ b/designer_base/src/com/fr/design/gui/itree/refreshabletree/TreeRootPane.java @@ -9,7 +9,6 @@ import javax.swing.JPanel; import com.fr.data.impl.TreeAttr; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicPane; import com.fr.general.Inter; @@ -18,10 +17,10 @@ public class TreeRootPane extends BasicPane { // 是否支持多选(checkBoxTree) //private JCheckBox multipleSelection; - private UIComboBox checkTypeComboBox; + private UICheckBox checkTypeCheckBox; // richer:加载的方式,支持异步加载和完全加载 - private UIComboBox loadTypeComboBox; + private UICheckBox loadTypeCheckBox; private UICheckBox layerTypeCheckBox; @@ -30,31 +29,26 @@ public class TreeRootPane extends BasicPane { public TreeRootPane() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - JPanel checkTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - checkTypePane.add(new UILabel(Inter.getLocText("Tree-Mutiple_Selection_Or_Not") + ":")); - checkTypeComboBox = new UIComboBox(new String[] {Inter.getLocText("Yes"), Inter.getLocText("No")}); - checkTypePane.add(checkTypeComboBox); + JPanel checkTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + checkTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Mutiple_Selection_Or_Not")); + checkTypePane.add(checkTypeCheckBox); this.add(checkTypePane); - JPanel loadTypePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - loadTypePane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - loadTypePane.add(new UILabel(Inter.getLocText("Widget-Load_Type") + ":")); - loadTypeComboBox = new UIComboBox(new String[]{Inter.getLocText("Widget-Load_By_Async"), Inter.getLocText("Widget-Load_By_Complete")}); - loadTypePane.add(loadTypeComboBox); + JPanel loadTypePane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + loadTypeCheckBox = new UICheckBox(Inter.getLocText("Widget-Load_By_Async")); + loadTypePane.add(loadTypeCheckBox); this.add(loadTypePane); - JPanel leafSelectPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - leafSelectPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + JPanel leafSelectPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); leafSelectPane.add(layerTypeCheckBox = new UICheckBox(Inter.getLocText("Tree-Select_Leaf_Only"))); - UILabel tips = new UILabel(Inter.getLocText("Tree-Select_Leaf_Only_Tips")); - tips.setForeground(new Color(147, 178, 233)); - leafSelectPane.add(tips); this.add(leafSelectPane); - JPanel returnFullPathPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - returnFullPathPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(Inter.getLocText("Tree-Return_Full_Path"))); + JPanel returnFullPathPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane_First0(); + checkTypePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + returnFullPathPane.add(returnFullPathCheckBox = new UICheckBox(Inter.getLocText("Tree-Return_Full_Path"))); this.add(returnFullPathPane); } @@ -65,16 +59,16 @@ public class TreeRootPane extends BasicPane { } public void populate(TreeAttr treeAttr) { - checkTypeComboBox.setSelectedIndex(treeAttr.isMultipleSelection() ? 0 : 1); - loadTypeComboBox.setSelectedIndex(treeAttr.isAjax() ? 0 : 1); + checkTypeCheckBox.setSelected(treeAttr.isMultipleSelection()); + loadTypeCheckBox.setSelected(treeAttr.isAjax()); layerTypeCheckBox.setSelected(treeAttr.isSelectLeafOnly()); returnFullPathCheckBox.setSelected(treeAttr.isReturnFullPath()); } public TreeAttr update() { TreeAttr treeAttr = new TreeAttr(); - treeAttr.setMultipleSelection(checkTypeComboBox.getSelectedIndex() == 0); - treeAttr.setAjax(loadTypeComboBox.getSelectedIndex() == 0); + treeAttr.setMultipleSelection(checkTypeCheckBox.isSelected()); + treeAttr.setAjax(loadTypeCheckBox.isSelected()); treeAttr.setSelectLeafOnly(layerTypeCheckBox.isSelected()); treeAttr.setReturnFullPath(returnFullPathCheckBox.isSelected()); diff --git a/designer_base/src/com/fr/design/images/arrow/arrow_down.png b/designer_base/src/com/fr/design/images/arrow/arrow_down.png index f044ad4c1..ac8c42394 100644 Binary files a/designer_base/src/com/fr/design/images/arrow/arrow_down.png and b/designer_base/src/com/fr/design/images/arrow/arrow_down.png differ diff --git a/designer_base/src/com/fr/design/images/arrow/arrow_up.png b/designer_base/src/com/fr/design/images/arrow/arrow_up.png index a613a4e7b..283ad88f5 100644 Binary files a/designer_base/src/com/fr/design/images/arrow/arrow_up.png and b/designer_base/src/com/fr/design/images/arrow/arrow_up.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/add.png b/designer_base/src/com/fr/design/images/buttonicon/add.png index 98cde552d..432fe208a 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/add.png and b/designer_base/src/com/fr/design/images/buttonicon/add.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/add_press.png b/designer_base/src/com/fr/design/images/buttonicon/add_press.png index f0921e442..f3268f9b6 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/add_press.png and b/designer_base/src/com/fr/design/images/buttonicon/add_press.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/addicon.png b/designer_base/src/com/fr/design/images/buttonicon/addicon.png index d12f1faf5..bd90eb7c1 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/addicon.png and b/designer_base/src/com/fr/design/images/buttonicon/addicon.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/cube.png b/designer_base/src/com/fr/design/images/buttonicon/cube.png index 23d27849c..ee024f10e 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/cube.png and b/designer_base/src/com/fr/design/images/buttonicon/cube.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/editp.png b/designer_base/src/com/fr/design/images/buttonicon/editp.png index 16b59563c..fd1cde458 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/editp.png and b/designer_base/src/com/fr/design/images/buttonicon/editp.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/hiden.png b/designer_base/src/com/fr/design/images/buttonicon/hiden.png index d75cff80e..ea0030304 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/hiden.png and b/designer_base/src/com/fr/design/images/buttonicon/hiden.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/hidep.png b/designer_base/src/com/fr/design/images/buttonicon/hidep.png index 6e5b72b34..a40f9db9c 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/hidep.png and b/designer_base/src/com/fr/design/images/buttonicon/hidep.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/minus.png b/designer_base/src/com/fr/design/images/buttonicon/minus.png index bc68e3a8c..569e99849 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/minus.png and b/designer_base/src/com/fr/design/images/buttonicon/minus.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/newcpts.png b/designer_base/src/com/fr/design/images/buttonicon/newcpts.png index 4b28f291e..0a68f6c88 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/newcpts.png and b/designer_base/src/com/fr/design/images/buttonicon/newcpts.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/open.png b/designer_base/src/com/fr/design/images/buttonicon/open.png index 369c79356..ed92604ca 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/open.png and b/designer_base/src/com/fr/design/images/buttonicon/open.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/pageb24.png b/designer_base/src/com/fr/design/images/buttonicon/pageb24.png index 33c1a4bf4..67127219d 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/pageb24.png and b/designer_base/src/com/fr/design/images/buttonicon/pageb24.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/pages.png b/designer_base/src/com/fr/design/images/buttonicon/pages.png index c54f9ca9c..bf91c74a0 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/pages.png and b/designer_base/src/com/fr/design/images/buttonicon/pages.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/plus.png b/designer_base/src/com/fr/design/images/buttonicon/plus.png index e864ca822..dd5800914 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/plus.png and b/designer_base/src/com/fr/design/images/buttonicon/plus.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/redo.png b/designer_base/src/com/fr/design/images/buttonicon/redo.png index 12be726de..f6b77b4f4 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/redo.png and b/designer_base/src/com/fr/design/images/buttonicon/redo.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/refresh.png b/designer_base/src/com/fr/design/images/buttonicon/refresh.png index c635fb8d5..37df06647 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/refresh.png and b/designer_base/src/com/fr/design/images/buttonicon/refresh.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/run24.png b/designer_base/src/com/fr/design/images/buttonicon/run24.png index ebdac1d62..8628e02a6 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/run24.png and b/designer_base/src/com/fr/design/images/buttonicon/run24.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/undo.png b/designer_base/src/com/fr/design/images/buttonicon/undo.png index 509ddb3a8..f86a17441 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/undo.png and b/designer_base/src/com/fr/design/images/buttonicon/undo.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/writeb24.png b/designer_base/src/com/fr/design/images/buttonicon/writeb24.png index 5fdbb0eac..92e344383 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/writeb24.png and b/designer_base/src/com/fr/design/images/buttonicon/writeb24.png differ diff --git a/designer_base/src/com/fr/design/images/buttonicon/writes.png b/designer_base/src/com/fr/design/images/buttonicon/writes.png index 72a099299..16ea8e50a 100644 Binary files a/designer_base/src/com/fr/design/images/buttonicon/writes.png and b/designer_base/src/com/fr/design/images/buttonicon/writes.png differ diff --git a/designer_base/src/com/fr/design/images/chart/ChartStyle.png b/designer_base/src/com/fr/design/images/chart/ChartStyle.png index 129c25335..3d1e6d7e4 100644 Binary files a/designer_base/src/com/fr/design/images/chart/ChartStyle.png and b/designer_base/src/com/fr/design/images/chart/ChartStyle.png differ diff --git a/designer_base/src/com/fr/design/images/chart/ChartType.png b/designer_base/src/com/fr/design/images/chart/ChartType.png index ef9987a8d..504ca9484 100644 Binary files a/designer_base/src/com/fr/design/images/chart/ChartType.png and b/designer_base/src/com/fr/design/images/chart/ChartType.png differ diff --git a/designer_base/src/com/fr/design/images/chart/InterAttr.png b/designer_base/src/com/fr/design/images/chart/InterAttr.png index 827f83db5..eda00984c 100644 Binary files a/designer_base/src/com/fr/design/images/chart/InterAttr.png and b/designer_base/src/com/fr/design/images/chart/InterAttr.png differ diff --git a/designer_base/src/com/fr/design/images/control/addPopup.png b/designer_base/src/com/fr/design/images/control/addPopup.png index c337d8c64..db3368e36 100644 Binary files a/designer_base/src/com/fr/design/images/control/addPopup.png and b/designer_base/src/com/fr/design/images/control/addPopup.png differ diff --git a/designer_base/src/com/fr/design/images/control/bar.png b/designer_base/src/com/fr/design/images/control/bar.png index 958fe20ad..d31ce0129 100644 Binary files a/designer_base/src/com/fr/design/images/control/bar.png and b/designer_base/src/com/fr/design/images/control/bar.png differ diff --git a/designer_base/src/com/fr/design/images/control/copy.png b/designer_base/src/com/fr/design/images/control/copy.png index b70fd4bb0..4d93d0ee5 100644 Binary files a/designer_base/src/com/fr/design/images/control/copy.png and b/designer_base/src/com/fr/design/images/control/copy.png differ diff --git a/designer_base/src/com/fr/design/images/control/edit.png b/designer_base/src/com/fr/design/images/control/edit.png index 3ce387e78..7491cb9c2 100644 Binary files a/designer_base/src/com/fr/design/images/control/edit.png and b/designer_base/src/com/fr/design/images/control/edit.png differ diff --git a/designer_base/src/com/fr/design/images/control/remove.png b/designer_base/src/com/fr/design/images/control/remove.png index 3142c589d..5c889b8ba 100644 Binary files a/designer_base/src/com/fr/design/images/control/remove.png and b/designer_base/src/com/fr/design/images/control/remove.png differ diff --git a/designer_base/src/com/fr/design/images/dashboard/files.png b/designer_base/src/com/fr/design/images/dashboard/files.png index 4d07d8d4a..69d482a36 100644 Binary files a/designer_base/src/com/fr/design/images/dashboard/files.png and b/designer_base/src/com/fr/design/images/dashboard/files.png differ diff --git a/designer_base/src/com/fr/design/images/data/bind/distanceconnect.png b/designer_base/src/com/fr/design/images/data/bind/distanceconnect.png index d8e26b227..2ec210d20 100644 Binary files a/designer_base/src/com/fr/design/images/data/bind/distanceconnect.png and b/designer_base/src/com/fr/design/images/data/bind/distanceconnect.png differ diff --git a/designer_base/src/com/fr/design/images/data/bind/localconnect.png b/designer_base/src/com/fr/design/images/data/bind/localconnect.png index 369f5d9b9..d8134eca7 100644 Binary files a/designer_base/src/com/fr/design/images/data/bind/localconnect.png and b/designer_base/src/com/fr/design/images/data/bind/localconnect.png differ diff --git a/designer_base/src/com/fr/design/images/data/dataDictionary.png b/designer_base/src/com/fr/design/images/data/dataDictionary.png index 2f0fc8c87..516d368b2 100644 Binary files a/designer_base/src/com/fr/design/images/data/dataDictionary.png and b/designer_base/src/com/fr/design/images/data/dataDictionary.png differ diff --git a/designer_base/src/com/fr/design/images/data/dataTable.png b/designer_base/src/com/fr/design/images/data/dataTable.png index 0a17322a8..1517e0d6d 100644 Binary files a/designer_base/src/com/fr/design/images/data/dataTable.png and b/designer_base/src/com/fr/design/images/data/dataTable.png differ diff --git a/designer_base/src/com/fr/design/images/data/dock/serverdatabase.png b/designer_base/src/com/fr/design/images/data/dock/serverdatabase.png index 93593ecad..1ca875ba1 100644 Binary files a/designer_base/src/com/fr/design/images/data/dock/serverdatabase.png and b/designer_base/src/com/fr/design/images/data/dock/serverdatabase.png differ diff --git a/designer_base/src/com/fr/design/images/data/multi.png b/designer_base/src/com/fr/design/images/data/multi.png index ca55ee911..8242a9e3b 100644 Binary files a/designer_base/src/com/fr/design/images/data/multi.png and b/designer_base/src/com/fr/design/images/data/multi.png differ diff --git a/designer_base/src/com/fr/design/images/data/source/rename.png b/designer_base/src/com/fr/design/images/data/source/rename.png index 8422b4f93..5c244dd5d 100644 Binary files a/designer_base/src/com/fr/design/images/data/source/rename.png and b/designer_base/src/com/fr/design/images/data/source/rename.png differ diff --git a/designer_base/src/com/fr/design/images/file/fold.png b/designer_base/src/com/fr/design/images/file/fold.png index da58e790d..69d482a36 100644 Binary files a/designer_base/src/com/fr/design/images/file/fold.png and b/designer_base/src/com/fr/design/images/file/fold.png differ diff --git a/designer_base/src/com/fr/design/images/file/newfolder.png b/designer_base/src/com/fr/design/images/file/newfolder.png index 1fc3b2afa..259064881 100644 Binary files a/designer_base/src/com/fr/design/images/file/newfolder.png and b/designer_base/src/com/fr/design/images/file/newfolder.png differ diff --git a/designer_base/src/com/fr/design/images/form/toolbar/ec_frozen.png b/designer_base/src/com/fr/design/images/form/toolbar/ec_frozen.png index d1b29e469..bae5ddaea 100644 Binary files a/designer_base/src/com/fr/design/images/form/toolbar/ec_frozen.png and b/designer_base/src/com/fr/design/images/form/toolbar/ec_frozen.png differ diff --git a/designer_base/src/com/fr/design/images/gui/color/background.png b/designer_base/src/com/fr/design/images/gui/color/background.png index 0dc9491c3..c56264534 100644 Binary files a/designer_base/src/com/fr/design/images/gui/color/background.png and b/designer_base/src/com/fr/design/images/gui/color/background.png differ diff --git a/designer_base/src/com/fr/design/images/lookandfeel/ErrorIcon.png b/designer_base/src/com/fr/design/images/lookandfeel/ErrorIcon.png index 8404e7203..ff0450a5a 100644 Binary files a/designer_base/src/com/fr/design/images/lookandfeel/ErrorIcon.png and b/designer_base/src/com/fr/design/images/lookandfeel/ErrorIcon.png differ diff --git a/designer_base/src/com/fr/design/images/lookandfeel/InformationIcon.png b/designer_base/src/com/fr/design/images/lookandfeel/InformationIcon.png index a81f92580..480c829ed 100644 Binary files a/designer_base/src/com/fr/design/images/lookandfeel/InformationIcon.png and b/designer_base/src/com/fr/design/images/lookandfeel/InformationIcon.png differ diff --git a/designer_base/src/com/fr/design/images/lookandfeel/QuestionIcon.png b/designer_base/src/com/fr/design/images/lookandfeel/QuestionIcon.png index 2ca3e141b..7fe24c088 100644 Binary files a/designer_base/src/com/fr/design/images/lookandfeel/QuestionIcon.png and b/designer_base/src/com/fr/design/images/lookandfeel/QuestionIcon.png differ diff --git a/designer_base/src/com/fr/design/images/lookandfeel/TreeFolderOpenedIcon.png b/designer_base/src/com/fr/design/images/lookandfeel/TreeFolderOpenedIcon.png index 4281dc887..ed92604ca 100644 Binary files a/designer_base/src/com/fr/design/images/lookandfeel/TreeFolderOpenedIcon.png and b/designer_base/src/com/fr/design/images/lookandfeel/TreeFolderOpenedIcon.png differ diff --git a/designer_base/src/com/fr/design/images/lookandfeel/WarningIcon.png b/designer_base/src/com/fr/design/images/lookandfeel/WarningIcon.png index 35e3e50f6..155b296e6 100644 Binary files a/designer_base/src/com/fr/design/images/lookandfeel/WarningIcon.png and b/designer_base/src/com/fr/design/images/lookandfeel/WarningIcon.png differ diff --git a/designer_base/src/com/fr/design/images/m_edit/copy.png b/designer_base/src/com/fr/design/images/m_edit/copy.png index caf8872b8..4d93d0ee5 100644 Binary files a/designer_base/src/com/fr/design/images/m_edit/copy.png and b/designer_base/src/com/fr/design/images/m_edit/copy.png differ diff --git a/designer_base/src/com/fr/design/images/m_edit/cut.png b/designer_base/src/com/fr/design/images/m_edit/cut.png index 527cc0d48..dded7fd3e 100644 Binary files a/designer_base/src/com/fr/design/images/m_edit/cut.png and b/designer_base/src/com/fr/design/images/m_edit/cut.png differ diff --git a/designer_base/src/com/fr/design/images/m_edit/formatBrush.png b/designer_base/src/com/fr/design/images/m_edit/formatBrush.png index df49c5049..c821df52b 100644 Binary files a/designer_base/src/com/fr/design/images/m_edit/formatBrush.png and b/designer_base/src/com/fr/design/images/m_edit/formatBrush.png differ diff --git a/designer_base/src/com/fr/design/images/m_edit/merge.png b/designer_base/src/com/fr/design/images/m_edit/merge.png index 84471ef04..5924dc1e0 100644 Binary files a/designer_base/src/com/fr/design/images/m_edit/merge.png and b/designer_base/src/com/fr/design/images/m_edit/merge.png differ diff --git a/designer_base/src/com/fr/design/images/m_edit/unmerge.png b/designer_base/src/com/fr/design/images/m_edit/unmerge.png index b7b572127..43423aee1 100644 Binary files a/designer_base/src/com/fr/design/images/m_edit/unmerge.png and b/designer_base/src/com/fr/design/images/m_edit/unmerge.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/formExport.png b/designer_base/src/com/fr/design/images/m_file/formExport.png index 42c232cee..b513d073b 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/formExport.png and b/designer_base/src/com/fr/design/images/m_file/formExport.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/pdf.png b/designer_base/src/com/fr/design/images/m_file/pdf.png index 7e0bf68a5..e5b6709ed 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/pdf.png and b/designer_base/src/com/fr/design/images/m_file/pdf.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/preview.png b/designer_base/src/com/fr/design/images/m_file/preview.png index 6a8716334..8628e02a6 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/preview.png and b/designer_base/src/com/fr/design/images/m_file/preview.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/saveAs.png b/designer_base/src/com/fr/design/images/m_file/saveAs.png index a2ef8d600..fd2303d24 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/saveAs.png and b/designer_base/src/com/fr/design/images/m_file/saveAs.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/switch.png b/designer_base/src/com/fr/design/images/m_file/switch.png index e2ae481e0..cbf7cfb99 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/switch.png and b/designer_base/src/com/fr/design/images/m_file/switch.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/text.png b/designer_base/src/com/fr/design/images/m_file/text.png index e1895978c..900a6de0c 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/text.png and b/designer_base/src/com/fr/design/images/m_file/text.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/view_folder.png b/designer_base/src/com/fr/design/images/m_file/view_folder.png index 562854c84..4d16dc7ae 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/view_folder.png and b/designer_base/src/com/fr/design/images/m_file/view_folder.png differ diff --git a/designer_base/src/com/fr/design/images/m_file/word.png b/designer_base/src/com/fr/design/images/m_file/word.png index b5f2534a9..62bc3aff4 100644 Binary files a/designer_base/src/com/fr/design/images/m_file/word.png and b/designer_base/src/com/fr/design/images/m_file/word.png differ diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/bold.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/bold.png index dc86e5ae9..676d46128 100644 Binary files a/designer_base/src/com/fr/design/images/m_format/cellstyle/bold.png and b/designer_base/src/com/fr/design/images/m_format/cellstyle/bold.png differ diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/italic.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/italic.png index d4088b579..6b36a5c1a 100644 Binary files a/designer_base/src/com/fr/design/images/m_format/cellstyle/italic.png and b/designer_base/src/com/fr/design/images/m_format/cellstyle/italic.png differ diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/otherset.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/otherset.png index cdef0467c..5cd5db716 100644 Binary files a/designer_base/src/com/fr/design/images/m_format/cellstyle/otherset.png and b/designer_base/src/com/fr/design/images/m_format/cellstyle/otherset.png differ diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/underline.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/underline.png index 3e4426448..47caa60e3 100644 Binary files a/designer_base/src/com/fr/design/images/m_format/cellstyle/underline.png and b/designer_base/src/com/fr/design/images/m_format/cellstyle/underline.png differ diff --git a/designer_base/src/com/fr/design/images/m_format/highlight.png b/designer_base/src/com/fr/design/images/m_format/highlight.png index 3aee9dd98..7491cb9c2 100644 Binary files a/designer_base/src/com/fr/design/images/m_format/highlight.png and b/designer_base/src/com/fr/design/images/m_format/highlight.png differ diff --git a/designer_base/src/com/fr/design/images/m_format/modified.png b/designer_base/src/com/fr/design/images/m_format/modified.png index 53ff9b6cc..160e737a2 100644 Binary files a/designer_base/src/com/fr/design/images/m_format/modified.png and b/designer_base/src/com/fr/design/images/m_format/modified.png differ diff --git a/designer_base/src/com/fr/design/images/m_help/demo.png b/designer_base/src/com/fr/design/images/m_help/demo.png index c60877fe6..6e34e21be 100644 Binary files a/designer_base/src/com/fr/design/images/m_help/demo.png and b/designer_base/src/com/fr/design/images/m_help/demo.png differ diff --git a/designer_base/src/com/fr/design/images/m_help/feedback.png b/designer_base/src/com/fr/design/images/m_help/feedback.png index 2b02f585b..7a195fd4e 100644 Binary files a/designer_base/src/com/fr/design/images/m_help/feedback.png and b/designer_base/src/com/fr/design/images/m_help/feedback.png differ diff --git a/designer_base/src/com/fr/design/images/m_help/help.png b/designer_base/src/com/fr/design/images/m_help/help.png index c70b6b77d..e50a5b70c 100644 Binary files a/designer_base/src/com/fr/design/images/m_help/help.png and b/designer_base/src/com/fr/design/images/m_help/help.png differ diff --git a/designer_base/src/com/fr/design/images/m_help/product_forum.png b/designer_base/src/com/fr/design/images/m_help/product_forum.png index 50e96bb87..76e2116c6 100644 Binary files a/designer_base/src/com/fr/design/images/m_help/product_forum.png and b/designer_base/src/com/fr/design/images/m_help/product_forum.png differ diff --git a/designer_base/src/com/fr/design/images/m_insert/cell.png b/designer_base/src/com/fr/design/images/m_insert/cell.png index 754080148..22fb4eb68 100644 Binary files a/designer_base/src/com/fr/design/images/m_insert/cell.png and b/designer_base/src/com/fr/design/images/m_insert/cell.png differ diff --git a/designer_base/src/com/fr/design/images/m_insert/chart.png b/designer_base/src/com/fr/design/images/m_insert/chart.png index f65529fc2..504ca9484 100644 Binary files a/designer_base/src/com/fr/design/images/m_insert/chart.png and b/designer_base/src/com/fr/design/images/m_insert/chart.png differ diff --git a/designer_base/src/com/fr/design/images/m_insert/insertColumn.png b/designer_base/src/com/fr/design/images/m_insert/insertColumn.png index e625c25dd..c32da612b 100644 Binary files a/designer_base/src/com/fr/design/images/m_insert/insertColumn.png and b/designer_base/src/com/fr/design/images/m_insert/insertColumn.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/background.png b/designer_base/src/com/fr/design/images/m_report/background.png index 1a5e53368..cc19990d3 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/background.png and b/designer_base/src/com/fr/design/images/m_report/background.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/close.png b/designer_base/src/com/fr/design/images/m_report/close.png index 5d7c014fa..2b4e8a3a7 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/close.png and b/designer_base/src/com/fr/design/images/m_report/close.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/close_over.png b/designer_base/src/com/fr/design/images/m_report/close_over.png index 728a46dbc..149ca323a 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/close_over.png and b/designer_base/src/com/fr/design/images/m_report/close_over.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/close_press.png b/designer_base/src/com/fr/design/images/m_report/close_press.png index b3dd9dbdc..a75cff254 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/close_press.png and b/designer_base/src/com/fr/design/images/m_report/close_press.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/footer.png b/designer_base/src/com/fr/design/images/m_report/footer.png index 39c7e0dc0..843c8bc59 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/footer.png and b/designer_base/src/com/fr/design/images/m_report/footer.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/header.png b/designer_base/src/com/fr/design/images/m_report/header.png index 00d095eca..e7961cd4e 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/header.png and b/designer_base/src/com/fr/design/images/m_report/header.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/linearAttr.png b/designer_base/src/com/fr/design/images/m_report/linearAttr.png index ce8ea71ee..b6398ea11 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/linearAttr.png and b/designer_base/src/com/fr/design/images/m_report/linearAttr.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/reportWriteAttr.png b/designer_base/src/com/fr/design/images/m_report/reportWriteAttr.png index c81fb8e76..99d321e67 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/reportWriteAttr.png and b/designer_base/src/com/fr/design/images/m_report/reportWriteAttr.png differ diff --git a/designer_base/src/com/fr/design/images/m_report/webreportattribute.png b/designer_base/src/com/fr/design/images/m_report/webreportattribute.png index 3a0129cad..1e29591c0 100644 Binary files a/designer_base/src/com/fr/design/images/m_report/webreportattribute.png and b/designer_base/src/com/fr/design/images/m_report/webreportattribute.png differ diff --git a/designer_base/src/com/fr/design/images/m_web/cache.png b/designer_base/src/com/fr/design/images/m_web/cache.png index 85b9d9ee4..9e766b10d 100644 Binary files a/designer_base/src/com/fr/design/images/m_web/cache.png and b/designer_base/src/com/fr/design/images/m_web/cache.png differ diff --git a/designer_base/src/com/fr/design/images/server/plugin.png b/designer_base/src/com/fr/design/images/server/plugin.png index fe80282ed..290ce7a19 100644 Binary files a/designer_base/src/com/fr/design/images/server/plugin.png and b/designer_base/src/com/fr/design/images/server/plugin.png differ diff --git a/designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java b/designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java index 00fde425f..e71334430 100644 --- a/designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java +++ b/designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java @@ -1,456 +1,510 @@ package com.fr.design.layout; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.FlowLayout; -import java.awt.LayoutManager; - -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.Icon; +import com.fr.design.border.UITitledBorder; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import com.fr.design.border.UITitledBorder; +import javax.swing.*; +import java.awt.*; public class FRGUIPaneFactory { - private FRGUIPaneFactory() { - } - public static final float WIDTH_PARA_F = 80.0f; - public static final int WIDTH_OFFSET_N = 60; - public static final int WIDTH_OFFSET_M = 20; - public static final int WIDTH_PARA_INT = 80; - public static final float WIDTHABS_PARA_F = 2.0f; - public static final int HEIGHT_PARA = 25; - public static final int HEIGHT_OFFSET = 50; + private FRGUIPaneFactory() { + } + + public static final float WIDTH_PARA_F = 80.0f; + public static final int WIDTH_OFFSET_N = 60; + public static final int WIDTH_OFFSET_M = 20; + public static final int WIDTH_PARA_INT = 80; + public static final float WIDTHABS_PARA_F = 2.0f; + public static final int HEIGHT_PARA = 25; + public static final int HEIGHT_OFFSET = 50; /** * 创建一个靠右靠左的水平间隙为2的流式布局 + * * @return FlowLayout对象 */ - public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多 - return new FlowLayout(FlowLayout.LEFT, 2, 0); - } + public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多 + return new FlowLayout(FlowLayout.LEFT, 2, 0); + } - /** - * 创建一个靠左的布局 - * @return FlowLayout对象 - */ - public static LayoutManager createLeftZeroLayout() { - return new FlowLayout(FlowLayout.LEFT, 0, 0); - } + /** + * 创建一个靠左的布局 + * + * @return FlowLayout对象 + */ + public static LayoutManager createLeftZeroLayout() { + return new FlowLayout(FlowLayout.LEFT, 0, 0); + } /** * 创建一个靠左的水平和垂直间隙均为5的流式布局 + * * @return FlowLayout对象 */ - public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout - return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5 - } - - /** - * 创建一个靠左流式布局,间距10,10 - * @return FlowLayout对象 - */ - public static LayoutManager createL_FlowLayout() { - return new FlowLayout(FlowLayout.LEFT, 10, 10); - } - - /** - * 创建一个居中流式布局 - * @return FlowLayout对象 - */ - public static LayoutManager createCenterFlowLayout() { - return new FlowLayout(FlowLayout.CENTER); - } - - /** - * 创建一个靠右流式布局 - * @return FlowLayout对象 - */ - public static LayoutManager createRightFlowLayout() { - return new FlowLayout(FlowLayout.RIGHT); - } - - /** - * 创建一个边框布局 - * @return BorderLayout对象 - */ - public static LayoutManager createBorderLayout() { - return new BorderLayout(); - } - - /** - * 创建一个边框布局,间距4,4 - * @return BorderLayout对象 - */ - public static LayoutManager createM_BorderLayout() { - return new BorderLayout(4,4); - } - - // TODO 删掉 - - /** - * 创建一个1列的网格布局 - * @return FRGridLayout对象 - */ - public static LayoutManager create1ColumnGridLayout() { - return new FRGridLayout(1); - } - - /** - * 创建一个2列的网格布局 - * @return FRGridLayout对象 - */ - public static LayoutManager create2ColumnGridLayout() { - return new FRGridLayout(2); - } - - /** - * 创建一个n列的网格布局 - * @param nColumn 列数 - * @return FRGridLayout对象 - */ - public static LayoutManager createNColumnGridLayout(int nColumn) { - return new FRGridLayout(nColumn); - } - - /** - * 创建一个带标题边框面板 - * @param string 边框标题 - * @return JPanel对象 - */ - public static JPanel createTitledBorderPane(String string) { - JPanel jp = new JPanel(); - UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); - jp.setBorder(explainBorder); - jp.setLayout(new FlowLayout(FlowLayout.LEFT)); - return jp; - } - - /** - * 创建一个带标题边框面板并且居中显示 - * @param borderTitle 边框标题 - * @return JPanel对象 - */ - public static JPanel createTitledBorderPaneCenter(String borderTitle) { - JPanel jp = new JPanel(); - UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); - jp.setBorder(explainBorder); - jp.setLayout(new FlowLayout(FlowLayout.CENTER)); - return jp; - } - - /** - * 创建一个靠左空边框布局,间隔大 - * @return JPanel对象 - */ - public static JPanel createBigHGapFlowInnerContainer_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); - return jp; - } - - /** - * 创建一个靠左空边框面板,间隔中等 - * @return JPanel对象 - */ - public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); - return jp; - } - - /** - * 创建一个靠左空边框面板,间隔中等 - * @return JPanel对象 - */ - public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); - jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); - return jp; - } - - /** - * 创建一个正常靠左空边框面板 - * @return JPanel对象 - */ - public static JPanel createNormalFlowInnerContainer_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - jp.setLayout(new FlowLayout(FlowLayout.LEFT)); - return jp; - } - - /** - * 创建一个靠左0间距边框面板 - * @return JPanel对象 - */ - public static JPanel createLeftFlowZeroGapBorderPane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); - return jp; - } - - /** - * 创建一个靠左流式布局,正常流式内嵌 - * @return JPanel对象 - */ - public static JPanel createNormalFlowInnerContainer_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.LEFT)); - return jp; - } - - /** - * 创建一个靠左流式布局,流式内嵌 - * @return JPanel对象 - */ - public static JPanel createBoxFlowInnerContainer_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); - return jp; - } - - /** - * 创建一个靠右面板 - * @return JPanel对象 - */ - public static JPanel createRightFlowInnerContainer_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); - return jp; - } - - /** - * 创建一个居中面板 - * @return JPanel对象 - */ - public static JPanel createCenterFlowInnerContainer_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.CENTER)); - return jp; - } - - /** - * 创建一个居中0间距面板 - * @return JPanel对象 - */ - public static JPanel createCenterFlowZeroGapBorderPane() { - JPanel jp = new JPanel(); - jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); - jp.setBorder(BorderFactory.createEmptyBorder()); - return jp; - } - - /** - * 创建纵向排列面板 - * @return JPanel对象 - */ - public static JPanel createY_AXISBoxInnerContainer_L_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); - return jp; - } - - /** - * 创建纵向边框面板 - * @return JPanel对象 - */ - public static JPanel createYBoxEmptyBorderPane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); - return jp; - } - - /** - * 创建横向面板 - * @return JPanel对象 - */ - public static JPanel createX_AXISBoxInnerContainer_L_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); - return jp; - } - - /** - * 创建纵向面板M - * @return JPanel对象 - */ - public static JPanel createY_AXISBoxInnerContainer_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); - return jp; - } - - /** - * 创建横向内置boxlayout的面板 - * @return JPanel对象 - */ - public static JPanel createX_AXISBoxInnerContainer_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); - return jp; - } - - /** - * 创建纵向内置boxlayout的面板 - * @return JPanel对象 - */ - public static JPanel createY_AXISBoxInnerContainer_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); - return jp; - } - - /** - * 创建横向内置boxlayout的面板 - * @return JPanel对象 - */ - public static JPanel createX_AXISBoxInnerContainer_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); - return jp; - } - - /** - * 创建n列网格面板 - * @param nColumn 列数 - * @return JPanel对象 - */ - public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { - JPanel jp = new JPanel(); - jp.setLayout(new FRGridLayout(nColumn)); - return jp; - } - - /** - * 创建n列网格面板 - * @param nColumn 列数 - * @param h 水平间距 - * @param v 垂直间距 - * @return JPanel对象 - */ - public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { - JPanel jp = new JPanel(); - jp.setLayout(new FRGridLayout(nColumn, h, v)); - return jp; - } - - /** - * 创建顶格n列网格面板 - * @param nColumn 列数 - * @return JPanel对象 - */ - public static JPanel createFillColumnPane(int nColumn) { - JPanel jp = new JPanel(); - jp.setLayout(new FRGridLayout(nColumn, 0, 0)); - return jp; - } - - /** - * 创建边框面板L - * @return JPanel对象 - */ - public static JPanel createBorderLayout_L_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - jp.setLayout(FRGUIPaneFactory.createBorderLayout()); - return jp; - } - - /** - * 创建边框面板M - * @return JPanel对象 - */ - public static JPanel createBorderLayout_M_Pane() { - JPanel jp = new JPanel(); - jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); - return jp; - } - - /** - * 创建边框面板S - * @return JPanel对象 - */ - public static JPanel createBorderLayout_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(FRGUIPaneFactory.createBorderLayout()); - return jp; - } - - /** - * 创建卡片式布局 - * @return JPanel对象 - */ - public static JPanel createCardLayout_S_Pane() { - JPanel jp = new JPanel(); - jp.setLayout(new CardLayout()); - return jp; - } - - /** - * 创建图标IconRadio面板 - * @param icon 图标 - * @param jradiobtn 按钮 - * @return JPanel对象 - */ - public static JPanel createIconRadio_S_Pane(Icon icon, - JRadioButton jradiobtn) { - jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); - jradiobtn.setBackground(new Color(255, 255, 255)); - JPanel iconRadioPane = new JPanel(); - iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); - - iconRadioPane.add(new UILabel(icon)); - iconRadioPane.add(jradiobtn); - - return iconRadioPane; - } - - /** - * 计算宽度 - * @param width 宽度输入值 - * @return w 宽度输出值 - */ - public static int caculateWidth(int width) { - int w = 0; - float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; - float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; - float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); - float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); - float x = i > j ? i : j; - if (x == i) { - w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; - } else if (x == j) { - w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; - } - return w; - } - - /** - * 计算高度 - * @param height 高度输入值 - * @return 高度输出值 - */ - public static int caculateHeight(int height) { - int h = 0; - float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; - h = ((int) x + 1) * HEIGHT_PARA; - return h; - } + public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout + return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5 + } + + /** + * 创建一个靠左流式布局,间距10,10 + * + * @return FlowLayout对象 + */ + public static LayoutManager createL_FlowLayout() { + return new FlowLayout(FlowLayout.LEFT, 10, 10); + } + + /** + * 创建一个居中流式布局 + * + * @return FlowLayout对象 + */ + public static LayoutManager createCenterFlowLayout() { + return new FlowLayout(FlowLayout.CENTER); + } + + /** + * 创建一个靠右流式布局 + * + * @return FlowLayout对象 + */ + public static LayoutManager createRightFlowLayout() { + return new FlowLayout(FlowLayout.RIGHT); + } + + /** + * 创建一个边框布局 + * + * @return BorderLayout对象 + */ + public static LayoutManager createBorderLayout() { + return new BorderLayout(); + } + + /** + * 创建一个边框布局,间距4,4 + * + * @return BorderLayout对象 + */ + public static LayoutManager createM_BorderLayout() { + return new BorderLayout(4, 4); + } + + + /** + * 创建一个1列的网格布局 + * + * @return FRGridLayout对象 + */ + public static LayoutManager create1ColumnGridLayout() { + return new FRGridLayout(1); + } + + /** + * 创建一个2列的网格布局 + * + * @return FRGridLayout对象 + */ + public static LayoutManager create2ColumnGridLayout() { + return new FRGridLayout(2); + } + + /** + * 创建一个n列的网格布局 + * + * @param nColumn 列数 + * @return FRGridLayout对象 + */ + public static LayoutManager createNColumnGridLayout(int nColumn) { + return new FRGridLayout(nColumn); + } + + /** + * 创建一个带标题边框面板 + * + * @param string 边框标题 + * @return JPanel对象 + */ + public static JPanel createTitledBorderPane(String string) { + JPanel jp = new JPanel(); + UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); + jp.setBorder(explainBorder); + jp.setLayout(new FlowLayout(FlowLayout.LEFT)); + return jp; + } + + /** + * 创建一个带标题边框面板并且居中显示 + * + * @param borderTitle 边框标题 + * @return JPanel对象 + */ + public static JPanel createTitledBorderPaneCenter(String borderTitle) { + JPanel jp = new JPanel(); + UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); + jp.setBorder(explainBorder); + jp.setLayout(new FlowLayout(FlowLayout.CENTER)); + return jp; + } + + /** + * 创建一个靠左空边框布局,间隔大 + * + * @return JPanel对象 + */ + public static JPanel createBigHGapFlowInnerContainer_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); + return jp; + } + + /** + * 创建一个靠左空边框面板,间隔中等 + * + * @return JPanel对象 + */ + public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); + return jp; + } + + /** + * 创建一个靠左空边框面板,间隔中等,firsthgap 为0 + * + * @return JPanel对象 + */ + public static JPanel createMediumHGapFlowInnerContainer_M_Pane_First0() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + jp.setLayout(new FRLeftFlowLayout(0, 20, 5)); + return jp; + } + + /** + * 创建一个靠左空边框面板,间隔中等 + * + * @return JPanel对象 + */ + public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); + jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); + return jp; + } + + /** + * 创建一个正常靠左空边框面板 + * + * @return JPanel对象 + */ + public static JPanel createNormalFlowInnerContainer_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + jp.setLayout(new FlowLayout(FlowLayout.LEFT)); + return jp; + } + + /** + * 创建一个靠左0间距边框面板 + * + * @return JPanel对象 + */ + public static JPanel createLeftFlowZeroGapBorderPane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); + return jp; + } + + /** + * 创建一个靠左流式布局,正常流式内嵌 + * + * @return JPanel对象 + */ + public static JPanel createNormalFlowInnerContainer_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.LEFT)); + return jp; + } + + /** + * 创建一个靠左流式布局,流式内嵌 + * + * @return JPanel对象 + */ + public static JPanel createBoxFlowInnerContainer_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); + return jp; + } + + /** + * 创建一个靠左流式布局,流式内嵌,首元素距离左边0 + * + * @return JPanel对象 + */ + public static JPanel createBoxFlowInnerContainer_S_Pane_First0() { + JPanel jp = new JPanel(); + jp.setLayout(new FRLeftFlowLayout(0, 0, 5)); + return jp; + } + + /** + * 创建一个靠右面板 + * + * @return JPanel对象 + */ + public static JPanel createRightFlowInnerContainer_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); + return jp; + } + + /** + * 创建一个居中面板 + * + * @return JPanel对象 + */ + public static JPanel createCenterFlowInnerContainer_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.CENTER)); + return jp; + } + + /** + * 创建一个居中0间距面板 + * + * @return JPanel对象 + */ + public static JPanel createCenterFlowZeroGapBorderPane() { + JPanel jp = new JPanel(); + jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); + jp.setBorder(BorderFactory.createEmptyBorder()); + return jp; + } + + /** + * 创建纵向排列面板 + * + * @return JPanel对象 + */ + public static JPanel createY_AXISBoxInnerContainer_L_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); + return jp; + } + + /** + * 创建纵向边框面板 + * + * @return JPanel对象 + */ + public static JPanel createYBoxEmptyBorderPane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); + return jp; + } + + /** + * 创建横向面板 + * + * @return JPanel对象 + */ + public static JPanel createX_AXISBoxInnerContainer_L_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); + return jp; + } + + /** + * 创建纵向面板M + * + * @return JPanel对象 + */ + public static JPanel createY_AXISBoxInnerContainer_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); + return jp; + } + + /** + * 创建横向内置boxlayout的面板 + * + * @return JPanel对象 + */ + public static JPanel createX_AXISBoxInnerContainer_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); + return jp; + } + + /** + * 创建纵向内置boxlayout的面板 + * + * @return JPanel对象 + */ + public static JPanel createY_AXISBoxInnerContainer_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); + return jp; + } + + /** + * 创建横向内置boxlayout的面板 + * + * @return JPanel对象 + */ + public static JPanel createX_AXISBoxInnerContainer_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); + return jp; + } + + /** + * 创建n列网格面板 + * + * @param nColumn 列数 + * @return JPanel对象 + */ + public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { + JPanel jp = new JPanel(); + jp.setLayout(new FRGridLayout(nColumn)); + return jp; + } + + /** + * 创建n列网格面板 + * + * @param nColumn 列数 + * @param h 水平间距 + * @param v 垂直间距 + * @return JPanel对象 + */ + public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { + JPanel jp = new JPanel(); + jp.setLayout(new FRGridLayout(nColumn, h, v)); + return jp; + } + + /** + * 创建顶格n列网格面板 + * + * @param nColumn 列数 + * @return JPanel对象 + */ + public static JPanel createFillColumnPane(int nColumn) { + JPanel jp = new JPanel(); + jp.setLayout(new FRGridLayout(nColumn, 0, 0)); + return jp; + } + + /** + * 创建边框面板L + * + * @return JPanel对象 + */ + public static JPanel createBorderLayout_L_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jp.setLayout(FRGUIPaneFactory.createBorderLayout()); + return jp; + } + + /** + * 创建边框面板M + * + * @return JPanel对象 + */ + public static JPanel createBorderLayout_M_Pane() { + JPanel jp = new JPanel(); + jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); + return jp; + } + + /** + * 创建边框面板S + * + * @return JPanel对象 + */ + public static JPanel createBorderLayout_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(FRGUIPaneFactory.createBorderLayout()); + return jp; + } + + /** + * 创建卡片式布局 + * + * @return JPanel对象 + */ + public static JPanel createCardLayout_S_Pane() { + JPanel jp = new JPanel(); + jp.setLayout(new CardLayout()); + return jp; + } + + /** + * 创建图标IconRadio面板 + * + * @param icon 图标 + * @param jradiobtn 按钮 + * @return JPanel对象 + */ + public static JPanel createIconRadio_S_Pane(Icon icon, + JRadioButton jradiobtn) { + jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); + jradiobtn.setBackground(new Color(255, 255, 255)); + JPanel iconRadioPane = new JPanel(); + iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); + + iconRadioPane.add(new UILabel(icon)); + iconRadioPane.add(jradiobtn); + + return iconRadioPane; + } + + /** + * 计算宽度 + * + * @param width 宽度输入值 + * @return w 宽度输出值 + */ + public static int caculateWidth(int width) { + int w = 0; + float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; + float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; + float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); + float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); + float x = i > j ? i : j; + if (x == i) { + w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; + } else if (x == j) { + w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; + } + return w; + } + + /** + * 计算高度 + * + * @param height 高度输入值 + * @return 高度输出值 + */ + public static int caculateHeight(int height) { + int h = 0; + float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; + h = ((int) x + 1) * HEIGHT_PARA; + return h; + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 3e146ad18..ac0e0171e 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2105,6 +2105,7 @@ FR-Designer_Insert_Text=Insert_Text FR-Designer_Double=Double FR-Designer_Add_Event=Add Event FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit +FR-Designer_Dynamic_Parameter=Dynamic Parameter FR-Designer_Remove_Item=Remove Item FR-Designer_Widget_Position=widget Position FR-Designer_Widget_Field=field @@ -2116,5 +2117,6 @@ FR-Designer_Widget_Error_Tip=error tip FR-Designer_Widget_Return_Leaf=return leaf FR-Designer_Widget_Return_Path=return path FR-Designer_Widget_Display_Position=Display Position +FR-Designer_Size_Limit=Size_Limit FR-Designer_Widget_Name=Widget Name -FR-Designer_Coords_And_Size=Coords & Size +FR-Designer_Coords_And_Size=Coords & Size \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 1009ae9c5..b020b124d 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2106,11 +2106,13 @@ FR-Designer_Scale_Slider=Scale_Slider FR-Designer_Scale_Grade=Scale_Grade FR-Designer_Add_Event=Add Event FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit +FR-Designer_Dynamic_Parameter=Dynamic Parameter FR-Designer_Remove_Item=Remove Item FR-Designer_Widget_No_Repeat=no repeat FR-Designer_Widget_Error_Tip=error tip FR-Designer_Widget_Return_Leaf=return leaf FR-Designer_Widget_Return_Path=return path FR-Designer_Widget_Display_Position=Display Position +FR-Designer_Size_Limit=Size_Limit FR-Designer_Widget_Name=Widget Name -FR-Designer_Coords_And_Size=Coords & Size \ No newline at end of file +FR-Designer_Coords_And_Size=Coords & Size diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 2d51d39b0..5c87c6351 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -2109,11 +2109,13 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Insert_Formula= FR-Designer_Not_Support_Authority_Edit=\u3053\u306E\u8981\u7D20\u306F\u6A29\u9650\u5236\u5FA1\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093 +FR-Designer_Dynamic_Parameter=\ FR-Designer_Remove_Item= FR-Designer_Widget_No_Repeat= FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Size_Limit= FR-Designer_Widget_Name= -FR-Designer_Coords_And_Size= +FR-Designer_Coords_And_Size= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 25c8d5561..0af04893e 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -2109,11 +2109,13 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Add_Event= FR-Designer_Not_Support_Authority_Edit=\uD574\uB2F9\uC694\uC18C\uB294\uAD8C\uD55C\uCEE8\uD2B8\uB864\uC744\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. +FR-Designer_Dynamic_Parameter=\ FR-Designer_Remove_Item= FR-Designer_Widget_No_Repeat= FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Size_Limit= FR-Designer_Widget_Name= -FR-Designer_Coords_And_Size= +FR-Designer_Coords_And_Size= \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 7e6e315fa..e82281743 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2112,6 +2112,7 @@ FR-Designer_Scale_Up=\u653E\u5927 FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757 FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002 FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236 +FR-Designer_Dynamic_Parameter=\u52A8\u6001\u53C2\u6570 FR-Designer_Remove_Item=\u5220\u9664\u9009\u4E2D FR-Designer_Widget_Position=\u63A7\u4EF6\u4F4D\u7F6E FR-Designer_Widget_Field=\u5B57\u6BB5 @@ -2123,5 +2124,6 @@ FR-Designer_Widget_Error_Tip=\u9519\u8BEF\u63D0\u793A FR-Designer_Widget_Return_Leaf=\u7ED3\u679C\u8FD4\u56DE\u53F6\u5B50\u8282\u70B9 FR-Designer_Widget_Return_Path=\u7ED3\u679C\u8FD4\u56DE\u5B8C\u6574\u5C42\u6B21\u8DEF\u5F84 FR-Designer_Widget_Display_Position=\u663E\u793A\u4F4D\u7F6E +FR-Designer_Size_Limit=\u5927\u5C0F\u9650\u5236 FR-Designer_Widget_Name=\u63A7\u4EF6\u540D\u79F0 -FR-Designer_Coords_And_Size=\u5750\u6807\u00B7\u5C3A\u5BF8 +FR-Designer_Coords_And_Size=\u5750\u6807\u00B7\u5C3A\u5BF8 \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index b659521c3..dda5dae78 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2109,11 +2109,13 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Add_Event= FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236 +FR-Designer_Dynamic_Parameter=\u52D5\u614B\u53C3\u6578 FR-Designer_Remove_Item= FR-Designer_Widget_No_Repeat= FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Size_Limit= FR-Designer_Widget_Name= -FR-Designer_Coords_And_Size= \ No newline at end of file +FR-Designer_Coords_And_Size= diff --git a/designer_base/src/com/fr/design/selection/QuickEditor.java b/designer_base/src/com/fr/design/selection/QuickEditor.java index 1d46af929..d2e74da5c 100644 --- a/designer_base/src/com/fr/design/selection/QuickEditor.java +++ b/designer_base/src/com/fr/design/selection/QuickEditor.java @@ -1,61 +1,61 @@ package com.fr.design.selection; -import javax.swing.JComponent; - import com.fr.design.designer.TargetComponent; +import javax.swing.*; + /** * 快速编辑区域 - * + * * @author zhou * @since 2012-7-12下午2:48:20 */ @SuppressWarnings("rawtypes") public abstract class QuickEditor extends JComponent { - private static final long serialVersionUID = 5434472104640676832L; + private static final long serialVersionUID = 5434472104640676832L; - protected T tc; + protected T tc; - protected boolean isEditing = false; + protected boolean isEditing = false; - public QuickEditor() { + public QuickEditor() { - } + } - public void populate(T tc) { - isEditing = false; - this.tc = tc; - refresh(); - isEditing = true; - } + public void populate(T tc) { + isEditing = false; + this.tc = tc; + refresh(); + isEditing = true; + } - /** - * 触发保存一定要用这个 - */ - protected void fireTargetModified() { - if(!isEditing) { - return; - } - tc.fireTargetModified(); - } + /** + * 触发保存一定要用这个 + */ + protected void fireTargetModified() { + if (!isEditing) { + return; + } + tc.fireTargetModified(); + } - protected abstract void refresh(); + protected abstract void refresh(); - /** - * for 关闭时候释放 - */ - public void release () { - tc = null; - } + /** + * for 关闭时候释放 + */ + public void release() { + tc = null; + } - public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { + public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { - @Override - protected void refresh() { + @Override + protected void refresh() { - } + } - }; + }; } \ No newline at end of file