forked from fanruan/design
zheng
5 years ago
14 changed files with 376 additions and 224 deletions
@ -1,29 +0,0 @@
|
||||
package com.fr.van.chart.bubble; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
|
||||
import com.fr.plugin.chart.base.VanChartConstants; |
||||
import com.fr.plugin.chart.bubble.VanChartBubblePlot; |
||||
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort; |
||||
|
||||
/** |
||||
* Created by Mitisky on 16/3/31. |
||||
*/ |
||||
public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort { |
||||
protected String[] getNameArray() { |
||||
Plot plot = chart.getPlot(); |
||||
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { |
||||
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_Axis"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}; |
||||
} |
||||
return super.getNameArray(); |
||||
} |
||||
|
||||
protected String[] getValueArray() { |
||||
Plot plot = chart.getPlot(); |
||||
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { |
||||
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; |
||||
} |
||||
return super.getValueArray(); |
||||
} |
||||
|
||||
} |
@ -1,19 +1,15 @@
|
||||
package com.fr.van.chart.designer.other; |
||||
|
||||
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import com.fr.van.chart.designer.other.zoom.MapZoomPane; |
||||
import com.fr.van.chart.designer.other.zoom.ZoomPane; |
||||
|
||||
/** |
||||
* Created by mengao on 2017/4/7. |
||||
*/ |
||||
public class VanChartInteractivePaneWithMapZoom extends VanChartInteractivePaneWithOutSort { |
||||
|
||||
@Override |
||||
protected JPanel createZoomPaneContent(JPanel zoomWidgetPane, JPanel zoomGesturePane, JPanel changeEnablePane, JPanel zoomTypePane, VanChartPlot plot) { |
||||
JPanel panel = new JPanel(new BorderLayout(0, 4)); |
||||
panel.add(zoomWidgetPane, BorderLayout.NORTH); |
||||
panel.add(zoomGesturePane, BorderLayout.CENTER); |
||||
return panel; |
||||
protected ZoomPane createZoomPane() { |
||||
return new MapZoomPane(); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,47 @@
|
||||
package com.fr.van.chart.designer.other.zoom; |
||||
|
||||
import com.fr.chartx.attr.ZoomAttribute; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* Created by shine on 2019/08/28. |
||||
*/ |
||||
public class MapZoomPane extends ZoomPane { |
||||
|
||||
private UIButtonGroup<Boolean> mapZoomWidget;//地图缩放控件
|
||||
private UIButtonGroup<Boolean> gestureZoomGroup;//地图手势缩放
|
||||
|
||||
@Override |
||||
protected Component[][] getSouthComps() { |
||||
mapZoomWidget = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") |
||||
, Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); |
||||
|
||||
gestureZoomGroup = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") |
||||
, Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); |
||||
|
||||
|
||||
return new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Widget")), mapZoomWidget}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_ZoomGesture")), gestureZoomGroup} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ZoomAttribute ob) { |
||||
super.populateBean(ob); |
||||
mapZoomWidget.setSelectedItem(ob.isMapZoomWidget()); |
||||
gestureZoomGroup.setSelectedItem(ob.isGestureZoom()); |
||||
} |
||||
|
||||
@Override |
||||
public ZoomAttribute updateBean() { |
||||
ZoomAttribute zoomAttribute = super.updateBean(); |
||||
zoomAttribute.setMapZoomWidget(mapZoomWidget.getSelectedItem()); |
||||
zoomAttribute.setGestureZoom(gestureZoomGroup.getSelectedItem()); |
||||
return zoomAttribute; |
||||
} |
||||
} |
@ -0,0 +1,224 @@
|
||||
package com.fr.van.chart.designer.other.zoom; |
||||
|
||||
import com.fr.chartx.attr.ZoomAttribute; |
||||
import com.fr.chartx.attr.ZoomInitialDisplayType; |
||||
import com.fr.chartx.attr.ZoomModeType; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.extended.chart.StringFormula; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.CardLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* Created by shine on 2019/08/28. |
||||
*/ |
||||
public class ZoomPane extends BasicBeanPane<ZoomAttribute> { |
||||
|
||||
private UIButtonGroup<ZoomModeType> modeTypeButtonGroup; |
||||
|
||||
private JPanel customModePane; |
||||
private UIComboBox initialDisplayTypeComboBox; |
||||
private JPanel initialDisplayCardPane; |
||||
private UISpinner topCategorySpinner; |
||||
private TinyFormulaPane leftFormulaPane; |
||||
private TinyFormulaPane rightFormulaPane; |
||||
|
||||
private UIButtonGroup<Boolean> selectionZoomGroup; |
||||
|
||||
public ZoomPane() { |
||||
initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
|
||||
double f = TableLayout.FILL; |
||||
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {f, e}; |
||||
|
||||
JPanel northPane = createNorthPane(f, p); |
||||
|
||||
initCustomModePane(columnSize, p); |
||||
|
||||
JPanel southPane = createSouthPane(f, p); |
||||
|
||||
this.setLayout(new BorderLayout(0, 6)); |
||||
|
||||
if (northPane != null) { |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
} |
||||
if (customModePane != null) { |
||||
this.add(customModePane, BorderLayout.CENTER); |
||||
} |
||||
if (southPane != null) { |
||||
this.add(southPane, BorderLayout.SOUTH); |
||||
} |
||||
} |
||||
|
||||
protected JPanel createNorthPane(double f, double p) { |
||||
modeTypeButtonGroup = new UIButtonGroup<ZoomModeType>(new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Mode_Custom"), |
||||
Toolkit.i18nText("Fine-Design_Chart_Close") |
||||
}, new ZoomModeType[]{ZoomModeType.AUTO, ZoomModeType.CUSTOM, ZoomModeType.CLOSE}); |
||||
|
||||
modeTypeButtonGroup.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
checkCustomModePane(); |
||||
} |
||||
}); |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Mode_type")), modeTypeButtonGroup} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p} |
||||
, new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}); |
||||
} |
||||
|
||||
private JPanel createSouthPane(double f, double p) { |
||||
|
||||
Component[][] components = getSouthComps(); |
||||
|
||||
double[] rows = new double[components.length]; |
||||
Arrays.fill(rows, p); |
||||
|
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rows |
||||
, new double[]{f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}); |
||||
} |
||||
|
||||
protected Component[][] getSouthComps() { |
||||
selectionZoomGroup = new UIButtonGroup<Boolean>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open") |
||||
, Toolkit.i18nText("Fine-Design_Chart_Close")}, new Boolean[]{true, false}); |
||||
|
||||
return new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Selection_Zoom")), selectionZoomGroup} |
||||
}; |
||||
} |
||||
|
||||
protected void initCustomModePane(double[] columnSize, double p) { |
||||
initialDisplayTypeComboBox = new UIComboBox(new ZoomInitialDisplayType[]{ |
||||
ZoomInitialDisplayType.TOP_CATEGORY, |
||||
ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY}); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_InitialDisplay")), initialDisplayTypeComboBox} |
||||
}; |
||||
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p}, columnSize); |
||||
|
||||
|
||||
initInitialDisplayCardPane(columnSize, p); |
||||
|
||||
customModePane = new JPanel(new BorderLayout(0, 6)); |
||||
customModePane.add(northPane, BorderLayout.NORTH); |
||||
customModePane.add(initialDisplayCardPane, BorderLayout.CENTER); |
||||
customModePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); |
||||
} |
||||
|
||||
private void initInitialDisplayCardPane(double[] columnSize, double p) { |
||||
topCategorySpinner = new UISpinner(1, Integer.MAX_VALUE, 1); |
||||
Component[][] components1 = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Number")), topCategorySpinner} |
||||
}; |
||||
final JPanel topPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components1, new double[]{p}, columnSize); |
||||
|
||||
|
||||
leftFormulaPane = new TinyFormulaPane(); |
||||
rightFormulaPane = new TinyFormulaPane(); |
||||
Component[][] components2 = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Left_Boundary")), leftFormulaPane}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Right_Boundary")), rightFormulaPane} |
||||
}; |
||||
final JPanel leftRightPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, new double[]{p, p}, columnSize); |
||||
|
||||
initialDisplayCardPane = new JPanel(new CardLayout()) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return initialDisplayTypeComboBox.getSelectedIndex() == 0 ? topPane.getPreferredSize() : leftRightPane.getPreferredSize(); |
||||
} |
||||
}; |
||||
initialDisplayCardPane.add(topPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); |
||||
initialDisplayCardPane.add(leftRightPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString()); |
||||
initialDisplayTypeComboBox.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
checkInitialDisplayCardPane(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void checkCustomModePane() { |
||||
customModePane.setVisible(modeTypeButtonGroup.getSelectedItem() == ZoomModeType.CUSTOM); |
||||
} |
||||
|
||||
private void checkInitialDisplayCardPane() { |
||||
CardLayout cardLayout = (CardLayout) initialDisplayCardPane.getLayout(); |
||||
if (ComparatorUtils.equals(initialDisplayTypeComboBox.getSelectedItem(), ZoomInitialDisplayType.TOP_CATEGORY)) { |
||||
cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.TOP_CATEGORY.toString()); |
||||
} else { |
||||
cardLayout.show(initialDisplayCardPane, ZoomInitialDisplayType.LEFT_RIGHT_BOUNDARY.toString()); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void populateBean(ZoomAttribute ob) { |
||||
modeTypeButtonGroup.setSelectedItem(ob.getModeType()); |
||||
|
||||
initialDisplayTypeComboBox.setSelectedItem(ob.getInitialDisplayType()); |
||||
|
||||
topCategorySpinner.setValue(ob.getTopCategory()); |
||||
|
||||
if (ob.getLeft() != null) { |
||||
leftFormulaPane.populateBean(ob.getLeft().getContent()); |
||||
} |
||||
if (ob.getRight() != null) { |
||||
rightFormulaPane.populateBean(ob.getRight().getContent()); |
||||
} |
||||
|
||||
selectionZoomGroup.setSelectedItem(ob.isSelectionZoom()); |
||||
|
||||
checkInitialDisplayCardPane(); |
||||
checkCustomModePane(); |
||||
} |
||||
|
||||
@Override |
||||
public ZoomAttribute updateBean() { |
||||
ZoomAttribute zoomAttribute = new ZoomAttribute(); |
||||
|
||||
zoomAttribute.setModeType(modeTypeButtonGroup.getSelectedItem()); |
||||
|
||||
zoomAttribute.setInitialDisplayType((ZoomInitialDisplayType) initialDisplayTypeComboBox.getSelectedItem()); |
||||
|
||||
zoomAttribute.setTopCategory((int) topCategorySpinner.getValue()); |
||||
|
||||
zoomAttribute.setLeft(new StringFormula(leftFormulaPane.updateBean())); |
||||
zoomAttribute.setRight(new StringFormula(rightFormulaPane.updateBean())); |
||||
|
||||
zoomAttribute.setSelectionZoom(selectionZoomGroup.getSelectedItem()); |
||||
|
||||
return zoomAttribute; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.van.chart.designer.other.zoom; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* Created by shine on 2019/08/28. |
||||
*/ |
||||
public class ZoomPaneWithOutMode extends ZoomPane { |
||||
@Override |
||||
protected JPanel createNorthPane(double f, double p) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void initCustomModePane(double[] columnSize, double p) { |
||||
} |
||||
} |
Loading…
Reference in new issue