zheng
6 years ago
18 changed files with 200 additions and 177 deletions
@ -1,25 +1,150 @@ |
|||||||
package com.fr.design.chart.series.SeriesCondition; |
package com.fr.design.chart.series.SeriesCondition; |
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
import com.fr.chart.chartattr.ChartCommonCondition; |
||||||
import com.fr.design.condition.DSColumnLiteConditionPane; |
import com.fr.data.condition.CommonCondition; |
||||||
|
import com.fr.data.core.Compare; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.condition.LiteConditionPane; |
||||||
|
import com.fr.design.editor.ValueEditorPane; |
||||||
|
import com.fr.design.editor.ValueEditorPaneFactory; |
||||||
|
import com.fr.design.formula.CustomVariableResolver; |
||||||
|
import com.fr.design.formula.VariableResolver; |
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
|
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.type.ConditionKeyType; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
public class ChartConditionPane extends DSColumnLiteConditionPane { |
import javax.swing.DefaultComboBoxModel; |
||||||
|
import javax.swing.JList; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.Dimension; |
||||||
|
|
||||||
|
public class ChartConditionPane extends LiteConditionPane<CommonCondition> { |
||||||
|
|
||||||
public ChartConditionPane() { |
public ChartConditionPane() { |
||||||
super(); |
super(); |
||||||
conditonTypePane.setVisible(false); |
conditonTypePane.setVisible(false); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected VariableResolver variableResolver4FormulaPane() { |
||||||
|
return new CustomVariableResolver(new String[]{}, false); |
||||||
|
} |
||||||
|
|
||||||
|
protected ConditionKeyType[] conditionKeyTypes() { |
||||||
|
return ConditionKeyType.NORMAL_CONDITION_KEY_TYPES; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected BasicBeanPane<CommonCondition> createUnFormulaConditionPane() { |
||||||
|
return new CommonConditionPane(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private class CommonConditionPane extends BasicBeanPane<CommonCondition> { |
||||||
|
|
||||||
populateColumns(columns2Populate()); |
private UIComboBox conditionKeyComboBox; |
||||||
|
private UIComboBox conditionOPComboBox; |
||||||
|
private ValueEditorPane conditionValuePane; |
||||||
|
|
||||||
|
public CommonConditionPane() { |
||||||
|
initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponents() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
conditionKeyComboBox = new UIComboBox(conditionKeyTypes()); |
||||||
|
conditionOPComboBox = new UIComboBox(new DefaultComboBoxModel()); |
||||||
|
DefaultComboBoxModel opComboBoxModel = (DefaultComboBoxModel) conditionOPComboBox.getModel(); |
||||||
|
int[] allOperators = Compare.getAllOperators(); |
||||||
|
for (int i = 0; i < allOperators.length; i++) { |
||||||
|
opComboBoxModel.addElement(new Integer(allOperators[i])); |
||||||
|
} |
||||||
|
this.conditionOPComboBox.setRenderer(new UIComboBoxRenderer() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||||
|
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||||
|
if (value instanceof Integer) { |
||||||
|
this.setText(Compare.operator2String(((Integer) value).intValue())); |
||||||
} |
} |
||||||
|
|
||||||
public String[] columns2Populate() { |
return this; |
||||||
return new String[]{ |
} |
||||||
ChartConstants.CATEGORY_INDEX, |
}); |
||||||
ChartConstants.CATEGORY_NAME, |
conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane(); |
||||||
ChartConstants.SERIES_INDEX, |
conditionKeyComboBox.setPreferredSize(new Dimension(175, conditionKeyComboBox.getPreferredSize().height)); |
||||||
ChartConstants.SERIES_NAME, |
conditionOPComboBox.setPreferredSize(new Dimension(80, 20)); |
||||||
ChartConstants.VALUE |
Component[][] components = { |
||||||
}; |
{new UILabel(Inter.getLocText("Utils-Available_Columns") + ":"), new UILabel(Inter.getLocText("FR-ConditionB_Operator") + ":"), |
||||||
|
new UILabel()}, {conditionKeyComboBox, conditionOPComboBox, conditionValuePane}}; |
||||||
|
|
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double rowSize[] = {p, p}; |
||||||
|
double columnSize[] = {p, p, TableLayout.FILL}; |
||||||
|
|
||||||
|
JPanel leftPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
|
this.add(leftPanel, BorderLayout.CENTER); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(CommonCondition condition) { |
||||||
|
String selectionColumn = condition.getColumnName(); |
||||||
|
ConditionKeyType type = ConditionKeyType.find(selectionColumn); |
||||||
|
if (type != null) { |
||||||
|
conditionKeyComboBox.setSelectedItem(type); |
||||||
|
} else {//兼容
|
||||||
|
for (ConditionKeyType temp : conditionKeyTypes()) { |
||||||
|
if (ComparatorUtils.equals(selectionColumn, temp.toString())) { |
||||||
|
conditionKeyComboBox.setSelectedItem(temp); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Compare compare = condition.getCompare(); |
||||||
|
|
||||||
|
if (compare == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
conditionOPComboBox.setSelectedItem(new Integer(compare.getOp())); |
||||||
|
|
||||||
|
Object value = compare.getValue(); |
||||||
|
|
||||||
|
conditionValuePane.populate(value); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public CommonCondition updateBean() { |
||||||
|
Object value = conditionValuePane.update(); |
||||||
|
|
||||||
|
int index = conditionKeyComboBox.getSelectedIndex(); |
||||||
|
ConditionKeyType conditionKeyType = conditionKeyTypes()[index]; |
||||||
|
String name = conditionKeyType.getStringType(); |
||||||
|
|
||||||
|
return new ChartCommonCondition(name, index, new Compare( |
||||||
|
((Integer) conditionOPComboBox.getSelectedItem()).intValue(), value)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return StringUtils.EMPTY; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void checkValid() throws Exception { |
||||||
|
conditionOPComboBox.setSelectedIndex(0); |
||||||
|
conditionValuePane.populate(StringUtils.EMPTY); |
||||||
|
} |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
@ -1,22 +1,15 @@ |
|||||||
package com.fr.van.chart.bubble; |
package com.fr.van.chart.bubble; |
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
|
||||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
import com.fr.plugin.chart.scatter.VanChartScatterDataPoint; |
import com.fr.plugin.chart.type.ConditionKeyType; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by Mitisky on 16/3/31. |
* Created by Mitisky on 16/3/31. |
||||||
*/ |
*/ |
||||||
public class VanChartBubbleConditionSelectionPane extends ChartConditionPane { |
public class VanChartBubbleConditionSelectionPane extends ChartConditionPane { |
||||||
|
|
||||||
|
@Override |
||||||
public String[] columns2Populate() { |
protected ConditionKeyType[] conditionKeyTypes() { |
||||||
return new String[]{ |
return ConditionKeyType.BUBBLE_CONDITION_KEY_TYPES; |
||||||
ChartConstants.SERIES_INDEX, |
|
||||||
ChartConstants.SERIES_NAME, |
|
||||||
VanChartScatterDataPoint.X, |
|
||||||
VanChartScatterDataPoint.Y, |
|
||||||
ChartConstants.VALUE |
|
||||||
}; |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,21 +1,15 @@ |
|||||||
package com.fr.van.chart.designer.style.series; |
package com.fr.van.chart.designer.style.series; |
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
|
||||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
|
import com.fr.plugin.chart.type.ConditionKeyType; |
||||||
|
|
||||||
/** |
/** |
||||||
* 只对系列进行设置 |
* 只对系列进行设置 |
||||||
*/ |
*/ |
||||||
public class VanChartSeriesConditionPane extends ChartConditionPane { |
public class VanChartSeriesConditionPane extends ChartConditionPane { |
||||||
|
|
||||||
/** |
@Override |
||||||
* 只对系列进行设置 |
protected ConditionKeyType[] conditionKeyTypes() { |
||||||
* @return 系列值,系列名 |
return ConditionKeyType.SERIES_CONDITION_KEY_TYPES; |
||||||
*/ |
|
||||||
public String[] columns2Populate() { |
|
||||||
return new String[]{ |
|
||||||
ChartConstants.SERIES_INDEX, |
|
||||||
ChartConstants.SERIES_NAME |
|
||||||
}; |
|
||||||
} |
} |
||||||
} |
} |
@ -1,21 +1,15 @@ |
|||||||
package com.fr.van.chart.map.designer.other.condition; |
package com.fr.van.chart.map.designer.other.condition; |
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
|
||||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
import com.fr.plugin.chart.map.VanChartMapDataPoint; |
import com.fr.plugin.chart.type.ConditionKeyType; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by hufan on 2016/12/26. |
* Created by hufan on 2016/12/26. |
||||||
*/ |
*/ |
||||||
public class VanChartLineMapConditionSelectionPane extends ChartConditionPane { |
public class VanChartLineMapConditionSelectionPane extends ChartConditionPane { |
||||||
|
|
||||||
public String[] columns2Populate() { |
@Override |
||||||
return new String[]{ |
protected ConditionKeyType[] conditionKeyTypes() { |
||||||
ChartConstants.SERIES_NAME, |
return ConditionKeyType.LINE_MAP_CONDITION_KEY_TYPES; |
||||||
ChartConstants.SERIES_INDEX, |
|
||||||
VanChartMapDataPoint.START_AREA_NAME, |
|
||||||
VanChartMapDataPoint.END_AREA_NAME, |
|
||||||
ChartConstants.VALUE |
|
||||||
}; |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,19 +1,15 @@ |
|||||||
package com.fr.van.chart.map.designer.other.condition; |
package com.fr.van.chart.map.designer.other.condition; |
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
|
||||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
import com.fr.plugin.chart.map.VanChartMapDataPoint; |
import com.fr.plugin.chart.type.ConditionKeyType; |
||||||
|
|
||||||
/** |
/** |
||||||
* Created by Mitisky on 16/6/1. |
* Created by Mitisky on 16/6/1. |
||||||
*/ |
*/ |
||||||
public class VanChartMapConditionSelectionPane extends ChartConditionPane { |
public class VanChartMapConditionSelectionPane extends ChartConditionPane { |
||||||
|
|
||||||
public String[] columns2Populate() { |
@Override |
||||||
return new String[]{ |
protected ConditionKeyType[] conditionKeyTypes() { |
||||||
ChartConstants.SERIES_NAME, |
return ConditionKeyType.MAP_CONDITION_KEY_TYPES; |
||||||
VanChartMapDataPoint.AREA_NAME, |
|
||||||
ChartConstants.VALUE |
|
||||||
}; |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,23 +1,15 @@ |
|||||||
package com.fr.van.chart.multilayer.other; |
package com.fr.van.chart.multilayer.other; |
||||||
|
|
||||||
import com.fr.chart.base.ChartConstants; |
|
||||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
import com.fr.general.Inter; |
import com.fr.plugin.chart.type.ConditionKeyType; |
||||||
import com.fr.plugin.chart.multilayer.VanChartMultiPieDataPoint; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* Created by Fangjie on 2016/6/16. |
* Created by Fangjie on 2016/6/16. |
||||||
*/ |
*/ |
||||||
public class VanChartMultiPieConditionSelectionPane extends ChartConditionPane { |
public class VanChartMultiPieConditionSelectionPane extends ChartConditionPane { |
||||||
public static final String LEVEL_NAME = Inter.getLocText("Plugin-ChartF_Level_Name"); |
|
||||||
public static final String LEVEL_ORDER = Inter.getLocText("Plugin-ChartF_Level_Order"); |
|
||||||
|
|
||||||
|
@Override |
||||||
public String[] columns2Populate() { |
protected ConditionKeyType[] conditionKeyTypes() { |
||||||
return new String[]{ |
return ConditionKeyType.MULTI_PIE_CONDITION_KEY_TYPES; |
||||||
VanChartMultiPieDataPoint.LEVEL_ORDER, |
|
||||||
VanChartMultiPieDataPoint.LEVEL_NAME, |
|
||||||
ChartConstants.VALUE |
|
||||||
}; |
|
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue