From 28a41ef8af3183cede6d4fd834fac9250d983ac2 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 7 Aug 2017 11:49:02 +0800 Subject: [PATCH 1/7] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E8=A7=86=E8=A7=89=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/NumberEditorDefinePane.java | 15 ++++++++++----- .../fr/design/widget/ui/WaterMarkDictPane.java | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 86a8bf50f..13be4c8b5 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -8,6 +8,8 @@ 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; @@ -166,12 +168,12 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane public JPanel setValidatePane() { - this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("Allow_Decimals")); + this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Decimals")); this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); - this.decimalLength.setColumns(4); + this.decimalLength.setColumns(10); 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); @@ -191,12 +193,14 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane 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)); 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[]{numberLabel, decimalLength }, new Component[]{allowNegativeCheckBox, null}, new Component[]{setMaxValueCheckBox, maxValueSpinner}, new Component[]{setMinValueCheckBox, minValueSpinner}, @@ -204,7 +208,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane 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); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, 1); + panel.setBorder(BorderFactory.createEmptyBorder(0,1,0,0)); return panel; } diff --git a/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java b/designer/src/com/fr/design/widget/ui/WaterMarkDictPane.java index e95d5cee1..85d088d13 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, 10, 0)); this.add(panel, BorderLayout.CENTER); } From 2150be484188bf3933b651b2c141fa825e25f56d Mon Sep 17 00:00:00 2001 From: hzzz Date: Mon, 7 Aug 2017 15:27:23 +0800 Subject: [PATCH 2/7] hzzzzzzzzzz --- .../ui/DirectWriteEditorDefinePane.java | 2 +- .../widget/ui/TreeEditorDefinePane.java | 10 +- .../design/widget/ui/WaterMarkDictPane.java | 2 +- .../widget/ui/WritableRepeatEditorPane.java | 2 +- .../fr/design/gui/frpane/TreeSettingPane.java | 1 + .../itree/refreshabletree/TreeRootPane.java | 44 +- .../fr/design/layout/FRGUIPaneFactory.java | 926 +++++++++--------- 7 files changed, 520 insertions(+), 467 deletions(-) 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/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 85d088d13..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, 10, 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_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/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/layout/FRGUIPaneFactory.java b/designer_base/src/com/fr/design/layout/FRGUIPaneFactory.java index 00fde425f..26768a271 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() { - } + 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; + 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 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 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; + } + + /** + * 创建一个靠左空边框面板,间隔中等,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 From 161a93c244198036f3e2a1039d07226a7be664fd Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 7 Aug 2017 15:34:55 +0800 Subject: [PATCH 3/7] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E8=A7=86=E8=A7=89=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/ButtonGroupDictPane.java | 120 +++++++++-------- .../design/widget/ui/CheckBoxDefinePane.java | 88 +++++++------ .../widget/ui/NumberEditorDefinePane.java | 44 ++++--- .../widget/ui/RadioGroupDefinePane.java | 124 +++++++++--------- .../btn/ButtonWithHotkeysDetailPane.java | 71 +++------- 5 files changed, 223 insertions(+), 224 deletions(-) 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/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 13be4c8b5..6653e723e 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -3,6 +3,8 @@ 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; @@ -27,7 +29,7 @@ import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; public class NumberEditorDefinePane extends FieldEditorDefinePane { - /** + /**FieldEditorDefinePane * */ private static final long serialVersionUID = 8011242951911686805L; @@ -39,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; @@ -80,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); @@ -144,7 +146,8 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane }; public NumberEditorDefinePane() { - super(); +// super(); + this.initComponents(); } @@ -169,25 +172,26 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane public JPanel setValidatePane() { this.allowDecimalsCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Allow_Decimals")); - this.decimalLength = new com.fr.design.editor.editor.IntegerEditor(); - this.decimalLength.setColumns(10); + 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("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); @@ -196,19 +200,29 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane UILabel numberLabel = new UILabel(Inter.getLocText(new String[]{"FR-Designer_Double", "Numbers"})); numberLabel.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + JPanel pane1 = new JPanel(new BorderLayout()); + pane1.add(decimalLength, BorderLayout.CENTER); + pane1.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + JPanel pane2 = new JPanel(new BorderLayout()); + pane2.add(maxValueSpinner, BorderLayout.CENTER); + pane2.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + JPanel pane3 = new JPanel(new BorderLayout()); + pane3.add(minValueSpinner, BorderLayout.CENTER); + pane3.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[]{numberLabel, decimalLength }, + new Component[]{numberLabel, pane1 }, new Component[]{allowNegativeCheckBox, null}, - new Component[]{setMaxValueCheckBox, maxValueSpinner}, - new Component[]{setMinValueCheckBox, minValueSpinner}, + new Component[]{setMaxValueCheckBox, pane2}, + new Component[]{setMinValueCheckBox, pane3}, }; 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, LayoutConstants.VGAP_MEDIUM, 1); + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); panel.setBorder(BorderFactory.createEmptyBorder(0,1,0,0)); return panel; @@ -255,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_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java b/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java index 18ae3a5c4..faae19220 100644 --- a/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java +++ b/designer_base/src/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java @@ -1,7 +1,9 @@ package com.fr.design.widget.btn; -import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.frpane.AttributeChangeListener; +import java.awt.*; + +import javax.swing.*; + import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -12,11 +14,6 @@ import com.fr.form.ui.Button; import com.fr.general.Inter; import com.fr.stable.StableUtils; -import javax.swing.*; -import java.awt.*; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; - /** * Created by IntelliJ IDEA. * Author : Richer @@ -28,62 +25,39 @@ public abstract class ButtonWithHotkeysDetailPane extends Butt private UITextField hotkeysTextField; private UITextField buttonNameTextField; private IconDefinePane iconPane; - private AttributeChangeListener listener; - public ButtonWithHotkeysDetailPane() { initComponents(); } private void initComponents() { -// creator. this.setLayout(FRGUIPaneFactory.createBorderLayout()); -// JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); - JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); -// advancedPane.setPreferredSize(new Dimension(600, 341)); + JPanel advancedPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Advanced")); + advancedPane.setPreferredSize(new Dimension(600, 341)); JPanel attrPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); attrPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + this.add(advancedPane); double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double rowSize[] = {p, p, p, p, p, p, p}; - double columnSize[] = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 1}, {1, 1}}; + double rowSize[] = {p, p, p, p}; + double columnSize[] = {p, p}; JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); iconPane = new IconDefinePane(); labelPane.add(iconPane); Component[][] n_components = { - {new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField()}, - {new UILabel("背景" + ":"), new UITextField()}, - {new UILabel("字体" + ":"), new UITextField()}, - {new UILabel("图标" + ":"), new UITextField()}, - {new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField()} + {new UILabel(Inter.getLocText("FR-Designer_Button-Name") + ":"), buttonNameTextField = new UITextField(16)}, + {new UILabel(Inter.getLocText("FR-Designer_Button-Icon") + ":"), labelPane}, + {new UILabel(Inter.getLocText("FR-Designer_Button-Type") + ":"), createButtonTypeComboBox()}, + {new UILabel(Inter.getLocText("FR-Designer_Button-Hotkeys") + ":"), hotkeysTextField = new UITextField(16)} }; - buttonNameTextField.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - - } - - @Override - public void focusLost(FocusEvent e) { -// creator.getWidget().set - - } - }); hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); - JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, 10, 8); - panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); - jPanel.add(panel, BorderLayout.CENTER); - UIExpandablePane advancedPane = new UIExpandablePane("高级", 280, 20, jPanel); - this.add(advancedPane); - } - - //add By kerry - public void addAttributeChangeListener(AttributeChangeListener listener) { - this.listener = listener; + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, 0, 8); + advancedPane.add(panel,BorderLayout.NORTH); + Component comp = createCenterPane(); + if(comp != null ) { + advancedPane.add(comp,BorderLayout.CENTER); + } } - protected abstract Component createCenterPane(); @Override @@ -104,11 +78,4 @@ public abstract class ButtonWithHotkeysDetailPane extends Butt button.setHotkeys(hotkeysTextField.getText()); return button; } - - - public void updateBean(Button ob) { - ob.setIconName(iconPane.update()); - ob.setText(buttonNameTextField.getText()); - ob.setHotkeys(hotkeysTextField.getText()); - } } \ No newline at end of file From 576032b7a5638789cd4d8dc7b14cef2398cc0894 Mon Sep 17 00:00:00 2001 From: hzzz Date: Mon, 7 Aug 2017 16:30:33 +0800 Subject: [PATCH 4/7] hzzzz --- .../widget/ui/ListEditorDefinePane.java | 4 +- .../design/widget/ui/MultiFileEditorPane.java | 46 ++++++++----------- .../ui/WriteUnableRepeatEditorPane.java | 5 +- 3 files changed, 24 insertions(+), 31 deletions(-) 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 this.initComponents(); } - + @Override protected String title4PopupWindow() { return "file"; @@ -34,42 +35,35 @@ public class MultiFileEditorPane extends FieldEditorDefinePane @Override protected JPanel setFirstContentPane() { - acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); - acceptType.setPreferredSize(new Dimension(200, 18)); + JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); + JPanel centerPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); +// centerPane.add(singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"))); + + + singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); + acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); + acceptType.setPreferredSize(new Dimension(100, 18)); fileSizeField = new UINumberField(); fileSizeField.setPreferredSize(new Dimension(80, 18)); - - JPanel singleFilePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - singleFilePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + JPanel singleFilePane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); singleFilePane.add(singleFileCheckBox); + centerPane.add(singleFilePane); - 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") + ":")); + JPanel allowTypePane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); + allowTypePane.add(new UILabel(Inter.getLocText("File-Allow_Upload_Files") + ":")); allowTypePane.add(acceptType); + centerPane.add(allowTypePane); - JPanel fileSizePane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); - fileSizePane.add(new UILabel(" " + Inter.getLocText("File-File_Size_Limit") + ":")); + JPanel fileSizePane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); + fileSizePane.add(new UILabel(Inter.getLocText("File-File_Size_Limit") + ":")); fileSizePane.add(fileSizeField); fileSizePane.add(new UILabel(" KB")); + centerPane.add(fileSizePane); - 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; + contenter.add(centerPane); + return contenter; } @Override 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 Date: Mon, 7 Aug 2017 16:43:29 +0800 Subject: [PATCH 5/7] rm button group border --- designer_base/src/com/fr/design/constants/UIConstants.java | 2 +- designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index 3945e756f..5332ce13d 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -153,7 +153,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/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) { From 94b990083a3825da795caa5fb9664f5c8cd60e15 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Mon, 7 Aug 2017 17:40:29 +0800 Subject: [PATCH 6/7] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E8=A7=86=E8=A7=89=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/present/BarCodePane.java | 750 +++++++++--------- .../fr/design/present/CurrencyLinePane.java | 460 +++++------ .../design/widget/ui/MultiFileEditorPane.java | 166 ++-- .../com/fr/design/locale/designer.properties | 1 + .../design/locale/designer_en_US.properties | 3 +- .../design/locale/designer_ja_JP.properties | 1 + .../design/locale/designer_ko_KR.properties | 1 + .../design/locale/designer_zh_CN.properties | 1 + .../design/locale/designer_zh_TW.properties | 3 +- 9 files changed, 694 insertions(+), 692 deletions(-) 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/ui/MultiFileEditorPane.java b/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java index ed32fd5f0..6d1871a9b 100644 --- a/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java +++ b/designer/src/com/fr/design/widget/ui/MultiFileEditorPane.java @@ -1,86 +1,82 @@ -package com.fr.design.widget.ui; - -import java.awt.*; - -import com.fr.design.constants.LayoutConstants; -import com.fr.design.gui.ilable.UILabel; - -import javax.swing.*; - -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.itextfield.UINumberField; -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.MultiFileEditor; -import com.fr.general.Inter; - -public class MultiFileEditorPane extends FieldEditorDefinePane { - private DictionaryComboBox acceptType; - private UICheckBox singleFileCheckBox; - private UINumberField fileSizeField; - - public MultiFileEditorPane() { - this.initComponents(); - } - - - @Override - protected String title4PopupWindow() { - return "file"; - } - - @Override - protected JPanel setFirstContentPane() { - JPanel contenter = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); - JPanel centerPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); -// centerPane.add(singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD"))); - - - - singleFileCheckBox = new UICheckBox(Inter.getLocText("SINGLE_FILE_UPLOAD")); - acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); - acceptType.setPreferredSize(new Dimension(100, 18)); - fileSizeField = new UINumberField(); - fileSizeField.setPreferredSize(new Dimension(80, 18)); - - JPanel singleFilePane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); - singleFilePane.add(singleFileCheckBox); - centerPane.add(singleFilePane); - - JPanel allowTypePane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); - allowTypePane.add(new UILabel(Inter.getLocText("File-Allow_Upload_Files") + ":")); - allowTypePane.add(acceptType); - centerPane.add(allowTypePane); - - JPanel fileSizePane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane_First0(); - fileSizePane.add(new UILabel(Inter.getLocText("File-File_Size_Limit") + ":")); - fileSizePane.add(fileSizeField); - fileSizePane.add(new UILabel(" KB")); - centerPane.add(fileSizePane); - - contenter.add(centerPane); - 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; - } - +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_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index d6f90cadb..eddc4f19e 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2116,3 +2116,4 @@ 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 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 0d44c3036..6a26c41dc 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 @@ -2111,4 +2111,5 @@ 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 \ No newline at end of file +FR-Designer_Widget_Display_Position=Display Position +FR-Designer_Size_Limit=Size_Limit \ No newline at end of file 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 f456a229b..1b169ba0e 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 @@ -2115,3 +2115,4 @@ FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Size_Limit=\ 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 444d54824..0b77aa7e5 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 @@ -2115,3 +2115,4 @@ FR-Designer_Widget_Error_Tip= FR-Designer_Widget_Return_Leaf= FR-Designer_Widget_Return_Path= FR-Designer_Widget_Display_Position= +FR-Designer_Size_Limit=\ 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 0ec66bd02..b3a44432b 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 @@ -2123,3 +2123,4 @@ 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 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 23af4dafa..46a9a93b4 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 @@ -2114,4 +2114,5 @@ 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= \ No newline at end of file +FR-Designer_Widget_Display_Position= +FR-Designer_Size_Limit=\ \ No newline at end of file From db9ca2ee21f62fadab9aed9c861e848a9d8847b0 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 8 Aug 2017 09:27:08 +0800 Subject: [PATCH 7/7] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E4=BF=AE=E6=94=B9=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/NumberEditorDefinePane.java | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java index 6653e723e..a955939f0 100644 --- a/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/NumberEditorDefinePane.java @@ -29,8 +29,8 @@ import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; public class NumberEditorDefinePane extends FieldEditorDefinePane { - /**FieldEditorDefinePane - * + /** + * FieldEditorDefinePane */ private static final long serialVersionUID = 8011242951911686805L; private UICheckBox allowDecimalsCheckBox; @@ -198,33 +198,33 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane 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 pane1 = new JPanel(new BorderLayout()); - pane1.add(decimalLength, BorderLayout.CENTER); - pane1.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - JPanel pane2 = new JPanel(new BorderLayout()); - pane2.add(maxValueSpinner, BorderLayout.CENTER); - pane2.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - JPanel pane3 = new JPanel(new BorderLayout()); - pane3.add(minValueSpinner, BorderLayout.CENTER); - pane3.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + 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[]{numberLabel, pane1 }, + new Component[]{allowDecimalsCheckBox, null}, + new Component[]{numberLabel, decimalPane}, new Component[]{allowNegativeCheckBox, null}, - new Component[]{setMaxValueCheckBox, pane2}, - new Component[]{setMinValueCheckBox, pane3}, + 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, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); - panel.setBorder(BorderFactory.createEmptyBorder(0,1,0,0)); - 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; }