|
|
|
@ -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<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 UIButtonGroup<Integer> configStyleButton; |
|
|
|
@ -31,15 +40,19 @@ public class ChangeConfigPane extends BasicBeanPane<Collection> {
|
|
|
|
|
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<Collection> {
|
|
|
|
|
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<Collection> {
|
|
|
|
|
@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<Collection> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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<Collection> {
|
|
|
|
|
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<Collection> {
|
|
|
|
|
private void initButtonGroup() { |
|
|
|
|
configStyleButton = new UIButtonGroup<Integer>(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<Collection> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@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"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|