zheng
6 years ago
18 changed files with 200 additions and 177 deletions
@ -1,25 +1,150 @@
|
||||
package com.fr.design.chart.series.SeriesCondition; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.condition.DSColumnLiteConditionPane; |
||||
import com.fr.chart.chartattr.ChartCommonCondition; |
||||
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() { |
||||
super(); |
||||
conditonTypePane.setVisible(false); |
||||
} |
||||
|
||||
@Override |
||||
protected VariableResolver variableResolver4FormulaPane() { |
||||
return new CustomVariableResolver(new String[]{}, false); |
||||
} |
||||
|
||||
populateColumns(columns2Populate()); |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.NORMAL_CONDITION_KEY_TYPES; |
||||
} |
||||
|
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.CATEGORY_INDEX, |
||||
ChartConstants.CATEGORY_NAME, |
||||
ChartConstants.SERIES_INDEX, |
||||
ChartConstants.SERIES_NAME, |
||||
ChartConstants.VALUE |
||||
}; |
||||
@Override |
||||
protected BasicBeanPane<CommonCondition> createUnFormulaConditionPane() { |
||||
return new CommonConditionPane(); |
||||
} |
||||
|
||||
|
||||
private class CommonConditionPane extends BasicBeanPane<CommonCondition> { |
||||
|
||||
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())); |
||||
} |
||||
|
||||
return this; |
||||
} |
||||
}); |
||||
conditionValuePane = ValueEditorPaneFactory.createAllValueEditorPane(); |
||||
conditionKeyComboBox.setPreferredSize(new Dimension(175, conditionKeyComboBox.getPreferredSize().height)); |
||||
conditionOPComboBox.setPreferredSize(new Dimension(80, 20)); |
||||
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; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
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. |
||||
*/ |
||||
public class VanChartBubbleConditionSelectionPane extends ChartConditionPane { |
||||
|
||||
|
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.SERIES_INDEX, |
||||
ChartConstants.SERIES_NAME, |
||||
VanChartScatterDataPoint.X, |
||||
VanChartScatterDataPoint.Y, |
||||
ChartConstants.VALUE |
||||
}; |
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.BUBBLE_CONDITION_KEY_TYPES; |
||||
} |
||||
} |
||||
|
@ -1,21 +1,15 @@
|
||||
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.plugin.chart.type.ConditionKeyType; |
||||
|
||||
/** |
||||
* 只对系列进行设置 |
||||
*/ |
||||
public class VanChartSeriesConditionPane extends ChartConditionPane { |
||||
|
||||
/** |
||||
* 只对系列进行设置 |
||||
* @return 系列值,系列名 |
||||
*/ |
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.SERIES_INDEX, |
||||
ChartConstants.SERIES_NAME |
||||
}; |
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.SERIES_CONDITION_KEY_TYPES; |
||||
} |
||||
} |
@ -1,21 +1,15 @@
|
||||
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.plugin.chart.map.VanChartMapDataPoint; |
||||
import com.fr.plugin.chart.type.ConditionKeyType; |
||||
|
||||
/** |
||||
* Created by hufan on 2016/12/26. |
||||
*/ |
||||
public class VanChartLineMapConditionSelectionPane extends ChartConditionPane { |
||||
|
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.SERIES_NAME, |
||||
ChartConstants.SERIES_INDEX, |
||||
VanChartMapDataPoint.START_AREA_NAME, |
||||
VanChartMapDataPoint.END_AREA_NAME, |
||||
ChartConstants.VALUE |
||||
}; |
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.LINE_MAP_CONDITION_KEY_TYPES; |
||||
} |
||||
} |
||||
|
@ -1,19 +1,15 @@
|
||||
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.plugin.chart.map.VanChartMapDataPoint; |
||||
import com.fr.plugin.chart.type.ConditionKeyType; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/6/1. |
||||
*/ |
||||
public class VanChartMapConditionSelectionPane extends ChartConditionPane { |
||||
|
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
ChartConstants.SERIES_NAME, |
||||
VanChartMapDataPoint.AREA_NAME, |
||||
ChartConstants.VALUE |
||||
}; |
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.MAP_CONDITION_KEY_TYPES; |
||||
} |
||||
} |
||||
|
@ -1,23 +1,15 @@
|
||||
package com.fr.van.chart.multilayer.other; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.chart.multilayer.VanChartMultiPieDataPoint; |
||||
import com.fr.plugin.chart.type.ConditionKeyType; |
||||
|
||||
/** |
||||
* Created by Fangjie on 2016/6/16. |
||||
*/ |
||||
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"); |
||||
|
||||
|
||||
public String[] columns2Populate() { |
||||
return new String[]{ |
||||
VanChartMultiPieDataPoint.LEVEL_ORDER, |
||||
VanChartMultiPieDataPoint.LEVEL_NAME, |
||||
ChartConstants.VALUE |
||||
}; |
||||
@Override |
||||
protected ConditionKeyType[] conditionKeyTypes() { |
||||
return ConditionKeyType.MULTI_PIE_CONDITION_KEY_TYPES; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue