|
|
@ -4,12 +4,18 @@ package com.fr.design.mainframe.chart.gui; |
|
|
|
* Created by hufan on 2016/10/20. |
|
|
|
* 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.beans.BasicBeanPane; |
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
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.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
|
|
|
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.general.Inter; |
|
|
|
import com.fr.third.org.hsqldb.lib.Collection; |
|
|
|
import com.fr.third.org.hsqldb.lib.Collection; |
|
|
|
|
|
|
|
|
|
|
@ -23,7 +29,10 @@ import java.awt.event.ActionListener; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 图表切换设置面板 |
|
|
|
* 图表切换设置面板 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
public class ChangeConfigPane extends BasicBeanPane<ChartCollection> { |
|
|
|
|
|
|
|
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 JPanel contentPane; |
|
|
|
//配置方式按钮
|
|
|
|
//配置方式按钮
|
|
|
|
private UIButtonGroup<Integer> configStyleButton; |
|
|
|
private UIButtonGroup<Integer> configStyleButton; |
|
|
@ -31,15 +40,19 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
private JPanel configPane; |
|
|
|
private JPanel configPane; |
|
|
|
//按钮切换方式配置界面
|
|
|
|
//按钮切换方式配置界面
|
|
|
|
private JPanel buttonConfigPane; |
|
|
|
private JPanel buttonConfigPane; |
|
|
|
private ChartTextAttrPane textAttrPane; |
|
|
|
private ChartTextAttrPane styleAttrPane; |
|
|
|
private ColorSelectBoxWithOutTransparent colorSelectBox; |
|
|
|
private ColorSelectBoxWithOutTransparent colorSelectBox4button; |
|
|
|
|
|
|
|
|
|
|
|
//轮播切换方式配置接界面
|
|
|
|
//轮播切换方式配置接界面
|
|
|
|
private JPanel carouselConfigPane; |
|
|
|
private JPanel carouselConfigPane; |
|
|
|
|
|
|
|
protected UISpinner timeInterval; |
|
|
|
|
|
|
|
private ColorSelectBoxWithOutTransparent colorSelectBox4carousel; |
|
|
|
|
|
|
|
|
|
|
|
public ChangeConfigPane(){ |
|
|
|
public ChangeConfigPane(){ |
|
|
|
initButtonGroup(); |
|
|
|
initButtonGroup(); |
|
|
|
contentPane = createContentPane(); |
|
|
|
|
|
|
|
configPane = createConfigPane(); |
|
|
|
configPane = createConfigPane(); |
|
|
|
|
|
|
|
contentPane = createContentPane(); |
|
|
|
|
|
|
|
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30)); |
|
|
|
this.add(contentPane, BorderLayout.CENTER); |
|
|
|
this.add(contentPane, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -47,9 +60,10 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
double f = TableLayout.FILL; |
|
|
|
double f = TableLayout.FILL; |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
double[] columnSize = {p, f}; |
|
|
|
double[] rowSize = {p,p,p}; |
|
|
|
double[] rowSize = {p,p,p,p}; |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, |
|
|
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Change_Style") + ":"),configStyleButton}, |
|
|
|
|
|
|
|
new Component[]{null, null}, |
|
|
|
new Component[]{new JSeparator(), null}, |
|
|
|
new Component[]{new JSeparator(), null}, |
|
|
|
new Component[]{configPane, null}, |
|
|
|
new Component[]{configPane, null}, |
|
|
|
}; |
|
|
|
}; |
|
|
@ -65,7 +79,7 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
public Dimension getPreferredSize() { |
|
|
|
if(configStyleButton.getSelectedIndex() == 0){ |
|
|
|
if(configStyleButton.getSelectedIndex() == 0){ |
|
|
|
return new Dimension(buttonConfigPane.getWidth(), 0); |
|
|
|
return buttonConfigPane.getPreferredSize(); |
|
|
|
} else{ |
|
|
|
} else{ |
|
|
|
return carouselConfigPane.getPreferredSize(); |
|
|
|
return carouselConfigPane.getPreferredSize(); |
|
|
|
} |
|
|
|
} |
|
|
@ -79,18 +93,39 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createCarouseConfigPane() { |
|
|
|
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(){ |
|
|
|
private JPanel createTitleStylePane(){ |
|
|
|
textAttrPane = new ChartTextAttrPane(); |
|
|
|
styleAttrPane = new ChartTextAttrPane(); |
|
|
|
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); |
|
|
|
styleAttrPane.setPreferredSize(new Dimension(WIDTH, (int) styleAttrPane.getPreferredSize().getHeight())); |
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style")+":", styleAttrPane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createBackgroundColorPane(){ |
|
|
|
private JPanel createButtonBackgroundColorPane(){ |
|
|
|
colorSelectBox = new ColorSelectBoxWithOutTransparent(100); |
|
|
|
colorSelectBox4button = new ColorSelectBoxWithOutTransparent(WIDTH); |
|
|
|
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), textAttrPane); |
|
|
|
return TableLayoutHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Background") + ":", colorSelectBox4button); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private JPanel createButtonConfigPane() { |
|
|
|
private JPanel createButtonConfigPane() { |
|
|
@ -101,7 +136,7 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
new Component[]{createTitleStylePane(),null}, |
|
|
|
new Component[]{createTitleStylePane(),null}, |
|
|
|
new Component[]{new JSeparator(),null}, |
|
|
|
new Component[]{new JSeparator(),null}, |
|
|
|
new Component[]{createBackgroundColorPane(),null}, |
|
|
|
new Component[]{createButtonBackgroundColorPane(),null}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
|
|
|
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
|
|
@ -110,7 +145,7 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
private void initButtonGroup() { |
|
|
|
private void initButtonGroup() { |
|
|
|
configStyleButton = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Button_Style"), |
|
|
|
configStyleButton = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Button_Style"), |
|
|
|
Inter.getLocText("Plugin-ChartF_Carousel_Style")}); |
|
|
|
Inter.getLocText("Plugin-ChartF_Carousel_Style")}); |
|
|
|
configStyleButton.setSelectedIndex(0); |
|
|
|
configStyleButton.setPreferredSize(new Dimension(WIDTH * 2, (int) configStyleButton.getPreferredSize().getHeight())); |
|
|
|
configStyleButton.addActionListener(new ActionListener() { |
|
|
|
configStyleButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
@ -129,17 +164,51 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@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 |
|
|
|
@Override |
|
|
|
public Collection updateBean() { |
|
|
|
public ChartCollection updateBean() { |
|
|
|
return null; |
|
|
|
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 |
|
|
|
@Override |
|
|
|
protected String title4PopupWindow() { |
|
|
|
protected String title4PopupWindow() { |
|
|
|
return null; |
|
|
|
return Inter.getLocText("Chart-Change_Config_Attributes"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|