From bcb2311ac9cff45926ba6ba6ecb0083d063e7e80 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 10:09:46 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/ChartTypeButtonPane.java | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index aeb9cb0d96..082037aa48 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,13 +4,19 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; +import com.fr.chart.chartglyph.ChangeConfigAttr; +import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.charttypes.ColumnIndependentChart; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chart.series.SeriesCondition.impl.LinePlotDataSeriesConditionPane; +import com.fr.design.dialog.DialogActionListener; +import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.imenutable.UIMenuNameableCreator; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.general.ComparatorUtils; @@ -18,6 +24,8 @@ import com.fr.general.FRLogger; import com.fr.general.Inter; import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.*; import java.awt.geom.Rectangle2D; @@ -47,8 +55,12 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private ChartTypePane parent = null; + //记录鼠标当前是否在操作添加按钮 private boolean mouseOnChartTypeButtonPane = false; + //配置窗口属性 + private UIMenuNameableCreator configCreator; + /** * 鼠标事件是否在这个面板 * @return 返回是否 @@ -98,10 +110,26 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen button.add(configButton); eastPane.add(button, BorderLayout.NORTH); + initAddButton(); + initConfigButton(); + initConfigCreator(); + + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + + private void initConfigCreator() { + + } + + private void initAddButton() { addButton.setPreferredSize(new Dimension(20, 20)); addButton.addActionListener(addListener); addButton.addMouseListener(mouseListener); - Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + } + + private void initConfigButton() { + configButton.setPreferredSize(new Dimension(20, 20)); + configButton.addActionListener(configListener); } ActionListener addListener = new ActionListener() { @@ -136,6 +164,33 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } }; + ActionListener configListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + } + }; + + /** + * 响应事件 + */ + public void fireTargetChanged() { + this.validate(); + this.repaint(); + this.revalidate(); + fireChanged(); + } + + protected void fireChanged() { + Object[] listeners = listenerList.getListenerList(); + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + ((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this)); + } + } + } + MouseListener mouseListener = new MouseAdapter() { @Override public void mouseExited(MouseEvent e) { From 4cd780bd3a71f1b94ca23e3fab140fc653b92c89 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 10:13:54 +0800 Subject: [PATCH 2/7] update --- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 082037aa48..37d17eee7c 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,11 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; -import com.fr.chart.chartglyph.ChangeConfigAttr; -import com.fr.chart.chartglyph.ConditionAttr; -import com.fr.chart.charttypes.ColumnIndependentChart; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chart.series.SeriesCondition.impl.LinePlotDataSeriesConditionPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; import com.fr.design.event.UIObserver; @@ -118,7 +114,6 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigCreator() { - } private void initAddButton() { @@ -167,7 +162,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen ActionListener configListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - + } }; From a3a1a1044cff5c9767efe333a6614e94e212834d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 13:49:45 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/layout/TableLayoutHelper.java | 34 ++++ .../mainframe/chart/gui/ChangeConfigPane.java | 145 ++++++++++++++++++ .../chart/gui/ChartTypeButtonPane.java | 37 +++-- .../gui/ColorSelectBoxWithOutTransparent.java | 20 +++ .../ColorSelectPaneWithOutTransparent.java | 33 ++++ 5 files changed, 250 insertions(+), 19 deletions(-) create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java create mode 100644 designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java diff --git a/designer_base/src/com/fr/design/layout/TableLayoutHelper.java b/designer_base/src/com/fr/design/layout/TableLayoutHelper.java index 97dcf816b9..b15aa99ba7 100644 --- a/designer_base/src/com/fr/design/layout/TableLayoutHelper.java +++ b/designer_base/src/com/fr/design/layout/TableLayoutHelper.java @@ -47,6 +47,40 @@ public class TableLayoutHelper { return createCommonTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM); } + /** + * 标题布局(二级菜单距左边框46) + * @param title 标题 + * @param component 组件 + * @return 布局好的组件 + */ + public static JPanel createTableLayoutPaneWithTitle(String title, Component component){ + return createTitlePane(title, component, LayoutConstants.CHART_ATTR_TOMARGIN); + } + + public static JPanel createTitlePane(String title, Component component, int gap){ + return createTitlePaneWithUILabel(new UILabel(title), component, gap); + } + + /** + * 标题布局(指定gap) + * @param label 标题label + * @param component 组件 + * @param gap 距左侧距离 + * @return 布局好的组件 + */ + public static JPanel createTitlePaneWithUILabel(UILabel label, Component component, int gap){ + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {gap, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{label,null}, + new Component[]{null,component}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + public static JPanel createCommonTableLayoutPane(Component[][] components, double[] rowSize, double[] columnSize, double gap) { return createGapTableLayoutPane(components, rowSize, columnSize, gap, gap); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java new file mode 100644 index 0000000000..5c65bc276e --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -0,0 +1,145 @@ +package com.fr.design.mainframe.chart.gui; + +/** + * Created by hufan on 2016/10/20. + */ + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.general.Inter; +import com.fr.third.org.hsqldb.lib.Collection; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 图表切换设置面板 + */ +public class ChangeConfigPane extends BasicBeanPane { + private JPanel contentPane; + //配置方式按钮 + private UIButtonGroup configStyleButton; + //配置界面 + private JPanel configPane; + //按钮切换方式配置界面 + private JPanel buttonConfigPane; + private ChartTextAttrPane textAttrPane; + private ColorSelectBoxWithOutTransparent colorSelectBox; + //轮播切换方式配置接界面 + private JPanel carouselConfigPane; + + public ChangeConfigPane(){ + initButtonGroup(); + contentPane = createContentPane(); + configPane = createConfigPane(); + this.add(contentPane, BorderLayout.CENTER); + } + + private JPanel createContentPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, + new Component[]{new JSeparator(), null}, + new Component[]{configPane, null}, + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + private JPanel createConfigPane() { + + buttonConfigPane = createButtonConfigPane(); + carouselConfigPane = createCarouseConfigPane(); + + JPanel panel = new JPanel(new CardLayout()){ + @Override + public Dimension getPreferredSize() { + if(configStyleButton.getSelectedIndex() == 0){ + return new Dimension(buttonConfigPane.getWidth(), 0); + } else{ + return carouselConfigPane.getPreferredSize(); + } + } + }; + + panel.add(buttonConfigPane, "button"); + panel.add(carouselConfigPane, "carousel"); + + return panel; + } + + private JPanel createCarouseConfigPane() { + return new JPanel(); + } + + private JPanel createTitleStylePane(){ + textAttrPane = new ChartTextAttrPane(); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + } + + + private JPanel createBackgroundColorPane(){ + colorSelectBox = new ColorSelectBoxWithOutTransparent(100); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + } + + private JPanel createButtonConfigPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{createTitleStylePane(),null}, + new Component[]{new JSeparator(),null}, + new Component[]{createBackgroundColorPane(),null}, + }; + + return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + } + + private void initButtonGroup() { + configStyleButton = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Button_Style"), + Inter.getLocText("Plugin-ChartF_Carousel_Style")}); + configStyleButton.setSelectedIndex(0); + configStyleButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) configPane.getLayout(); + if (configStyleButton.getSelectedIndex() == 0) { + cardLayout.show(configPane, "button"); + } else { + cardLayout.show(configPane, "carousel"); + } + } + + @Override + public void populateBean(Collection ob) { + + } + + @Override + public Collection updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 37d17eee7c..a98e00260b 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; +import com.fr.chart.chartglyph.ChangeConfigAttr; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -114,6 +115,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void initConfigCreator() { + configCreator = new UIMenuNameableCreator(Inter.getLocText("Chart-Change_Config_Attributes"), new ChangeConfigAttr(), ChangeConfigPane.class); } private void initAddButton() { @@ -162,29 +164,26 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen ActionListener configListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - - } - }; + UIMenuNameableCreator ui = configCreator.clone(); + final Object obj = ui.getObj(); + final BasicBeanPane pane = ui.getPane(); - /** - * 响应事件 - */ - public void fireTargetChanged() { - this.validate(); - this.repaint(); - this.revalidate(); - fireChanged(); - } - protected void fireChanged() { - Object[] listeners = listenerList.getListenerList(); + UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { + @Override + public void doOk() { - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == ChangeListener.class) { - ((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this)); - } + } + + @Override + public void doCancel() { + } + }); + dialog.setSize(500, 500); + dialog.setVisible(true); } - } + }; + MouseListener mouseListener = new MouseAdapter() { @Override diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java new file mode 100644 index 0000000000..ba0b032411 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectBoxWithOutTransparent.java @@ -0,0 +1,20 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.design.style.color.ColorSelectBox; +import com.fr.design.style.color.ColorSelectPane; + +/** + * Created by Fangjie on 2016/4/8. + * 没有透明度的颜色选择器 + */ +public class ColorSelectBoxWithOutTransparent extends ColorSelectBox { + public ColorSelectBoxWithOutTransparent(int preferredWidth){ + super(preferredWidth); + } + + + @Override + protected ColorSelectPane getColorSelectPane(){ + return new ColorSelectPaneWithOutTransparent(); + } +} \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java new file mode 100644 index 0000000000..a32d5d9291 --- /dev/null +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java @@ -0,0 +1,33 @@ +package com.fr.design.mainframe.chart.gui; + +import com.fr.chart.base.ChartConstants; +import com.fr.design.style.color.ColorCell; +import com.fr.design.style.color.ColorSelectPane; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by Fangjie on 2016/4/8. + */ +public class ColorSelectPaneWithOutTransparent extends ColorSelectPane { + + public ColorSelectPaneWithOutTransparent(){ + super(false); + } + + public void initCenterPaneChildren(JPanel centerPane) { + JPanel menuColorPane1 = new JPanel(); + centerPane.add(menuColorPane1); + menuColorPane1.setLayout(new GridLayout(5, 8, 5, 5)); + for (int i = 0; i < ChartConstants.MAP_COLOR_ARRAY.length; i++) { + menuColorPane1.add(new ColorCell(ChartConstants.MAP_COLOR_ARRAY[i], this)); + } + centerPane.add(Box.createVerticalStrut(5)); + centerPane.add(new JSeparator()); + } + + protected Color[] getColorArray(){ + return ChartConstants.MAP_COLOR_ARRAY; + } +} From bf8b5b1958037904dabdc4384f7b4a0fdeb8cef8 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 20 Oct 2016 17:09:48 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 103 +++++++++++++++--- .../chart/gui/ChartTypeButtonPane.java | 15 ++- 2 files changed, 93 insertions(+), 25 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index 5c65bc276e..a0f05b0bd4 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -4,12 +4,18 @@ package com.fr.design.mainframe.chart.gui; * Created by hufan on 2016/10/20. */ +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.change.ChangeConfigAttr; +import com.fr.chart.chartattr.change.ChangeType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; 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.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.function.MAX; +import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.third.org.hsqldb.lib.Collection; @@ -23,7 +29,10 @@ import java.awt.event.ActionListener; /** * 图表切换设置面板 */ -public class ChangeConfigPane extends BasicBeanPane { +public class ChangeConfigPane extends BasicBeanPane { + private static final int WIDTH = 100; + private static final int MIN_TIME = 0; + private static final int MAX_TIME = Integer.MAX_VALUE; private JPanel contentPane; //配置方式按钮 private UIButtonGroup configStyleButton; @@ -31,15 +40,19 @@ public class ChangeConfigPane extends BasicBeanPane { private JPanel configPane; //按钮切换方式配置界面 private JPanel buttonConfigPane; - private ChartTextAttrPane textAttrPane; - private ColorSelectBoxWithOutTransparent colorSelectBox; + private ChartTextAttrPane styleAttrPane; + private ColorSelectBoxWithOutTransparent colorSelectBox4button; + //轮播切换方式配置接界面 private JPanel carouselConfigPane; + protected UISpinner timeInterval; + private ColorSelectBoxWithOutTransparent colorSelectBox4carousel; public ChangeConfigPane(){ initButtonGroup(); - contentPane = createContentPane(); configPane = createConfigPane(); + contentPane = createContentPane(); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30)); this.add(contentPane, BorderLayout.CENTER); } @@ -47,9 +60,10 @@ public class ChangeConfigPane extends BasicBeanPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = {p, f}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p,p,p,p}; Component[][] components = new Component[][]{ new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, + new Component[]{null, null}, new Component[]{new JSeparator(), null}, new Component[]{configPane, null}, }; @@ -65,7 +79,7 @@ public class ChangeConfigPane extends BasicBeanPane { @Override public Dimension getPreferredSize() { if(configStyleButton.getSelectedIndex() == 0){ - return new Dimension(buttonConfigPane.getWidth(), 0); + return buttonConfigPane.getPreferredSize(); } else{ return carouselConfigPane.getPreferredSize(); } @@ -79,18 +93,39 @@ public class ChangeConfigPane extends BasicBeanPane { } private JPanel createCarouseConfigPane() { - return new JPanel(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p,p,p}; + Component[][] components = new Component[][]{ + new Component[]{createTimeIntervalPane(),null}, + new Component[]{new JSeparator(),null}, + new Component[]{createCarouseBackgroundColorPane(),null}, + }; + + return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); + } + + private Component createTimeIntervalPane() { + timeInterval = new UISpinner(MIN_TIME, MAX_TIME, 1, 0); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Time_Interval") + ":", timeInterval); + } + + private JPanel createCarouseBackgroundColorPane() { + colorSelectBox4carousel = new ColorSelectBoxWithOutTransparent(WIDTH); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4carousel); } private JPanel createTitleStylePane(){ - textAttrPane = new ChartTextAttrPane(); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + styleAttrPane = new ChartTextAttrPane(); + styleAttrPane.setPreferredSize(new Dimension(WIDTH, (int) styleAttrPane.getPreferredSize().getHeight())); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style")+":", styleAttrPane); } - private JPanel createBackgroundColorPane(){ - colorSelectBox = new ColorSelectBoxWithOutTransparent(100); - return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); + private JPanel createButtonBackgroundColorPane(){ + colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); + return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4button); } private JPanel createButtonConfigPane() { @@ -101,7 +136,7 @@ public class ChangeConfigPane extends BasicBeanPane { Component[][] components = new Component[][]{ new Component[]{createTitleStylePane(),null}, new Component[]{new JSeparator(),null}, - new Component[]{createBackgroundColorPane(),null}, + new Component[]{createButtonBackgroundColorPane(),null}, }; return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); @@ -110,7 +145,7 @@ public class ChangeConfigPane extends BasicBeanPane { private void initButtonGroup() { configStyleButton = new UIButtonGroup(new String[]{Inter.getLocText("Plugin-ChartF_Button_Style"), Inter.getLocText("Plugin-ChartF_Carousel_Style")}); - configStyleButton.setSelectedIndex(0); + configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); configStyleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -129,17 +164,51 @@ public class ChangeConfigPane extends BasicBeanPane { } @Override - public void populateBean(Collection ob) { + public void populateBean(ChartCollection ob) { + if (ob == null){ + return; + } + ChangeConfigAttr changeConfigAttr = ob.getChangeConfigAttr(); + if (changeConfigAttr == null){ + return; + } + configStyleButton.setSelectedIndex(changeConfigAttr.getChangeType() == ChangeType.BUTTON ? 0 : 1); + + //按钮切换界面 + styleAttrPane.populate(changeConfigAttr.getStyleAttr()); + colorSelectBox4button.setSelectObject(changeConfigAttr.getButtonColor()); + + //轮播切换界面 + timeInterval.setValue(changeConfigAttr.getTimeInterval()); + colorSelectBox4carousel.setSelectObject(changeConfigAttr.getCarouselColor()); + + checkCardPane(); } @Override - public Collection updateBean() { + public ChartCollection updateBean() { return null; } + public void updateBean(ChartCollection ob) { + if (ob == null){ + return; + } + ChangeConfigAttr changeConfigAttr = ob.getChangeConfigAttr(); + if (changeConfigAttr == null){ + return; + } + + changeConfigAttr.setChangeType(configStyleButton.getSelectedIndex() == 0 ? ChangeType.BUTTON : ChangeType.CAROUSEL); + changeConfigAttr.setStyleAttr(styleAttrPane.update()); + changeConfigAttr.setButtonColor(colorSelectBox4button.getSelectObject()); + changeConfigAttr.setTimeInterval(timeInterval.getValue()); + changeConfigAttr.setCarouselColor(colorSelectBox4carousel.getSelectObject()); + } + @Override protected String title4PopupWindow() { - return null; + return Inter.getLocText("Chart-Change_Config_Attributes"); } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index a98e00260b..6c8c9ef462 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -4,7 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.SwitchState; -import com.fr.chart.chartglyph.ChangeConfigAttr; +import com.fr.chart.chartattr.change.ChangeConfigAttr; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.UIDialog; @@ -21,8 +21,6 @@ import com.fr.general.FRLogger; import com.fr.general.Inter; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.*; import java.awt.geom.Rectangle2D; @@ -39,6 +37,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int B_W = 52; private static final int B_H = 20; private static final int COL_COUNT = 3; + private static final int P_W = 300; + private static final int P_H = 400; private UIButton addButton; private UIButton configButton; @@ -165,21 +165,20 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen @Override public void actionPerformed(ActionEvent e) { UIMenuNameableCreator ui = configCreator.clone(); - final Object obj = ui.getObj(); final BasicBeanPane pane = ui.getPane(); - - + pane.populateBean(editingCollection); UIDialog dialog = pane.showUnsizedWindow(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionListener() { @Override public void doOk() { - + pane.updateBean(editingCollection); } @Override public void doCancel() { + } }); - dialog.setSize(500, 500); + dialog.setSize(P_W, P_H); dialog.setVisible(true); } }; From a1fab4d88e3432c0a55abebc3f2efa46a1c04889 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 21 Oct 2016 10:48:31 +0800 Subject: [PATCH 5/7] update --- .../fr/design/ChartTypeInterfaceManager.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 866d039667..1909c947cf 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -284,7 +284,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getChartDataPane(chartID, plotID, listener); + if (plotInChart(plotID, chartID)) { + return getChartDataPane(chartID, plotID, listener); + } } return getChartDataPane(DEFAULT_CHART_ID, plotID, listener); } @@ -310,7 +312,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getAttrPaneArray(chartID, plotID, listener); + if (plotInChart(plotID, chartID)) { + return getAttrPaneArray(chartID, plotID, listener); + } } return getAttrPaneArray(DEFAULT_CHART_ID, plotID, listener); } @@ -324,7 +328,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getTableDataSourcePane(chartID, plot, parent); + if (plotInChart(plot.getPlotID(), chartID)) { + return getTableDataSourcePane(chartID, plot, parent); + } } return getTableDataSourcePane(DEFAULT_CHART_ID, plot, parent); } @@ -339,11 +345,20 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getReportDataSourcePane(chartID, plot, parent); + String plotID = plot.getPlotID(); + if (plotInChart(plotID, chartID)) { + return getReportDataSourcePane(chartID, plot, parent); + } } return getReportDataSourcePane(DEFAULT_CHART_ID, plot, parent); } + private boolean plotInChart(String plotID, String chartID) { + return chartTypeInterfaces != null + && chartTypeInterfaces.containsKey(chartID) + && chartTypeInterfaces.get(chartID).containsKey(plotID); + } + private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); } @@ -354,7 +369,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getPlotConditionPane(chartID, plot); + if (plotInChart(plot.getPlotID(), chartID)) { + return getPlotConditionPane(chartID, plot); + } } return getPlotConditionPane(DEFAULT_CHART_ID, plot); } @@ -369,7 +386,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); String chartID = (String) entry.getKey(); - return getPlotSeriesPane(chartID, parent, plot); + if (plotInChart(plot.getPlotID(), chartID)) { + return getPlotSeriesPane(chartID, parent, plot); + } } return getPlotSeriesPane(DEFAULT_CHART_ID, parent, plot); } From 81e0e84ee0eab32794d1b34d5a5669ecb23a003d Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 21 Oct 2016 15:30:41 +0800 Subject: [PATCH 6/7] update --- .../fr/design/mainframe/chart/gui/ChangeConfigPane.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index a0f05b0bd4..89e5e57197 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -6,7 +6,7 @@ package com.fr.design.mainframe.chart.gui; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.change.ChangeConfigAttr; -import com.fr.chart.chartattr.change.ChangeType; +import com.fr.chart.chartglyph.ChangeType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; @@ -14,14 +14,9 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; -import com.fr.function.MAX; -import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import com.fr.third.org.hsqldb.lib.Collection; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; From d0274db42bf56339956f20499b32b0459d4f2e3c Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Fri, 21 Oct 2016 17:39:09 +0800 Subject: [PATCH 7/7] update --- .../chart/gui/ChartTypeButtonPane.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 6c8c9ef462..fceb0500fd 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -150,17 +150,20 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } catch (CloneNotSupportedException e1) { FRLogger.getLogger().error("Error in Clone"); } - //获取图表收集器的状态 - SwitchState state = editingCollection.calculateMultiChartMode(); - if (state.isDynamicState() && parent != null){ - parent.reactorChartTypePane(editingCollection); - } - + checkoutChange(); } layoutPane(buttonPane); } }; + //获取图表收集器的状态 + private void checkoutChange(){ + SwitchState state = editingCollection.calculateMultiChartMode(); + if (state.isDynamicState() && parent != null){ + parent.reactorChartTypePane(editingCollection); + } + } + ActionListener configListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -316,6 +319,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen layoutPane(buttonPane); checkConfigButtonVisible(); + //更新切换面板 + checkoutChange(); } private void checkConfigButtonVisible() { @@ -444,10 +449,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } //获取图表收集器的状态 - SwitchState state = editingCollection.calculateMultiChartMode(); - if (state.isDynamicState() && parent != null){ - parent.reactorChartTypePane(editingCollection); - } + checkoutChange(); relayoutPane(); }