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. 27
      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;
public VanChartCustomStackAndAxisConditionPane(){
public VanChartCustomStackAndAxisConditionPane() {
}
private void doLayoutPane(){
private void doLayoutPane() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.removeAll();
@ -57,23 +57,22 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
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")});
isPercentStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")});
double p = TableLayout.PREFERRED;
double[] columnSize = {p,p};
double[] rowSize = {p,p,p,p};
double[] columnSize = {p, p};
double[] rowSize = {p, p, p, p};
return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize);
}
protected Component[][] getDeployComponents() {
Component[][] components = new Component[][]{
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("FR-Chart-Type_Stacked")),isStacked},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")),isPercentStacked},
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("FR-Chart-Type_Stacked")), isStacked},
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")), isPercentStacked},
};
isStacked.addActionListener(new ActionListener() {
@ -94,8 +93,8 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0);
}
public void populateBean(ConditionAttr conditionAttr){
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
public void populateBean(ConditionAttr conditionAttr) {
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis) conditionAttr.getExisted(AttrSeriesStackAndAxis.class);
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray());
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray());
@ -114,31 +113,26 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
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) {
seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0);
if(seriesStackAndAxis.isStacked()){
if (seriesStackAndAxis.isStacked()) {
seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0);
} else {
seriesStackAndAxis.setPercentStacked(false);
}
}
public ConditionAttr updateBean(){
public ConditionAttr updateBean() {
ConditionAttr conditionAttr = new ConditionAttr();
conditionAttr.addDataSeriesCondition(new AttrSeriesStackAndAxis());
updateBean(conditionAttr);
AttrSeriesStackAndAxis seriesStackAndAxis = new AttrSeriesStackAndAxis();
seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex());
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex());
updateStackAndPercent(seriesStackAndAxis);
conditionAttr.addDataSeriesCondition(seriesStackAndAxis);
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean();
conditionAttr.setCondition(con);
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 height;
protected ImageBackgroundQuickPane getImageBackgroundPane() {
return imageBackgroundPane;
}
public VanChartImageMarkerPane() {
imageBackgroundPane = new ImageBackgroundQuickPane(false);
setImageBackgroundPaneBorder();
imageBackgroundPane.setPreferredSize(getImageBackgroundPreferredSize(imageBackgroundPane.getPreferredSize()));
width = new UISpinner(0, 100, 0.5, 30);
height = new UISpinner(0, 100, 0.5, 30);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p,p,p};
double[] col = {p,f};
double[] row = {p, p, p};
double[] col = {p, f};
Component[][] components = new Component[][]{
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 panel = createContentPane(imageBackgroundPane, sizePanel);
panel.setBorder(BorderFactory.createEmptyBorder(0,72,0,0));
panel.setBorder(BorderFactory.createEmptyBorder(0, 72, 0, 0));
this.add(panel);
}
protected void setImageBackgroundPaneBorder() {
imageBackgroundPane.setPreferredSize(new Dimension((int)TableLayout4VanChartHelper.EDIT_AREA_WIDTH, (int)imageBackgroundPane.getPreferredSize().getHeight()));
protected Dimension getImageBackgroundPreferredSize(Dimension dimension) {
return new Dimension((int) TableLayout4VanChartHelper.EDIT_AREA_WIDTH, (int) dimension.getHeight());
}
protected JPanel createContentPane(ImageBackgroundQuickPane imageBackgroundPane, JPanel sizePanel) {
@ -75,11 +71,11 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
@Override
public void populateBean(VanChartAttrMarker marker) {
if(marker == null){
if (marker == null) {
marker = new VanChartAttrMarker();
marker.setCommon(false);
}
if(marker.getImageBackground() != null){
if (marker.getImageBackground() != null) {
imageBackgroundPane.populateBean(marker.getImageBackground());
}
width.setValue(marker.getWidth());
@ -96,10 +92,10 @@ public class VanChartImageMarkerPane extends BasicBeanPane<VanChartAttrMarker> {
return marker;
}
public void updateBean(VanChartAttrMarker marker){
public void updateBean(VanChartAttrMarker marker) {
marker.setCommon(false);
marker.setMarkerType(MarkerType.MARKER_NULL);
ImageBackground background = (ImageBackground)imageBackgroundPane.updateBean();
ImageBackground background = (ImageBackground) imageBackgroundPane.updateBean();
background.setLayout(Constants.IMAGE_EXTEND);
marker.setImageBackground(background);
marker.setWidth(width.getValue());

27
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.
*/
public class VanChartLineMapEffectPane extends VanChartEffectPane{
public class VanChartLineMapEffectPane extends VanChartEffectPane {
//运动方式
private JPanel typeContentPane;
@ -45,37 +45,38 @@ public class VanChartLineMapEffectPane extends VanChartEffectPane{
panel.add(periodPane, BorderLayout.CENTER);
panel.add(animationTypePane, BorderLayout.SOUTH);
panel.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
panel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
return panel;
}
protected void setContentPaneBorder() {
return;
}
private Component createAnimationSelectPane() {
JPanel panel = new JPanel(new BorderLayout(5, 0));
UILabel label1= new UILabel(Inter.getLocText("Plugin-ChartF_Animation_Type"));
label1.setPreferredSize(new Dimension((int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 20));
UILabel label1 = new UILabel(Inter.getLocText("Plugin-ChartF_Animation_Type"));
label1.setPreferredSize(new Dimension((int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 20));
panel.add(label1, BorderLayout.WEST);
panel.add(animationType, BorderLayout.CENTER);
return panel;
}
private void initTypeContentPane() {
customContentPane = new VanChartImageMarkerPane(){
protected void setImageBackgroundPaneBorder() {
getImageBackgroundPane().setPreferredSize(new Dimension((int)TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH, (int)getImageBackgroundPane().getPreferredSize().getHeight()));
customContentPane = new VanChartImageMarkerPane() {
protected Dimension getImageBackgroundPreferredSize(Dimension dimension) {
return new Dimension((int) TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH, (int) dimension.getHeight());
}
};
CardLayout cardLayout = new CardLayout();
typeContentPane = new JPanel(cardLayout){
typeContentPane = new JPanel(cardLayout) {
@Override
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);
}else {
} else {
return customContentPane.getPreferredSize();
}
}
@ -94,15 +95,15 @@ public class VanChartLineMapEffectPane extends VanChartEffectPane{
});
}
private void checkCardLayout(){
private void checkCardLayout() {
CardLayout cardLayout = (CardLayout) typeContentPane.getLayout();
cardLayout.show(typeContentPane, LineMapAnimationType.getTypes()[animationType.getSelectedIndex()].getStringType());
cardLayout.show(typeContentPane, LineMapAnimationType.getTypes()[animationType.getSelectedIndex()].getStringType());
}
@Override
public void populateBean(AttrEffect ob) {
super.populateBean(ob);
if (ob instanceof AttrLineEffect){
if (ob instanceof AttrLineEffect) {
animationType.setSelectedItem(((AttrLineEffect) ob).getAnimationType());
customContentPane.populateBean(((AttrLineEffect) ob).getAttrMarker());
}

Loading…
Cancel
Save