From ef34c9236732a63be0efc63be51505189d07001c Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Thu, 29 Dec 2016 11:18:55 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E5=9C=A8=E8=A1=A8=E5=8D=95->=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=8F=9C=E5=8D=95->=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B8=AD=E5=8A=A0=E5=85=A5=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=96=B9=E5=BC=8F=E7=9A=84=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/mobile/MobileUseHtmlGroupPane.java | 106 +---------------- .../mobile/MobileUseHtmlGroupBeanPane.java | 112 ++++++++++++++++++ .../form/mobile/FormMobileAttrPane.java | 33 ++++-- .../form/mobile/MobileUseHtmlGroupPane.java | 29 +++++ 4 files changed, 167 insertions(+), 113 deletions(-) create mode 100644 designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java create mode 100644 designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java diff --git a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java index 50c5e32381..0e0ec087d1 100644 --- a/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java +++ b/designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java @@ -1,109 +1,12 @@ package com.fr.design.report.mobile; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.border.UITitledBorder; -import com.fr.design.gui.ibutton.UIRadioButton; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.general.Inter; +import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane; import com.fr.report.mobile.ElementCaseMobileAttr; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - /** * Created by kunsnat on 2016/8/3. */ -public class MobileUseHtmlGroupPane extends BasicBeanPane { - - private List radioButtons = new ArrayList(); - - public MobileUseHtmlGroupPane() { - initComponents(); - } - - private void initComponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow())); - - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, p, p}; - - UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis")); - useApp.setSelected(true); - UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); - - addToButtonGroup(useApp, useHTML5); - - Component[][] components = new Component[][]{ - new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5}, - new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null} - }; - JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); - - this.add(usePane); - } - - private void addToButtonGroup(UIRadioButton... radios) { - ButtonGroup buttonGroup = new ButtonGroup(); - for (UIRadioButton radio : radios) { - radioButtons.add(radio); - buttonGroup.add(radio); - } - } - - /** - * 设置按钮状态 - */ - public void setEnabled(boolean enabled) { - for (UIRadioButton radioButton : radioButtons) { - radioButton.setEnabled(enabled); - } - } - - /** - * 获取当前选中的按钮index - * - * @return 按钮index - */ - public int getSelectRadioIndex() { - for (int i = 0, len = radioButtons.size(); i < len; i++) { - if (radioButtons.get(i).isSelected()) { - return i; - } - } - - return 0; - } - - /** - * 选中指定index的按钮 - */ - public void selectIndexButton(int index) { - if (index < 0 || index > radioButtons.size() - 1) { - return; - } - - UIRadioButton button = radioButtons.get(index); - button.setSelected(true); - } - - /** - * 给所有的按钮加上监听 - */ - public void addActionListener(ActionListener actionListener) { - for (UIRadioButton radioButton : radioButtons) { - radioButton.addActionListener(actionListener); - } - } - +public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane { @Override public void populateBean(ElementCaseMobileAttr mobileAttr) { if(mobileAttr != null) { @@ -122,9 +25,4 @@ public class MobileUseHtmlGroupPane extends BasicBeanPane mobileAttr.setUseHTML(getSelectRadioIndex() == 1); } } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("FR-mobile_report_analysis"); - } } diff --git a/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java b/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java new file mode 100644 index 0000000000..5ddf61e560 --- /dev/null +++ b/designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java @@ -0,0 +1,112 @@ +package com.fr.design.dialog.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.border.UITitledBorder; +import com.fr.design.gui.ibutton.UIRadioButton; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * 由于MobileUserHtmlGroupPane 现在在report和form中均会用到,会出现重复代码,故放入base中 + * Created by fanglei on 2016/12/28. + */ +public abstract class MobileUseHtmlGroupBeanPane extends BasicBeanPane { + + private List radioButtons = new ArrayList(); + + public MobileUseHtmlGroupBeanPane() { + initComponents(); + } + + private void initComponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow())); + + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {p, p, p}; + + UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis")); + useApp.setSelected(true); + UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis")); + + addToButtonGroup(useApp, useHTML5); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5}, + new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_annotation")), null, null} + }; + JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + + this.add(usePane); + } + + private void addToButtonGroup(UIRadioButton... radios) { + ButtonGroup buttonGroup = new ButtonGroup(); + for (UIRadioButton radio : radios) { + radioButtons.add(radio); + buttonGroup.add(radio); + } + } + + /** + * 设置按钮状态 + */ + public void setEnabled(boolean enabled) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.setEnabled(enabled); + } + } + + /** + * 获取当前选中的按钮index + * + * @return 按钮index + */ + public int getSelectRadioIndex() { + for (int i = 0, len = radioButtons.size(); i < len; i++) { + if (radioButtons.get(i).isSelected()) { + return i; + } + } + + return 0; + } + + /** + * 选中指定index的按钮 + */ + public void selectIndexButton(int index) { + if (index < 0 || index > radioButtons.size() - 1) { + return; + } + + UIRadioButton button = radioButtons.get(index); + button.setSelected(true); + } + + /** + * 给所有的按钮加上监听 + */ + public void addActionListener(ActionListener actionListener) { + for (UIRadioButton radioButton : radioButtons) { + radioButton.addActionListener(actionListener); + } + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-mobile_report_analysis"); + } +} + diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java index 0aafd8258c..2431ebc8dc 100644 --- a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java @@ -1,6 +1,7 @@ package com.fr.design.form.mobile; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.main.mobile.FormMobileAttr; import com.fr.general.Inter; @@ -15,22 +16,34 @@ public class FormMobileAttrPane extends BasicBeanPane{ //工具栏容器 private MobileToolBarPane mobileToolBarPane; + //h5解析容器 + private MobileUseHtmlGroupPane mobileUseHtmlGroupPane; + static final int paddingHeight = 10; public FormMobileAttrPane() { this.initComponents(); } + //现在只有两个panel,填不满自适应对话框,只能为工具栏Panel和h5解析方式panel分别包裹上一层Panel再计算高度,不然会自动 + //拉长两个Panel的高度去填满整个对话框。 private void initComponents() { - JPanel jPanel = new JPanel(); + JPanel jPanel1 = new JPanel(); + JPanel jPanel2 = new JPanel(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + jPanel2.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.mobileToolBarPane = new MobileToolBarPane(); + this.mobileUseHtmlGroupPane = new MobileUseHtmlGroupPane(); //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 - jPanel.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight)); - jPanel.add("North", mobileToolBarPane); - this.add(jPanel); + jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight)); + jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + paddingHeight)); + jPanel1.add("North", this.mobileUseHtmlGroupPane); + jPanel2.add("North", this.mobileToolBarPane); + this.add("North", jPanel1); + this.add("Center", jPanel2); } @Override @@ -39,13 +52,15 @@ public class FormMobileAttrPane extends BasicBeanPane{ ob = new FormMobileAttr(); } this.mobileToolBarPane.populateBean(ob); + this.mobileUseHtmlGroupPane.populateBean(ob); } @Override public FormMobileAttr updateBean() { - FormMobileAttr caseMobileAttr = new FormMobileAttr(); - this.mobileToolBarPane.updateBean(caseMobileAttr); - return caseMobileAttr; + FormMobileAttr formMobileAttr = new FormMobileAttr(); + this.mobileToolBarPane.updateBean(formMobileAttr); + this.mobileUseHtmlGroupPane.updateBean(formMobileAttr); + return formMobileAttr; } @Override diff --git a/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java b/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java new file mode 100644 index 0000000000..45550a8420 --- /dev/null +++ b/designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java @@ -0,0 +1,29 @@ +package com.fr.design.form.mobile; + +import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane; +import com.fr.form.main.mobile.FormMobileAttr; + +/** + * 直接copyreport中的MobileUseHtmlGroupPane + * Created by fanglei on 2016/12/28. + */ +public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane { + @Override + public void populateBean(FormMobileAttr mobileAttr) { + if(mobileAttr != null) { + selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0); + } + } + + @Override + public FormMobileAttr updateBean() { + return null; + } + + @Override + public void updateBean(FormMobileAttr mobileAttr) { + if(mobileAttr != null) { + mobileAttr.setUseHTML(getSelectRadioIndex() == 1); + } + } +} From 0be0c5ee7558fa7342a02b926f706a2439f269a8 Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Fri, 30 Dec 2016 09:27:33 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E5=B8=B8=E9=87=8F=E6=94=B9=E6=88=90?= =?UTF-8?q?=E5=A4=A7=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/form/mobile/FormMobileAttrPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java index 2431ebc8dc..eb53e8f8cc 100644 --- a/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java +++ b/designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java @@ -19,7 +19,7 @@ public class FormMobileAttrPane extends BasicBeanPane{ //h5解析容器 private MobileUseHtmlGroupPane mobileUseHtmlGroupPane; - static final int paddingHeight = 10; + static final int PADDINGHEIGHT = 10; public FormMobileAttrPane() { this.initComponents(); @@ -38,8 +38,8 @@ public class FormMobileAttrPane extends BasicBeanPane{ this.mobileToolBarPane = new MobileToolBarPane(); this.mobileUseHtmlGroupPane = new MobileUseHtmlGroupPane(); //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 - jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight)); - jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + paddingHeight)); + jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); + jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); jPanel1.add("North", this.mobileUseHtmlGroupPane); jPanel2.add("North", this.mobileToolBarPane); this.add("North", jPanel1); From f2ba828f5fdde39e607cb8e84636c8233c65f208 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 30 Dec 2016 10:39:06 +0800 Subject: [PATCH 03/17] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E6=94=B9=E4=B8=BA=E5=8F=AA=E5=9C=A8=E6=8C=89?= =?UTF-8?q?=E4=B8=8B=E9=BC=A0=E6=A0=87=E5=B7=A6=E9=94=AE=E6=97=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/style/color/ColorPicker.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index cb30c186dd..8503c7f1ee 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -94,9 +94,11 @@ public class ColorPicker extends JDialog implements ActionListener validate(); // 更新所有子控件 } - public void pickComplete() { + public void pickComplete(Boolean setColor) { timer.stop(); - colorSelectable.setColor(colorToSet); + if (setColor) { + colorSelectable.setColor(colorToSet); + } this.dispose(); } @@ -111,7 +113,11 @@ public class ColorPicker extends JDialog implements ActionListener { public void mousePressed(MouseEvent e) { - pickComplete(); + if (e.getButton() == e.BUTTON1) { // 左键确定 + pickComplete(true); + } else { + pickComplete(false); + } } } } From 874d88ca75d993d45b407b99122d94f09d302175 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 30 Dec 2016 15:23:42 +0800 Subject: [PATCH 04/17] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E5=B0=86=E5=8F=96=E8=89=B2=E6=A1=86=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=A8=A1=E6=80=81=E5=AF=B9=E8=AF=9D=E6=A1=86=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BC=A0=E6=A0=87=E4=BA=8B=E4=BB=B6=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/report/ReportBackgroundAction.java | 6 ++---- .../src/com/fr/design/style/color/ColorPicker.java | 3 +++ .../com/fr/design/style/color/ColorSelectDialog.java | 2 +- .../fr/design/style/color/PickColorButtonFactory.java | 10 ++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java b/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java index 3c3940ddad..4a381d4d08 100644 --- a/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java +++ b/designer/src/com/fr/design/actions/report/ReportBackgroundAction.java @@ -37,16 +37,14 @@ public class ReportBackgroundAction extends ReportComponentAction Date: Fri, 30 Dec 2016 16:11:06 +0800 Subject: [PATCH 05/17] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=A7=A3=E5=86=B3=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/style/color/ColorPicker.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 605474230b..74e5514e19 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -61,6 +61,18 @@ public class ColorPicker extends JDialog implements ActionListener timer = new Timer(timeCycle, this); timer.start(); hideCursor(); + + // 如果要求实时变化,确保先关闭弹窗,再截屏 + // 主要针对"图案"选项卡中的"前景"、"背景" + if (this.setColorRealTime) { + colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗 + try { + Thread.sleep(100); // 等待弹窗关闭 + } catch (InterruptedException e) { + e.printStackTrace(); + } + colorPickerPanel.captureScreen(); + } // System.out.println(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()); } @@ -71,7 +83,7 @@ public class ColorPicker extends JDialog implements ActionListener public void actionPerformed(ActionEvent e) { updateLocation(); colorToSet = colorPickerPanel.getPixelColor(mousePos); - if (setColorRealTime && !colorSelectable.getColor().equals(colorToSet)) { + if (setColorRealTime && (colorSelectable.getColor() == null || !colorSelectable.getColor().equals(colorToSet))) { colorSelectable.setColor(colorToSet); } } @@ -147,6 +159,15 @@ class ColorPickerPanel extends JPanel */ public ColorPickerPanel(int scaleFactor) { + colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png"); + this.scaleFactor = scaleFactor; + captureScreen(); + } + + /** + * 截屏 + */ + public void captureScreen() { try { robot = new Robot(); @@ -158,8 +179,6 @@ class ColorPickerPanel extends JPanel screenImage = robot.createScreenCapture(new Rectangle(0, 0, Toolkit .getDefaultToolkit().getScreenSize().width, Toolkit .getDefaultToolkit().getScreenSize().height)); - colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png"); - this.scaleFactor = scaleFactor; } /** From 7f11d02a532889841526b5aeb276612497ba76db Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 30 Dec 2016 16:16:26 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=E3=80=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/style/color/ColorPicker.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 74e5514e19..6fc5706037 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -5,6 +5,7 @@ package com.fr.design.style.color; */ import com.fr.base.BaseUtils; +import com.fr.general.FRLogger; import java.awt.*; import java.awt.event.*; @@ -69,7 +70,7 @@ public class ColorPicker extends JDialog implements ActionListener try { Thread.sleep(100); // 等待弹窗关闭 } catch (InterruptedException e) { - e.printStackTrace(); + FRLogger.getLogger().error(e.getMessage()); } colorPickerPanel.captureScreen(); } From 10204d76da102c1f85c333f8c42d1f14f6c6960b Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 3 Jan 2017 14:00:37 +0800 Subject: [PATCH 07/17] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/style/color/ColorPicker.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 6fc5706037..cf63c500be 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -127,13 +127,8 @@ public class ColorPicker extends JDialog implements ActionListener private class MouseFunctions extends MouseAdapter { - public void mousePressed(MouseEvent e) - { - if (e.getButton() == e.BUTTON1) { // 左键确定 - pickComplete(true); - } else { - pickComplete(false); - } + public void mousePressed(MouseEvent e) { + pickComplete(e.getButton() == e.BUTTON1); // 左键确定 } } } From a7fafda5a41b5f8b74206a4b24be38e03b26ac5e Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 3 Jan 2017 14:01:58 +0800 Subject: [PATCH 08/17] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/style/color/ColorPicker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index cf63c500be..8807e1f402 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -110,7 +110,7 @@ public class ColorPicker extends JDialog implements ActionListener validate(); // 更新所有子控件 } - public void pickComplete(Boolean setColor) { + public void pickComplete(boolean setColor) { timer.stop(); if (setColor) { colorSelectable.setColor(colorToSet); From 11abf16bb8352e57316b12aa4f520d1d4f4179fd Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 4 Jan 2017 10:29:06 +0800 Subject: [PATCH 09/17] =?UTF-8?q?REPORT-576=20tab=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A1=86=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/locale/designer.properties | 2 ++ .../src/com/fr/design/locale/designer_en_US.properties | 3 ++- .../src/com/fr/design/locale/designer_ja_JP.properties | 4 +++- .../src/com/fr/design/locale/designer_ko_KR.properties | 4 +++- .../src/com/fr/design/locale/designer_zh_CN.properties | 2 ++ .../src/com/fr/design/locale/designer_zh_TW.properties | 4 +++- .../designer/creator/cardlayout/XCardSwitchButton.java | 9 ++++++++- 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 13613ee578..9f7923265c 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -508,3 +508,5 @@ FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= FR-Designer_Set_Callback_Function= +FR-Designer_ConfirmDialog_Content= +FR-Designer_ConfirmDialog_Title= 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 ae110ae601..b21847d0e4 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 @@ -508,4 +508,5 @@ FR-Designer_Form_Basic_Properties=Basic Property FR-Designer_DS_Dictionary=Data Dictionary FR-Designer_Create_Tree=Build Tree FR-Designer_Set_Callback_Function=Set Callback Function - +FR-Designer_ConfirmDialog_Content= +FR-Designer_ConfirmDialog_Title= 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 fc69c2e921..5ec06064b1 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 @@ -486,4 +486,6 @@ FR-Designer_Form_Editing_Listeners= FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= -FR-Designer_Set_Callback_Function= \ No newline at end of file +FR-Designer_Set_Callback_Function= +FR-Designer_ConfirmDialog_Content= +FR-Designer_ConfirmDialog_Title= 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 42c24b7dfe..3e27c558fb 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 @@ -481,4 +481,6 @@ FR-Designer_Form_Editing_Listeners= FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= -FR-Designer_Set_Callback_Function= \ No newline at end of file +FR-Designer_Set_Callback_Function= +FR-Designer_ConfirmDialog_Content= +FR-Designer_ConfirmDialog_Title= 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 7cc34b2b0a..d43f8746bb 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 @@ -512,3 +512,5 @@ FR-Designer_Form_Basic_Properties=\u57FA\u672C\u5C5E\u6027 FR-Designer_DS_Dictionary=\u6570\u636E\u5B57\u5178 FR-Designer_Create_Tree=\u6784\u5EFA\u6811 FR-Designer_Set_Callback_Function=\u8BBE\u7F6E\u56DE\u8C03\u51FD\u6570 +FR-Designer_ConfirmDialog_Content=\u662F\u5426\u786E\u5B9A\u5220\u9664tab\u63A7\u4EF6 +FR-Designer_ConfirmDialog_Title=FineReport 8.0 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 6d7aa5d172..58868eb0db 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 @@ -499,4 +499,6 @@ FR-Designer_Form_Editing_Listeners= FR-Designer_Form_Basic_Properties= FR-Designer_DS_Dictionary= FR-Designer_Create_Tree= -FR-Designer_Set_Callback_Function= \ No newline at end of file +FR-Designer_Set_Callback_Function= +FR-Designer_ConfirmDialog_Content= +FR-Designer_ConfirmDialog_Title= diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index c75fc2542b..fc9ee25853 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -11,7 +11,7 @@ import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; -import javax.swing.Icon; +import javax.swing.*; import com.fr.base.BaseUtils; import com.fr.base.background.ColorBackground; @@ -33,6 +33,7 @@ import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.Background; import com.fr.general.FRFont; +import com.fr.general.Inter; /** * @@ -146,6 +147,12 @@ public class XCardSwitchButton extends XButton { //删除card,同时修改其他switchbutton和tabfit的index private void deleteCard(XCardSwitchButton button,int index){ + String titleName = button.getContentLabel().getText(); + int value = JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Designer_ConfirmDialog_Content") + "“" + titleName + "”", + Inter.getLocText("FR-Designer_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION); + if (value != JOptionPane.OK_OPTION) { + return; + } tagLayout.remove(button); // 先清除该tab内部组件,否在再显示上有样式的残留 XWTabFitLayout tabLayout = (XWTabFitLayout)cardLayout.getComponent(index); From bfd06483b75b55abbcde732cbd8d913893410823 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 4 Jan 2017 16:06:14 +0800 Subject: [PATCH 10/17] =?UTF-8?q?REPORT-576=20tab=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XCardAddButton.java | 3 +- .../creator/cardlayout/XCardSwitchButton.java | 59 ++++-- .../creator/cardlayout/XWTabFitLayout.java | 174 ++++++++++++++++-- 3 files changed, 206 insertions(+), 30 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index 0c459b61cd..0e8fb4ce45 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -148,7 +148,6 @@ public class XCardAddButton extends XButton{ //设置标题 titleButton.setText(getTabTitleName()); XCardSwitchButton showButton = new XCardSwitchButton(titleButton,dimension,cardLayout,tagLayout); - titleButton.setCustomStyle(true); titleButton.setShowButton(true); showButton.setBackupParent(tagLayout); @@ -162,6 +161,8 @@ public class XCardAddButton extends XButton{ private void showNewTab(EditingMouseListener editingMouseListener,int index){ SelectionModel selectionModel = editingMouseListener.getSelectionModel(); XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index); + XCardSwitchButton xCardSwitchButton = (XCardSwitchButton) this.tagLayout.getComponent(index); + tabFitLayout.setxCardSwitchButton(xCardSwitchButton); selectionModel.setSelectedCreator(tabFitLayout); } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index fc9ee25853..5f8385aadb 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -57,10 +57,16 @@ public class XCardSwitchButton extends XButton { // tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量 private static final int FONT_SIZE_ADJUST = 2; + + private Background selectBackground; + protected boolean isCustomStyle; private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); + private static String COLORBACKGROUNDTYPE = "ColorBackground"; + private static String DEFAULTTYPE = "default"; + private Icon closeIcon = MOUSE_COLSE; public XWCardTagLayout getTagLayout() { @@ -79,6 +85,22 @@ public class XCardSwitchButton extends XButton { this.cardLayout = cardLayout; } + public boolean isCustomStyle() { + return isCustomStyle; + } + + public void setCustomStyle(boolean customStyle) { + isCustomStyle = customStyle; + } + + public Background getSelectBackground() { + return selectBackground; + } + + public void setSelectBackground(Background selectBackground) { + this.selectBackground = selectBackground; + } + public XCardSwitchButton(CardSwitchButton widget, Dimension initSize) { super(widget, initSize); } @@ -134,6 +156,7 @@ public class XCardSwitchButton extends XButton { // 切换到当前tab按钮对应的tabFitLayout XWTabFitLayout tabFitLayout = (XWTabFitLayout) cardLayout.getComponent(index); + tabFitLayout.setxCardSwitchButton(this); selectionModel.setSelectedCreator(tabFitLayout); if (editingMouseListener.stopEditing()) { @@ -248,16 +271,22 @@ public class XCardSwitchButton extends XButton { //画背景 private void drawBackgorund(){ CardSwitchButton button = (CardSwitchButton)this.toData(); - ColorBackground background; - if(button.isShowButton()){ - this.rebuid(); - background = ColorBackground.getInstance(CHOOSED_GRAL); - this.setContentBackground(background); - }else{ - this.rebuid(); - background = ColorBackground.getInstance(NORMAL_GRAL); - this.setContentBackground(background); - } + Background currentBackground; + currentBackground = this.getSelectBackground(); + //这边就是button的背景图片,图片的是image,默认的是color,所以不应该是针对null的判断 + String type = currentBackground != null? currentBackground.getBackgroundType() : DEFAULTTYPE; + if (type.equals(COLORBACKGROUNDTYPE) || type.equals(DEFAULTTYPE)) { + ColorBackground background; + if(button.isShowButton()){ + this.rebuid(); + background = ColorBackground.getInstance(CHOOSED_GRAL); + this.setContentBackground(background); + }else{ + this.rebuid(); + background = ColorBackground.getInstance(NORMAL_GRAL); + this.setContentBackground(background); + } + } } //画标题 @@ -279,10 +308,12 @@ public class XCardSwitchButton extends XButton { label.setForeground(font.getForeground()); Background background = title.getBackground(); if (background != null) { - if(button.isShowButton()){ - background = ColorBackground.getInstance(CHOOSED_GRAL); - this.setContentBackground(background); - }else{ + if(button.isShowButton() && selectBackground != null){ + this.setContentBackground(selectBackground); + }else if (button.isShowButton() && selectBackground == null){ + background = ColorBackground.getInstance(CHOOSED_GRAL); + this.setContentBackground(background); + } else { this.setContentBackground(background); } } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index 71df9b059e..775d4c38c8 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -1,12 +1,11 @@ package com.fr.design.designer.creator.cardlayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Rectangle; +import java.awt.*; import java.beans.IntrospectionException; import javax.swing.border.Border; +import com.fr.base.background.ColorBackground; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; import com.fr.design.designer.beans.models.SelectionModel; @@ -14,19 +13,24 @@ import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormHierarchyTreePane; -import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; -import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; +import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; +import com.fr.design.mainframe.widget.editors.FontEditor; +import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; +import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.Background; import com.fr.general.Inter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.core.PropertyChangeAdapter; + /** * @author focus @@ -37,8 +41,13 @@ public class XWTabFitLayout extends XWFitLayout { private static final int MIN_SIZE = 1; // tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件 // 这里先将拖拽之前的宽高先做备份 + public static final Color NORMAL_GRAL = new Color(236,236,236); + public static final Color CHOOSED_GRAL = new Color(222,222,222); private Dimension referDim; - + private Background initialBackground; + private Background overBackground; + private Background clickBackground; + private XCardSwitchButton xCardSwitchButton; public Dimension getReferDim() { return referDim; @@ -48,6 +57,38 @@ public class XWTabFitLayout extends XWFitLayout { this.referDim = referDim; } + public Background getInitialBackground() { + return initialBackground; + } + + public void setInitialBackground(Background initialBackground) { + this.initialBackground = initialBackground; + } + + public Background getOverBackground() { + return overBackground; + } + + public void setOverBackground(Background overBackground) { + this.overBackground = overBackground; + } + + public Background getClickBackground() { + return clickBackground; + } + + public void setClickBackground(Background clickBackground) { + this.clickBackground = clickBackground; + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } + public XWTabFitLayout(){ this(new WTabFitLayout(), new Dimension()); } @@ -62,15 +103,118 @@ public class XWTabFitLayout extends XWFitLayout { * @throws IntrospectionException */ public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - return new CRPropertyDescriptor[] { - new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter - .getLocText("FR-Designer_Form-Widget_Name")), - new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) - .setI18NName(Inter.getLocText("FR-Designer_Layout-Padding")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), - }; + checkButonType(); + CRPropertyDescriptor[] crp = ((WTabFitLayout) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle(); + return ArrayUtils.addAll(super.supportedDescriptor(), crp); } - + + protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException { + return new CRPropertyDescriptor[]{ + //标题样式 + creatNonListenerStyle(0).setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + checkButonType(); + } + }), + //初始背景 + creatNonListenerStyle(1).setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + initialBackground = ((WTabFitLayout) data).getInitialBackground(); + xCardSwitchButton.setSelectBackground(null); + xCardSwitchButton.setSelectBackground(initialBackground); + CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData(); + cardSwitchButton.setInitialBackground(initialBackground); + } + }), + //鼠标浮动背景 + creatNonListenerStyle(2).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + overBackground = ((WTabFitLayout) data).getOverBackground(); + CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData(); + cardSwitchButton.setOverBackground(overBackground); + } + }), + //鼠标点击背景 + creatNonListenerStyle(3).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + clickBackground = ((WTabFitLayout) data).getClickBackground(); + CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData(); + cardSwitchButton.setClickBackground(clickBackground); + } + } + ), + //字体 + creatNonListenerStyle(4).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + } + }), + }; + } + + protected CRPropertyDescriptor[] getisnotCustomStyle() throws IntrospectionException { + return new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"Title", "Style"})).setEditorClass( + ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + checkButonType(); + } + }) + }; + + } + + protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{ + CRPropertyDescriptor[] crPropertyDescriptors = { + new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( + Inter.getLocText(new String[]{"Title", "Style"})).setEditorClass( + ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Initial")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Over")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_FRFont")) + .setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + }; + return crPropertyDescriptors[i]; + } + + private void checkButonType() { + if (this.xCardSwitchButton == null) { + return; + } + boolean isStyle = ((WTabFitLayout) data).isCustomStyle(); + Background bg; + bg = ColorBackground.getInstance(NORMAL_GRAL); + if (!isStyle) { + this.xCardSwitchButton.setCustomStyle(false); + this.xCardSwitchButton.setSelectBackground(bg); + } else { + CardSwitchButton cardSwitchButton = (CardSwitchButton) this.xCardSwitchButton.toData(); + Background initialBackground = cardSwitchButton.getInitialBackground(); + bg = initialBackground == null ? bg : initialBackground; + this.xCardSwitchButton.setSelectBackground(bg); + this.xCardSwitchButton.setCustomStyle(true); + cardSwitchButton.setCustomStyle(true); + } + } + @Override public LayoutAdapter getLayoutAdapter() { return new FRTabFitLayoutAdapter(this); From a73679be40d4ce5bbdeddb1f4459976403fb3243 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 4 Jan 2017 16:10:48 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/cardlayout/XCardSwitchButton.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 5f8385aadb..c5b51560c1 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -59,7 +59,7 @@ public class XCardSwitchButton extends XButton { private static final int FONT_SIZE_ADJUST = 2; private Background selectBackground; - protected boolean isCustomStyle; + private boolean isCustomStyle; From 80b069f065fbc14770c7b7c421ac31c26703f088 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 4 Jan 2017 16:12:30 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XCardSwitchButton.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index c5b51560c1..596b9224f6 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -46,6 +46,10 @@ public class XCardSwitchButton extends XButton { private XWCardTagLayout tagLayout; private static final int LEFT_GAP = 16; + private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); + private static String COLORBACKGROUNDTYPE = "ColorBackground"; + private static String DEFAULTTYPE = "default"; + public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color CHOOSED_GRAL = new Color(222,222,222); @@ -60,12 +64,7 @@ public class XCardSwitchButton extends XButton { private Background selectBackground; private boolean isCustomStyle; - - - - private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); - private static String COLORBACKGROUNDTYPE = "ColorBackground"; - private static String DEFAULTTYPE = "default"; + private Icon closeIcon = MOUSE_COLSE; From f08d6748e234d3f14da7b8f7ad9a2331a977be2a Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 4 Jan 2017 16:16:38 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/cardlayout/XCardSwitchButton.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 596b9224f6..a6e4790b13 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -47,8 +47,8 @@ public class XCardSwitchButton extends XButton { private static final int LEFT_GAP = 16; private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); - private static String COLORBACKGROUNDTYPE = "ColorBackground"; - private static String DEFAULTTYPE = "default"; + private static final String COLORBACKGROUNDTYPE = "ColorBackground"; + private static final String DEFAULTTYPE = "default"; public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color CHOOSED_GRAL = new Color(222,222,222); From 36624f09ce9a2b5a40dbb021943d8387ea02e348 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 4 Jan 2017 16:34:26 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XCardSwitchButton.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index a6e4790b13..bcd38dbf2a 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -42,26 +42,29 @@ import com.fr.general.Inter; */ public class XCardSwitchButton extends XButton { - private XWCardLayout cardLayout; - private XWCardTagLayout tagLayout; - private static final int LEFT_GAP = 16; private static Icon MOUSE_COLSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); + + //设置的图片类型 private static final String COLORBACKGROUNDTYPE = "ColorBackground"; private static final String DEFAULTTYPE = "default"; + //默认颜色 public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color CHOOSED_GRAL = new Color(222,222,222); - + private static final int MIN_SIZE = 1; - + // 删除按钮识别区域偏移量 private static final int RIGHT_OFFSET = 15; private static final int TOP_OFFSET = 25; - + // tab按钮里的字体因为按钮内部的布局看起来比正常的要小,加个调整量 private static final int FONT_SIZE_ADJUST = 2; + private XWCardLayout cardLayout; + private XWCardTagLayout tagLayout; + private Background selectBackground; private boolean isCustomStyle; From 1067c1241d2fe80052005aa1aaaf7c8a69d53192 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Thu, 5 Jan 2017 19:57:10 +0800 Subject: [PATCH 15/17] =?UTF-8?q?REPORT-576=20button=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BE=E7=89=87=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与参数面板中的button的设置保持一致。 --- .../design/designer/creator/cardlayout/XCardAddButton.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index 0e8fb4ce45..83427316a5 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -1,13 +1,12 @@ package com.fr.design.designer.creator.cardlayout; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.event.MouseEvent; import javax.swing.Icon; import com.fr.base.BaseUtils; +import com.fr.base.background.ColorBackground; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; @@ -147,6 +146,7 @@ public class XCardAddButton extends XButton{ CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName); //设置标题 titleButton.setText(getTabTitleName()); + titleButton.setInitialBackground(ColorBackground.getInstance(Color.WHITE)); XCardSwitchButton showButton = new XCardSwitchButton(titleButton,dimension,cardLayout,tagLayout); titleButton.setShowButton(true); showButton.setBackupParent(tagLayout); From 7fb57025562d552440813e48f08dae55e15f8c3b Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 6 Jan 2017 10:01:37 +0800 Subject: [PATCH 16/17] =?UTF-8?q?REPORT-1384=20=E6=8C=89=E9=92=AE=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../background/BackgroundButtonPane.java | 53 ++++++++++++ .../style/background/BackgroundFactory.java | 34 +++++++- .../background/impl/ImageBackgroundPane.java | 29 ++++--- .../impl/ImageButtonBackgroundPane.java | 80 +++++++++++++++++++ .../AccessibleImgBackgroundEditor.java | 13 ++- 5 files changed, 190 insertions(+), 19 deletions(-) create mode 100644 designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java create mode 100644 designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java diff --git a/designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java b/designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java new file mode 100644 index 0000000000..296ee746e3 --- /dev/null +++ b/designer_base/src/com/fr/design/style/background/BackgroundButtonPane.java @@ -0,0 +1,53 @@ +package com.fr.design.style.background; + +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Background; +import com.fr.general.Inter; + +/** + * Created by ibm on 2017/1/5. + */ +public class BackgroundButtonPane extends BackgroundPane { + + + public BackgroundButtonPane() { + super(); + } + + protected void initTabPane() { + int index = 0; + for (Class key : BackgroundFactory.buttonKindsOfKey()) { + BackgroundUIWrapper wrapper = BackgroundFactory.getButtonWrapper(key); + wrapper.setIndex(index++); + tabbedPane.addTab(Inter.getLocText(wrapper.getTitle()), FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane()); + } + } + + protected BackgroundUIWrapper getBackgroundUIWrapper(Background background) { + return BackgroundFactory.getButtonWrapper(background == null ? null : background.getClass()); + } + + protected BackgroundDetailPane getTabItemPane(Background background, int index) { + BackgroundDetailPane quickPane = cacheMap.get(index); + if (quickPane == null) { + quickPane = BackgroundFactory.createButtonIfAbsent(background == null ? null : background.getClass()); + quickPane.addChangeListener(backgroundChangeListener); + cacheMap.put(index, quickPane); + } + tabbedPane.setComponentAt(index, quickPane); + tabbedPane.setSelectedIndex(index); + return quickPane; + } + + protected BackgroundDetailPane getTabItemPaneByIndex(int index) { + BackgroundDetailPane quickPane = cacheMap.get(index); + if (quickPane == null) { + quickPane = BackgroundFactory.createButtonIfAbsent(index); + tabbedPane.setComponentAt(index, quickPane); + cacheMap.put(index, quickPane); + quickPane.addChangeListener(backgroundChangeListener); + } + return quickPane; + } + +} diff --git a/designer_base/src/com/fr/design/style/background/BackgroundFactory.java b/designer_base/src/com/fr/design/style/background/BackgroundFactory.java index 25bf0b5b53..db495bed75 100644 --- a/designer_base/src/com/fr/design/style/background/BackgroundFactory.java +++ b/designer_base/src/com/fr/design/style/background/BackgroundFactory.java @@ -3,7 +3,6 @@ package com.fr.design.style.background; import com.fr.base.background.*; import com.fr.design.ExtraDesignClassManager; -import com.fr.design.fun.BackgroundQuickUIProvider; import com.fr.design.fun.BackgroundUIProvider; import com.fr.design.style.background.gradient.GradientBackgroundPane; import com.fr.design.style.background.impl.*; @@ -21,6 +20,7 @@ public class BackgroundFactory { private static Map, BackgroundUIWrapper> map = new LinkedHashMap<>(); private static Map, BackgroundUIWrapper> browser = new LinkedHashMap<>(); + private static Map, BackgroundUIWrapper> button = new LinkedHashMap<>(); static { registerUniversal(map); @@ -29,6 +29,7 @@ public class BackgroundFactory { registerBrowserImageBackground(browser); registerExtra(map); registerExtra(browser); + registerButtonBackground(button); } private static void registerUniversal(Map, BackgroundUIWrapper> map) { @@ -54,6 +55,14 @@ public class BackgroundFactory { .setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("Image"))); } + private static void registerButtonBackground(Map, BackgroundUIWrapper> map){ + map.put(ColorBackground.class, BackgroundUIWrapper.create() + .setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("Color"))); + map.put(ImageBackground.class, BackgroundUIWrapper.create() + .setType(ImageButtonBackgroundPane.class).setTitle(Inter.getLocText("Image"))); + + } + private static void registerExtra(Map, BackgroundUIWrapper> map) { Set set = ExtraDesignClassManager.getInstance().getArray(BackgroundUIProvider.MARK_STRING); for (BackgroundUIProvider provider : set) { @@ -85,6 +94,29 @@ public class BackgroundFactory { return new NullBackgroundPane(); } + public static Set> buttonKindsOfKey() { + return button.keySet(); + } + + public static BackgroundUIWrapper getButtonWrapper(Class category) { + return button.get(category); + } + + public static BackgroundDetailPane createButtonIfAbsent(Class category) { + BackgroundUIWrapper wrapper = button.get(category); + return createByWrapper(wrapper); + } + + public static BackgroundDetailPane createButtonIfAbsent(int index) { + for (BackgroundUIWrapper wrapper : button.values()) { + if (wrapper.getIndex() == index) { + return createByWrapper(wrapper); + } + } + return new NullBackgroundPane(); + } + + public static Set> browserKindsOfKey() { return browser.keySet(); } diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java index 62ad05485f..0e05c82726 100644 --- a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java +++ b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java @@ -28,11 +28,11 @@ import java.io.File; */ public class ImageBackgroundPane extends BackgroundDetailPane { - private ImagePreviewPane previewPane = null; + protected ImagePreviewPane previewPane = null; private Style imageStyle = null; private ChangeListener changeListener = null; private ImageFileChooser imageFileChooser = null; - private UILabel imageSizeLabel = new UILabel(); + protected UILabel imageSizeLabel = new UILabel(); protected JRadioButton defaultRadioButton = null; protected JRadioButton tiledRadioButton = null; @@ -49,14 +49,20 @@ public class ImageBackgroundPane extends BackgroundDetailPane { JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preview")); previewOwnerPane.setLayout(new BorderLayout()); previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); - - + previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); previewPane = new ImagePreviewPane(); previewOwnerPane.add(new JScrollPane(previewPane)); previewPane.addChangeListener(imageSizeChangeListener); + + // init image file chooser. + imageFileChooser = new ImageFileChooser(); + imageFileChooser.setMultiSelectionEnabled(false); + } + + public JPanel initSelectFilePane(){ JPanel selectFilePane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - previewContainerPane.add(selectFilePane, BorderLayout.EAST); + selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0)); UIButton selectPictureButton = new UIButton( @@ -91,10 +97,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { layoutBG.add(adjustRadioButton); defaultRadioButton.setSelected(true); - - // init image file chooser. - imageFileChooser = new ImageFileChooser(); - imageFileChooser.setMultiSelectionEnabled(false); + return selectFilePane; } protected JRadioButton[] imageLayoutButtons() { @@ -121,8 +124,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { CoreGraphHelper.waitForImage(image); previewPane.setImage(image); - setImageStyle(); - previewPane.setImageStyle(imageStyle); + imageStyleRepaint(); previewPane.repaint(); } else { previewPane.setImage(null); @@ -133,6 +135,11 @@ public class ImageBackgroundPane extends BackgroundDetailPane { } }; + public void imageStyleRepaint(){ + setImageStyle(); + previewPane.setImageStyle(imageStyle); + } + private void setImageStyle() { if (tiledRadioButton.isSelected()) { imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java b/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java new file mode 100644 index 0000000000..12fb981414 --- /dev/null +++ b/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java @@ -0,0 +1,80 @@ +package com.fr.design.style.background.impl; + +import com.fr.base.BaseUtils; +import com.fr.base.Style; +import com.fr.base.background.ImageBackground; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.general.Background; +import com.fr.general.Inter; +import com.fr.stable.Constants; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by ibm on 2017/1/5. + */ +public class ImageButtonBackgroundPane extends ImageBackgroundPane { + private UIButton chooseButton; + private UIButton clearButton; + + public ImageButtonBackgroundPane(){ + super(); + Style imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); + previewPane.setImageStyle(imageStyle); + } + + public JPanel initSelectFilePane(){ + + JPanel choosePane = new JPanel(new BorderLayout(0, 10)); + choosePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + JPanel choosePane1 = new JPanel(new BorderLayout(0, 10)); + initButton(); + + choosePane.add(chooseButton, BorderLayout.NORTH); + + choosePane1.add(clearButton,BorderLayout.NORTH); + choosePane.add(choosePane1,BorderLayout.CENTER); + + imageSizeLabel.setHorizontalAlignment(SwingConstants.CENTER); + choosePane1.add(imageSizeLabel,BorderLayout.CENTER); + this.add(choosePane,BorderLayout.EAST); + + return choosePane; + } + + private void initButton() { + chooseButton = new UIButton(Inter.getLocText("Image-Select_Picture")); + chooseButton.addActionListener(selectPictureActionListener); + clearButton = new UIButton(Inter.getLocText("Clear")); + clearButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + previewPane.setImage(null); + previewPane.repaint(); + } + }); + } + + public void imageStyleRepaint(){ + + } + + + public void populate(Background background) { + if(background != null && background instanceof ImageBackground){ + ImageBackground imageBackground = (ImageBackground) background; + if(imageBackground.getImage() != null) { + previewPane.setImage(imageBackground.getImage()); + } + } + + } + + public Background update() { + if(previewPane.getImage() == null) { + return null; + } + return new ImageBackground(previewPane.getImage()); + } +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java index 0350704960..8def747683 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleImgBackgroundEditor.java @@ -1,17 +1,16 @@ package com.fr.design.mainframe.widget.accessibles; import java.awt.Dimension; - import javax.swing.SwingUtilities; - -import com.fr.base.background.ImageBackground; +import com.fr.base.background.ColorBackground; import com.fr.design.mainframe.widget.wrappers.BackgroundWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.gui.frpane.ImgChoosePane; +import com.fr.design.style.background.BackgroundButtonPane; +import com.fr.general.Background; public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor { - private ImgChoosePane choosePane; + private BackgroundButtonPane choosePane; public AccessibleImgBackgroundEditor() { super(new BackgroundWrapper()); @@ -20,7 +19,7 @@ public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor { @Override protected void showEditorPane() { if (choosePane == null) { - choosePane = new ImgChoosePane(); + choosePane = new BackgroundButtonPane(); choosePane.setPreferredSize(new Dimension(600, 400)); } BasicDialog dlg = choosePane.showWindow(SwingUtilities.getWindowAncestor(this)); @@ -32,7 +31,7 @@ public class AccessibleImgBackgroundEditor extends UneditableAccessibleEditor { fireStateChanged(); } }); - choosePane.populate(getValue() instanceof ImageBackground ? (ImageBackground) getValue() : null); + choosePane.populate(getValue() instanceof Background ? (Background) getValue() : new ColorBackground()); dlg.setVisible(true); } } \ No newline at end of file From 3e1bf1e4bac1eafd54054d69df43a8900ab54fbf Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 6 Jan 2017 13:50:43 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E4=BF=AE=E6=94=B9PMD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 8 ++++++ .../design/locale/designer_en_US.properties | 8 ++++++ .../design/locale/designer_ja_JP.properties | 8 ++++++ .../design/locale/designer_ko_KR.properties | 8 ++++++ .../design/locale/designer_zh_CN.properties | 8 ++++++ .../design/locale/designer_zh_TW.properties | 8 ++++++ .../style/background/BackgroundFactory.java | 18 ++++++------- .../background/impl/ImageBackgroundPane.java | 26 +++++++++---------- .../impl/ImageBackgroundPane4Browser.java | 5 ++-- .../impl/ImageButtonBackgroundPane.java | 5 ++-- 10 files changed, 75 insertions(+), 27 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 9f7923265c..f97208a310 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -510,3 +510,11 @@ FR-Designer_Create_Tree= FR-Designer_Set_Callback_Function= FR-Designer_ConfirmDialog_Content= FR-Designer_ConfirmDialog_Title= +FR-Designer_Background_Null= +FR-Designer_Background_Color= +FR-Designer_Background_Texture= +FR-Designer_Background_Pattern= +FR-Designer_Background_Gradient_Color= +FR-Designer_Background_Image= +FR-Designer_Background_Clear= +FR-Designer_Background_Image_Select= 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 b21847d0e4..495ebed06d 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 @@ -510,3 +510,11 @@ FR-Designer_Create_Tree=Build Tree FR-Designer_Set_Callback_Function=Set Callback Function FR-Designer_ConfirmDialog_Content= FR-Designer_ConfirmDialog_Title= +FR-Designer_Background_Null=No Background +FR-Designer_Background_Color=Color +FR-Designer_Background_Texture=Texture +FR-Designer_Background_Pattern=Pattern +FR-Designer_Background_Gradient_Color=Gradient Color +FR-Designer_Background_Image=Image +FR-Designer_Background_Clear=Clear +FR-Designer_Background_Image_Select=Select Picture 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 5ec06064b1..c60ce8891d 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 @@ -489,3 +489,11 @@ FR-Designer_Create_Tree= FR-Designer_Set_Callback_Function= FR-Designer_ConfirmDialog_Content= FR-Designer_ConfirmDialog_Title= +FR-Designer_Background_Null= +FR-Designer_Background_Color= +FR-Designer_Background_Texture= +FR-Designer_Background_Pattern= +FR-Designer_Background_Gradient_Color= +FR-Designer_Background_Image= +FR-Designer_Background_Clear= +FR-Designer_Background_Image_Select= 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 3e27c558fb..079af536db 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 @@ -484,3 +484,11 @@ FR-Designer_Create_Tree= FR-Designer_Set_Callback_Function= FR-Designer_ConfirmDialog_Content= FR-Designer_ConfirmDialog_Title= +FR-Designer_Background_Null= +FR-Designer_Background_Color= +FR-Designer_Background_Texture= +FR-Designer_Background_Pattern= +FR-Designer_Background_Gradient_Color= +FR-Designer_Background_Image= +FR-Designer_Background_Clear= +FR-Designer_Background_Image_Select= 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 d43f8746bb..a40f6d3a4c 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 @@ -514,3 +514,11 @@ FR-Designer_Create_Tree=\u6784\u5EFA\u6811 FR-Designer_Set_Callback_Function=\u8BBE\u7F6E\u56DE\u8C03\u51FD\u6570 FR-Designer_ConfirmDialog_Content=\u662F\u5426\u786E\u5B9A\u5220\u9664tab\u63A7\u4EF6 FR-Designer_ConfirmDialog_Title=FineReport 8.0 +FR-Designer_Background_Null=\u6CA1\u6709\u80CC\u666F +FR-Designer_Background_Color=\u989C\u8272 +FR-Designer_Background_Texture=\u7EB9\u7406 +FR-Designer_Background_Pattern=\u56FE\u6848 +FR-Designer_Background_Gradient_Color=\u6E10\u53D8\u8272 +FR-Designer_Background_Image=\u56FE\u7247 +FR-Designer_Background_Clear=\u6E05\u9664 +FR-Designer_Background_Image_Select=\u9009\u62E9\u56FE\u7247 \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 58868eb0db..8392f1fdb1 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 @@ -502,3 +502,11 @@ FR-Designer_Create_Tree= FR-Designer_Set_Callback_Function= FR-Designer_ConfirmDialog_Content= FR-Designer_ConfirmDialog_Title= +FR-Designer_Background_Null= +FR-Designer_Background_Color= +FR-Designer_Background_Texture= +FR-Designer_Background_Pattern= +FR-Designer_Background_Gradient_Color= +FR-Designer_Background_Image= +FR-Designer_Background_Clear= +FR-Designer_Background_Image_Select= diff --git a/designer_base/src/com/fr/design/style/background/BackgroundFactory.java b/designer_base/src/com/fr/design/style/background/BackgroundFactory.java index db495bed75..d636eb3a30 100644 --- a/designer_base/src/com/fr/design/style/background/BackgroundFactory.java +++ b/designer_base/src/com/fr/design/style/background/BackgroundFactory.java @@ -34,32 +34,32 @@ public class BackgroundFactory { private static void registerUniversal(Map, BackgroundUIWrapper> map) { map.put(null, BackgroundUIWrapper.create() - .setType(NullBackgroundPane.class).setTitle(Inter.getLocText("Background-Null"))); + .setType(NullBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Null"))); map.put(ColorBackground.class, BackgroundUIWrapper.create() - .setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("Color"))); + .setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color"))); map.put(TextureBackground.class, BackgroundUIWrapper.create() - .setType(TextureBackgroundPane.class).setTitle(Inter.getLocText("Background-Texture"))); + .setType(TextureBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Texture"))); map.put(PatternBackground.class, BackgroundUIWrapper.create() - .setType(PatternBackgroundPane.class).setTitle(Inter.getLocText("Background-Pattern"))); + .setType(PatternBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Pattern"))); map.put(GradientBackground.class, BackgroundUIWrapper.create() - .setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("Gradient-Color"))); + .setType(GradientBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Gradient_Color"))); } private static void registerImageBackground(Map, BackgroundUIWrapper> map) { map.put(ImageBackground.class, BackgroundUIWrapper.create() - .setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("Image"))); + .setType(ImageBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image"))); } private static void registerBrowserImageBackground(Map, BackgroundUIWrapper> map) { map.put(ImageBackground.class, BackgroundUIWrapper.create() - .setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("Image"))); + .setType(ImageBackgroundPane4Browser.class).setTitle(Inter.getLocText("FR-Designer_Background_Image"))); } private static void registerButtonBackground(Map, BackgroundUIWrapper> map){ map.put(ColorBackground.class, BackgroundUIWrapper.create() - .setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("Color"))); + .setType(ColorBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Color"))); map.put(ImageBackground.class, BackgroundUIWrapper.create() - .setType(ImageButtonBackgroundPane.class).setTitle(Inter.getLocText("Image"))); + .setType(ImageButtonBackgroundPane.class).setTitle(Inter.getLocText("FR-Designer_Background_Image"))); } diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java index 0e05c82726..ced818426c 100644 --- a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java +++ b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane.java @@ -34,10 +34,10 @@ public class ImageBackgroundPane extends BackgroundDetailPane { private ImageFileChooser imageFileChooser = null; protected UILabel imageSizeLabel = new UILabel(); - protected JRadioButton defaultRadioButton = null; - protected JRadioButton tiledRadioButton = null; - private JRadioButton extendRadioButton = null; - private JRadioButton adjustRadioButton = null; + protected UIRadioButton defaultRadioButton = null; + protected UIRadioButton tiledRadioButton = null; + private UIRadioButton extendRadioButton = null; + private UIRadioButton adjustRadioButton = null; public ImageBackgroundPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -46,7 +46,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); this.add(previewContainerPane, BorderLayout.CENTER); - JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("Preview")); + JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Preview")); previewOwnerPane.setLayout(new BorderLayout()); previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); @@ -66,7 +66,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { selectFilePane.setBorder(BorderFactory.createEmptyBorder(8, 2, 4, 0)); UIButton selectPictureButton = new UIButton( - Inter.getLocText("Image-Select_Picture")); + Inter.getLocText("FR-Designer_Background_Image_Select")); selectFilePane.add(selectPictureButton, BorderLayout.NORTH); selectPictureButton.setMnemonic('S'); selectPictureButton.addActionListener(selectPictureActionListener); @@ -74,10 +74,10 @@ public class ImageBackgroundPane extends BackgroundDetailPane { selectFilePane.add(layoutPane, BorderLayout.CENTER); //布局 - defaultRadioButton = new UIRadioButton(Inter.getLocText("Default")); - tiledRadioButton = new UIRadioButton(Inter.getLocText("Image-Titled")); - extendRadioButton = new UIRadioButton(Inter.getLocText("Image-Extend")); - adjustRadioButton = new UIRadioButton(Inter.getLocText("Image-Adjust")); + defaultRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Default")); + tiledRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Titled")); + extendRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Extend")); + adjustRadioButton = new UIRadioButton(Inter.getLocText("FR-Designer-StyleAlignment_Layout_Image_Adjust")); defaultRadioButton.addActionListener(layoutActionListener); tiledRadioButton.addActionListener(layoutActionListener); @@ -85,7 +85,7 @@ public class ImageBackgroundPane extends BackgroundDetailPane { adjustRadioButton.addActionListener(layoutActionListener); JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15)); - for (JRadioButton button : imageLayoutButtons()) { + for (UIRadioButton button : imageLayoutButtons()) { jp.add(button); } layoutPane.add(jp); @@ -100,8 +100,8 @@ public class ImageBackgroundPane extends BackgroundDetailPane { return selectFilePane; } - protected JRadioButton[] imageLayoutButtons() { - return new JRadioButton[]{ + protected UIRadioButton[] imageLayoutButtons() { + return new UIRadioButton[]{ defaultRadioButton, tiledRadioButton, extendRadioButton, diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java index 4d15f18ac3..431ad2c0d1 100644 --- a/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java +++ b/designer_base/src/com/fr/design/style/background/impl/ImageBackgroundPane4Browser.java @@ -1,5 +1,6 @@ package com.fr.design.style.background.impl; +import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.stable.ArrayUtils; import javax.swing.*; @@ -15,9 +16,9 @@ public class ImageBackgroundPane4Browser extends ImageBackgroundPane { } @Override - protected JRadioButton[] imageLayoutButtons() { + protected UIRadioButton[] imageLayoutButtons() { - return (JRadioButton[]) ArrayUtils.addAll(super.imageLayoutButtons(), new JRadioButton[] { + return (UIRadioButton[]) ArrayUtils.addAll(super.imageLayoutButtons(), new UIRadioButton[] { defaultRadioButton, tiledRadioButton, }); diff --git a/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java b/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java index 12fb981414..b72e67bae7 100644 --- a/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java +++ b/designer_base/src/com/fr/design/style/background/impl/ImageButtonBackgroundPane.java @@ -1,6 +1,5 @@ package com.fr.design.style.background.impl; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.background.ImageBackground; import com.fr.design.gui.ibutton.UIButton; @@ -45,9 +44,9 @@ public class ImageButtonBackgroundPane extends ImageBackgroundPane { } private void initButton() { - chooseButton = new UIButton(Inter.getLocText("Image-Select_Picture")); + chooseButton = new UIButton(Inter.getLocText("FR-Designer_Background_Image_Select")); chooseButton.addActionListener(selectPictureActionListener); - clearButton = new UIButton(Inter.getLocText("Clear")); + clearButton = new UIButton(Inter.getLocText("FR-Designer_Background_Clear")); clearButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { previewPane.setImage(null);