|
|
|
@ -37,6 +37,7 @@ import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane;
|
|
|
|
|
import com.fr.van.chart.designer.other.VanChartInteractivePane; |
|
|
|
|
import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; |
|
|
|
|
import com.fr.van.chart.designer.style.series.VanChartEffectPane; |
|
|
|
|
import com.fr.van.chart.map.designer.style.series.VanChartMapAnchorMarkerPane; |
|
|
|
|
import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; |
|
|
|
|
import com.fr.van.chart.map.line.VanChartCurvePane; |
|
|
|
|
import com.fr.van.chart.map.line.VanChartLineMapEffectPane; |
|
|
|
@ -61,16 +62,24 @@ import java.awt.event.ItemListener;
|
|
|
|
|
* 地图-系列界面 |
|
|
|
|
*/ |
|
|
|
|
public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { |
|
|
|
|
private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region"); |
|
|
|
|
private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point"); |
|
|
|
|
private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow"); |
|
|
|
|
private static final String AREA_STRING = Toolkit.i18nText("Fine-Design_Chart_Region"); |
|
|
|
|
private static final String POINT_STRING = Toolkit.i18nText("Fine-Design_Chart_Point"); |
|
|
|
|
private static final String LINE_STRING = Toolkit.i18nText("Fine-Design_Chart_Flow"); |
|
|
|
|
|
|
|
|
|
private static final String[] MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), |
|
|
|
|
private static final String[] MARKER_TYPES = new String[]{MapMarkerType.ANCHOR.toLocalString(), |
|
|
|
|
MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()}; |
|
|
|
|
|
|
|
|
|
private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), |
|
|
|
|
private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.ANCHOR.toLocalString(), |
|
|
|
|
MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString()}; |
|
|
|
|
|
|
|
|
|
private static final String[] COMPATIBLE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), |
|
|
|
|
MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(), |
|
|
|
|
MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()}; |
|
|
|
|
|
|
|
|
|
private static final String[] COMPATIBLE_LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), |
|
|
|
|
MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(), |
|
|
|
|
MapMarkerType.BUBBLE.toLocalString()}; |
|
|
|
|
|
|
|
|
|
//custom
|
|
|
|
|
private UIButtonGroup<Integer> areaPointAndLineGroup; |
|
|
|
|
|
|
|
|
@ -85,9 +94,15 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
|
|
|
|
|
//point
|
|
|
|
|
private UIComboBox markerTypeCom; |
|
|
|
|
|
|
|
|
|
private VanChartMapAnchorMarkerPane anchorMarkerPane; |
|
|
|
|
private VanChartMapScatterMarkerPane commonMarkerPane; |
|
|
|
|
private VanChartBubblePane bubblePane; |
|
|
|
|
private VanChartImageMarkerPane imageMarkerPane; |
|
|
|
|
|
|
|
|
|
private CardLayout markerTypeLayout; |
|
|
|
|
private JPanel markerContentPane; |
|
|
|
|
|
|
|
|
|
private UINumberDragPane pointAlphaPane; |
|
|
|
|
private VanChartEffectPane pointEffectPane; |
|
|
|
|
|
|
|
|
@ -147,7 +162,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
checkLineMapLarge(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); |
|
|
|
|
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); |
|
|
|
|
return createLargeDataModelPane(panel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -162,14 +177,11 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
if (pointEffectPane != null) { |
|
|
|
|
GUICoreUtils.setEnabled(pointEffectPane, !largeModel); |
|
|
|
|
} |
|
|
|
|
if (markerTypeCom != null) { |
|
|
|
|
Object selectedItem = markerTypeCom.getSelectedItem(); |
|
|
|
|
markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES)); |
|
|
|
|
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) { |
|
|
|
|
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); |
|
|
|
|
} else { |
|
|
|
|
markerTypeCom.setSelectedItem(selectedItem); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
checkMarkerComboboxModel((VanChartMapPlot) plot); |
|
|
|
|
|
|
|
|
|
if (largeModel) { |
|
|
|
|
checkLargeModelPlotSelectedItem(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -182,6 +194,61 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkMarkerComboboxModel(VanChartMapPlot plot) { |
|
|
|
|
if (markerTypeCom == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (shouldRefreshComboboxModel(plot)) { |
|
|
|
|
|
|
|
|
|
refreshMarkerTypeComboboxModel(plot); |
|
|
|
|
|
|
|
|
|
markerTypeCom.setSelectedItem(plot.getMapMarkerType().toLocalString()); |
|
|
|
|
if (markerTypeLayout != null && markerContentPane != null) { |
|
|
|
|
markerTypeLayout.show(markerContentPane, plot.getMapMarkerType().toLocalString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkLargeModelPlotSelectedItem() { |
|
|
|
|
MapMarkerType selectedType = (MapMarkerType) markerTypeCom.getSelectedItem(); |
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedType)) { |
|
|
|
|
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); |
|
|
|
|
} else { |
|
|
|
|
markerTypeCom.setSelectedItem(selectedType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean shouldRefreshComboboxModel(VanChartMapPlot plot) { |
|
|
|
|
MapMarkerType selectedType = plot.getMapMarkerType(); |
|
|
|
|
DefaultComboBoxModel model = (DefaultComboBoxModel) markerTypeCom.getModel(); |
|
|
|
|
|
|
|
|
|
if (selectedType == MapMarkerType.DEFAULT) { |
|
|
|
|
return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) < 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) > -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void refreshMarkerTypeComboboxModel(VanChartMapPlot plot) { |
|
|
|
|
if (largeModel(plot)) { |
|
|
|
|
|
|
|
|
|
if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) { |
|
|
|
|
markerTypeCom.setModel(new DefaultComboBoxModel<>(COMPATIBLE_LARGE_MARKER_TYPES)); |
|
|
|
|
} else { |
|
|
|
|
markerTypeCom.setModel(new DefaultComboBoxModel<>(LARGE_MARKER_TYPES)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) { |
|
|
|
|
markerTypeCom.setModel(new DefaultComboBoxModel<>(COMPATIBLE_MARKER_TYPES)); |
|
|
|
|
} else { |
|
|
|
|
markerTypeCom.setModel(new DefaultComboBoxModel<>(MARKER_TYPES)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected JPanel getContentPane(boolean custom) { |
|
|
|
|
JPanel panel = new JPanel(new BorderLayout()); |
|
|
|
@ -272,7 +339,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{getColorPane(MapType.AREA)}, |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)}, |
|
|
|
|
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(components, row, col); |
|
|
|
@ -357,28 +424,29 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
|
|
|
|
|
private Component createCurvePane() { |
|
|
|
|
curvePane = new VanChartCurvePane(); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Component createAnimationPane() { |
|
|
|
|
lineMapEffectPane = new VanChartLineMapEffectPane(); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), lineMapEffectPane); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Animation"), lineMapEffectPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//不透明度
|
|
|
|
|
private JPanel createPointAlphaPane() { |
|
|
|
|
pointAlphaPane = new UINumberDragPane(0, 100); |
|
|
|
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); |
|
|
|
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createPointEffectPane() { |
|
|
|
|
pointEffectPane = new VanChartEffectPane(); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), pointEffectPane); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Animation"), pointEffectPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createMarkerComPane() { |
|
|
|
|
markerTypeCom = new UIComboBox(MARKER_TYPES); |
|
|
|
|
markerTypeCom = new UIComboBox(COMPATIBLE_MARKER_TYPES); |
|
|
|
|
|
|
|
|
|
anchorMarkerPane = new VanChartMapAnchorMarkerPane(); |
|
|
|
|
commonMarkerPane = new VanChartMapScatterMarkerPane(); |
|
|
|
|
commonMarkerPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); |
|
|
|
|
bubblePane = new VanChartBubblePane() { |
|
|
|
@ -396,31 +464,34 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
}; |
|
|
|
|
imageMarkerPane = new VanChartImageMarkerPane(); |
|
|
|
|
|
|
|
|
|
final JPanel[] panes = new JPanel[]{new JPanel(), commonMarkerPane, bubblePane, imageMarkerPane}; |
|
|
|
|
final CardLayout cardLayout = new CardLayout(); |
|
|
|
|
final JPanel cardPane = new JPanel(cardLayout) { |
|
|
|
|
final JPanel[] panes = new JPanel[]{new JPanel(), anchorMarkerPane, commonMarkerPane, bubblePane, imageMarkerPane}; |
|
|
|
|
|
|
|
|
|
markerTypeLayout = new CardLayout(); |
|
|
|
|
markerContentPane = new JPanel(markerTypeLayout) { |
|
|
|
|
@Override |
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
return panes[markerTypeCom.getSelectedIndex()].getPreferredSize(); |
|
|
|
|
int index = MapMarkerType.parse((String) markerTypeCom.getSelectedItem()).ordinal(); |
|
|
|
|
|
|
|
|
|
return panes[index].getPreferredSize(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
for (int i = 0, len = MARKER_TYPES.length; i < len; i++) { |
|
|
|
|
cardPane.add(panes[i], MARKER_TYPES[i]); |
|
|
|
|
for (int i = 0, len = COMPATIBLE_MARKER_TYPES.length; i < len; i++) { |
|
|
|
|
markerContentPane.add(panes[i], COMPATIBLE_MARKER_TYPES[i]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
markerTypeCom.addItemListener(new ItemListener() { |
|
|
|
|
@Override |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
cardLayout.show(cardPane, MARKER_TYPES[markerTypeCom.getSelectedIndex()]); |
|
|
|
|
markerTypeLayout.show(markerContentPane, (String) markerTypeCom.getSelectedItem()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point_Style"), markerTypeCom); |
|
|
|
|
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Point_Style"), markerTypeCom); |
|
|
|
|
JPanel markerPane = new JPanel(new BorderLayout(0, 6)); |
|
|
|
|
markerPane.add(northPane, BorderLayout.NORTH); |
|
|
|
|
markerPane.add(cardPane, BorderLayout.CENTER); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); |
|
|
|
|
markerPane.add(markerContentPane, BorderLayout.CENTER); |
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createCustomPane(Plot plot) { |
|
|
|
@ -500,8 +571,9 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateBean(Plot plot) { |
|
|
|
|
if (plot != null && plot instanceof VanChartMapPlot) { |
|
|
|
|
if (plot instanceof VanChartMapPlot) { |
|
|
|
|
if (markerTypeCom != null) { |
|
|
|
|
checkMarkerComboboxModel(((VanChartMapPlot) plot)); |
|
|
|
|
markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString()); |
|
|
|
|
} |
|
|
|
|
if (nullValueColorBox != null) { |
|
|
|
@ -524,9 +596,10 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updateBean(Plot plot) { |
|
|
|
|
if (plot != null && plot instanceof VanChartMapPlot) { |
|
|
|
|
if (plot instanceof VanChartMapPlot) { |
|
|
|
|
if (markerTypeCom != null) { |
|
|
|
|
((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex())); |
|
|
|
|
((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parse((String) markerTypeCom.getSelectedItem())); |
|
|
|
|
checkMarkerComboboxModel((VanChartMapPlot) plot); |
|
|
|
|
} |
|
|
|
|
if (nullValueColorBox != null) { |
|
|
|
|
//TODO Bjorn 地图空值背景自动
|
|
|
|
@ -587,6 +660,10 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); |
|
|
|
|
|
|
|
|
|
if (anchorMarkerPane != null) { |
|
|
|
|
anchorMarkerPane.populateBean(attrMarker); |
|
|
|
|
} |
|
|
|
|
if (commonMarkerPane != null) { |
|
|
|
|
commonMarkerPane.populateBean(attrMarker); |
|
|
|
|
} |
|
|
|
@ -669,11 +746,16 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
|
|
|
|
|
VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); |
|
|
|
|
defaultAttr.remove(attrBubble); |
|
|
|
|
if (markerTypeCom != null) { |
|
|
|
|
if (markerTypeCom.getSelectedIndex() == 1) { |
|
|
|
|
String selected = (String) markerTypeCom.getSelectedItem(); |
|
|
|
|
MapMarkerType markerType = MapMarkerType.parse(selected); |
|
|
|
|
|
|
|
|
|
if (markerType == MapMarkerType.ANCHOR) { |
|
|
|
|
defaultAttr.addDataSeriesCondition(anchorMarkerPane.updateBean()); |
|
|
|
|
} else if (markerType == MapMarkerType.COMMON) { |
|
|
|
|
defaultAttr.addDataSeriesCondition(commonMarkerPane.updateBean()); |
|
|
|
|
} else if (markerTypeCom.getSelectedIndex() == 2) { |
|
|
|
|
} else if (markerType == MapMarkerType.BUBBLE) { |
|
|
|
|
defaultAttr.addDataSeriesCondition(bubblePane.updateBean()); |
|
|
|
|
} else if (markerTypeCom.getSelectedIndex() == 3) { |
|
|
|
|
} else if (markerType == MapMarkerType.IMAGE) { |
|
|
|
|
defaultAttr.addDataSeriesCondition(imageMarkerPane.updateBean()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|