Browse Source

整理代码

master
mengao 7 years ago
parent
commit
27d89a607a
  1. 50
      designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java
  2. 24
      designer_chart/src/com/fr/plugin/chart/designer/component/marker/VanChartImageMarkerPane.java
  3. 25
      designer_chart/src/com/fr/plugin/chart/map/line/VanChartLineMapEffectPane.java

50
designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -33,11 +33,11 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
private LiteConditionPane liteConditionPane; private LiteConditionPane liteConditionPane;
public VanChartCustomStackAndAxisConditionPane(){ public VanChartCustomStackAndAxisConditionPane() {
} }
private void doLayoutPane(){ private void doLayoutPane() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.removeAll(); this.removeAll();
@ -57,23 +57,22 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
liteConditionPane.setPreferredSize(new Dimension(300, 300)); liteConditionPane.setPreferredSize(new Dimension(300, 300));
} }
private JPanel createDeployPane() private JPanel createDeployPane() {
{
isStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); isStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
isPercentStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); isPercentStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p,p}; double[] columnSize = {p, p};
double[] rowSize = {p,p,p,p}; double[] rowSize = {p, p, p, p};
return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize);
} }
protected Component[][] getDeployComponents() { protected Component[][] getDeployComponents() {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis}, new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")), XAxis},
new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis}, new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")), YAxis},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Type_Stacked")),isStacked}, new Component[]{new UILabel(Inter.getLocText("FR-Chart-Type_Stacked")), isStacked},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")),isPercentStacked}, new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")), isPercentStacked},
}; };
isStacked.addActionListener(new ActionListener() { isStacked.addActionListener(new ActionListener() {
@ -94,8 +93,8 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0); isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0);
} }
public void populateBean(ConditionAttr conditionAttr){ public void populateBean(ConditionAttr conditionAttr) {
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class); AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray()); XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray());
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray()); YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray());
@ -114,31 +113,26 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
checkBox(); checkBox();
} }
public void updateBean(ConditionAttr conditionAttr){
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex());
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex());
updateStackAndPercent(seriesStackAndAxis);
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean();
conditionAttr.setCondition(con);
}
protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) { protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) {
seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0); seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0);
if(seriesStackAndAxis.isStacked()){ if (seriesStackAndAxis.isStacked()) {
seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0); seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0);
} else { } else {
seriesStackAndAxis.setPercentStacked(false); seriesStackAndAxis.setPercentStacked(false);
} }
} }
public ConditionAttr updateBean(){ public ConditionAttr updateBean() {
ConditionAttr conditionAttr = new ConditionAttr(); ConditionAttr conditionAttr = new ConditionAttr();
conditionAttr.addDataSeriesCondition(new AttrSeriesStackAndAxis()); AttrSeriesStackAndAxis seriesStackAndAxis = new AttrSeriesStackAndAxis();
updateBean(conditionAttr); seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex());
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex());
updateStackAndPercent(seriesStackAndAxis);
conditionAttr.addDataSeriesCondition(seriesStackAndAxis);
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean();
conditionAttr.setCondition(con);
return conditionAttr; return conditionAttr;
} }

24
designer_chart/src/com/fr/plugin/chart/designer/component/marker/VanChartImageMarkerPane.java

@ -24,20 +24,16 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
private UISpinner width; private UISpinner width;
private UISpinner height; private UISpinner height;
protected ImageBackgroundQuickPane getImageBackgroundPane() {
return imageBackgroundPane;
}
public VanChartImageMarkerPane() { public VanChartImageMarkerPane() {
imageBackgroundPane = new ImageBackgroundQuickPane(false); imageBackgroundPane = new ImageBackgroundQuickPane(false);
setImageBackgroundPaneBorder(); imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize()));
width = new UISpinner(0, 100, 0.5, 30); width = new UISpinner(0, 100, 0.5, 30);
height = new UISpinner(0, 100, 0.5, 30); height = new UISpinner(0, 100, 0.5, 30);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] row = {p,p,p}; double[] row = {p, p, p};
double[] col = {p,f}; double[] col = {p, f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Width")), width}, new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Width")), width},
@ -47,13 +43,13 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
JPanel sizePanel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel sizePanel = TableLayoutHelper.createTableLayoutPane(components, row, col);
JPanel panel = createContentPane(imageBackgroundPane, sizePanel); JPanel panel = createContentPane(imageBackgroundPane, sizePanel);
panel.setBorder(BorderFactory.createEmptyBorder(0,72,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 72, 0, 0));
this.add(panel); this.add(panel);
} }
protected void setImageBackgroundPaneBorder() { protected Dimension getImageBackgroundPreferredSize(Dimension dimension) {
imageBackgroundPane.setPreferredSize(new Dimension((int)TableLayout4VanChartHelper.EDIT_AREA_WIDTH, (int)imageBackgroundPane.getPreferredSize().getHeight())); return new Dimension((int) TableLayout4VanChartHelper.EDIT_AREA_WIDTH, (int) dimension.getHeight());
} }
protected JPanel createContentPane(ImageBackgroundQuickPane imageBackgroundPane, JPanel sizePanel) { protected JPanel createContentPane(ImageBackgroundQuickPane imageBackgroundPane, JPanel sizePanel) {
@ -75,11 +71,11 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
@Override @Override
public void populateBean(VanChartAttrMarker marker) { public void populateBean(VanChartAttrMarker marker) {
if(marker == null){ if (marker == null) {
marker = new VanChartAttrMarker(); marker = new VanChartAttrMarker();
marker.setCommon(false); marker.setCommon(false);
} }
if(marker.getImageBackground() != null){ if (marker.getImageBackground() != null) {
imageBackgroundPane.populateBean(marker.getImageBackground()); imageBackgroundPane.populateBean(marker.getImageBackground());
} }
width.setValue(marker.getWidth()); width.setValue(marker.getWidth());
@ -96,10 +92,10 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
return marker; return marker;
} }
public void updateBean(VanChartAttrMarker marker){ public void updateBean(VanChartAttrMarker marker) {
marker.setCommon(false); marker.setCommon(false);
marker.setMarkerType(MarkerType.MARKER_NULL); marker.setMarkerType(MarkerType.MARKER_NULL);
ImageBackground background = (ImageBackground)imageBackgroundPane.updateBean(); ImageBackground background = (ImageBackground) imageBackgroundPane.updateBean();
background.setLayout(Constants.IMAGE_EXTEND); background.setLayout(Constants.IMAGE_EXTEND);
marker.setImageBackground(background); marker.setImageBackground(background);
marker.setWidth(width.getValue()); marker.setWidth(width.getValue());

25
designer_chart/src/com/fr/plugin/chart/map/line/VanChartLineMapEffectPane.java

@ -19,7 +19,7 @@ import java.awt.event.ItemListener;
/** /**
* Created by hufan on 2016/12/20. * Created by hufan on 2016/12/20.
*/ */
public class VanChartLineMapEffectPane extends VanChartEffectPane{ public class VanChartLineMapEffectPane extends VanChartEffectPane {
//运动方式 //运动方式
private JPanel typeContentPane; private JPanel typeContentPane;
@ -45,37 +45,38 @@ public class VanChartLineMapEffectPane extends VanChartEffectPane{
panel.add(periodPane, BorderLayout.CENTER); panel.add(periodPane, BorderLayout.CENTER);
panel.add(animationTypePane, BorderLayout.SOUTH); panel.add(animationTypePane, BorderLayout.SOUTH);
panel.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
return panel; return panel;
} }
protected void setContentPaneBorder() { protected void setContentPaneBorder() {
return; return;
} }
private Component createAnimationSelectPane() { private Component createAnimationSelectPane() {
JPanel panel = new JPanel(new BorderLayout(5, 0)); JPanel panel = new JPanel(new BorderLayout(5, 0));
UILabel label1= new UILabel(Inter.getLocText("Plugin-ChartF_Animation_Type")); UILabel label1 = new UILabel(Inter.getLocText("Plugin-ChartF_Animation_Type"));
label1.setPreferredSize(new Dimension((int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 20)); label1.setPreferredSize(new Dimension((int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 20));
panel.add(label1, BorderLayout.WEST); panel.add(label1, BorderLayout.WEST);
panel.add(animationType, BorderLayout.CENTER); panel.add(animationType, BorderLayout.CENTER);
return panel; return panel;
} }
private void initTypeContentPane() { private void initTypeContentPane() {
customContentPane = new VanChartImageMarkerPane(){ customContentPane = new VanChartImageMarkerPane() {
protected void setImageBackgroundPaneBorder() { protected Dimension getImageBackgroundPreferredSize(Dimension dimension) {
getImageBackgroundPane().setPreferredSize(new Dimension((int)TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH, (int)getImageBackgroundPane().getPreferredSize().getHeight())); return new Dimension((int) TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH, (int) dimension.getHeight());
} }
}; };
CardLayout cardLayout = new CardLayout(); CardLayout cardLayout = new CardLayout();
typeContentPane = new JPanel(cardLayout){ typeContentPane = new JPanel(cardLayout) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if(ComparatorUtils.equals(animationType.getSelectedItem(), LineMapAnimationType.DEFAULT)){ if (ComparatorUtils.equals(animationType.getSelectedItem(), LineMapAnimationType.DEFAULT)) {
return new Dimension((int) customContentPane.getPreferredSize().getWidth(), 0); return new Dimension((int) customContentPane.getPreferredSize().getWidth(), 0);
}else { } else {
return customContentPane.getPreferredSize(); return customContentPane.getPreferredSize();
} }
} }
@ -94,7 +95,7 @@ public class VanChartLineMapEffectPane extends VanChartEffectPane{
}); });
} }
private void checkCardLayout(){ private void checkCardLayout() {
CardLayout cardLayout = (CardLayout) typeContentPane.getLayout(); CardLayout cardLayout = (CardLayout) typeContentPane.getLayout();
cardLayout.show(typeContentPane, LineMapAnimationType.getTypes()[animationType.getSelectedIndex()].getStringType()); cardLayout.show(typeContentPane, LineMapAnimationType.getTypes()[animationType.getSelectedIndex()].getStringType());
} }
@ -102,7 +103,7 @@ public class VanChartLineMapEffectPane extends VanChartEffectPane{
@Override @Override
public void populateBean(AttrEffect ob) { public void populateBean(AttrEffect ob) {
super.populateBean(ob); super.populateBean(ob);
if (ob instanceof AttrLineEffect){ if (ob instanceof AttrLineEffect) {
animationType.setSelectedItem(((AttrLineEffect) ob).getAnimationType()); animationType.setSelectedItem(((AttrLineEffect) ob).getAnimationType());
customContentPane.populateBean(((AttrLineEffect) ob).getAttrMarker()); customContentPane.populateBean(((AttrLineEffect) ob).getAttrMarker());
} }

Loading…
Cancel
Save