You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
6.0 KiB
154 lines
6.0 KiB
3 years ago
|
package com.fr.plugin.shdcmap.ui;
|
||
|
|
||
|
import com.fr.chart.base.TextAttr;
|
||
|
import com.fr.design.gui.frpane.UINumberDragPane;
|
||
|
import com.fr.design.gui.ibutton.UIButtonGroup;
|
||
|
import com.fr.design.gui.icheckbox.UICheckBox;
|
||
|
import com.fr.design.gui.ilable.UILabel;
|
||
|
import com.fr.design.gui.ispinner.UISpinner;
|
||
|
import com.fr.design.gui.itextarea.UITextArea;
|
||
|
import com.fr.design.i18n.Toolkit;
|
||
|
import com.fr.design.layout.TableLayout;
|
||
|
import com.fr.design.layout.TableLayoutHelper;
|
||
|
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
|
||
|
import com.fr.design.style.color.ColorSelectBox;
|
||
|
import com.fr.general.FRFont;
|
||
|
import com.fr.json.JSONObject;
|
||
|
import com.fr.van.chart.designer.AbstractVanChartScrollPane;
|
||
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
|
||
|
|
||
|
import javax.swing.*;
|
||
|
import javax.swing.event.ChangeEvent;
|
||
|
import javax.swing.event.ChangeListener;
|
||
|
import java.awt.*;
|
||
|
|
||
|
/**
|
||
|
* @author duan.jingliang
|
||
|
*/
|
||
|
public class CustomChartPointCreator extends AbstractVanChartScrollPane<JSONObject> {
|
||
|
|
||
|
private ImageChooserPane pointPane;
|
||
|
private UISpinner pointSize;
|
||
|
|
||
|
private UISpinner lineWidth;
|
||
|
private ColorSelectBox lineColor;
|
||
|
private ColorSelectBox fillColor;
|
||
|
private UINumberDragPane fillOpacity;
|
||
|
|
||
|
|
||
|
|
||
|
@Override
|
||
|
protected JPanel createContentPane() {
|
||
|
return new ContentPane();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void populateBean(JSONObject pointConf) {
|
||
|
if (null != pointConf) {
|
||
|
pointSize.setValue(pointConf.getDouble("pointSize"));
|
||
|
ImageEntity imgEnt = new ImageEntity();
|
||
|
imgEnt.setImagestr(pointConf.getString("pointimg"));
|
||
|
imgEnt.setImagetype(pointConf.getString("pointimgtype"));
|
||
|
imgEnt.setWidth(pointConf.getInt("pointimgw"));
|
||
|
imgEnt.setHeight(pointConf.getInt("pointimgh"));
|
||
|
this.pointPane.populateBean(imgEnt);
|
||
|
|
||
|
this.lineWidth.setValue(pointConf.getDouble("lineWidth"));
|
||
|
this.lineColor.setSelectObject(MapUtil.toColor(pointConf.getString("lineColor")));
|
||
|
this.fillColor.setSelectObject(MapUtil.toColor(pointConf.getString("fillColor")));
|
||
|
this.fillOpacity.populateBean(pointConf.getDouble("fillOpacity"));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public JSONObject updateBean() {
|
||
|
JSONObject pointConf = JSONObject.create();
|
||
|
pointConf.put("pointSize", pointSize.getValue());
|
||
|
ImageEntity imgEnt = this.pointPane.updateBean();
|
||
|
if (null != imgEnt) {
|
||
|
pointConf.put("pointimg", imgEnt.getImagestr());
|
||
|
pointConf.put("pointimgtype", imgEnt.getImagetype());
|
||
|
pointConf.put("pointimgw", imgEnt.getWidth());
|
||
|
pointConf.put("pointimgh", imgEnt.getHeight());
|
||
|
}
|
||
|
pointConf.put("lineWidth", this.lineWidth.getValue());
|
||
|
pointConf.put("lineColor", MapUtil.toHex(this.lineColor.getSelectObject()));
|
||
|
pointConf.put("fillColor", MapUtil.toHex(this.fillColor.getSelectObject()));
|
||
|
pointConf.put("fillOpacity", this.fillOpacity.updateBean());
|
||
|
return pointConf;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected String title4PopupWindow() {
|
||
|
return Toolkit.i18nText("Plugin-ShdcMap-icontitle");
|
||
|
}
|
||
|
|
||
|
private class ContentPane extends JPanel {
|
||
|
public ContentPane() {
|
||
|
initComponents();
|
||
|
}
|
||
|
|
||
|
private void initComponents() {
|
||
|
this.setLayout(new BorderLayout());
|
||
|
|
||
|
JPanel pointPane = createPointPane();
|
||
|
JPanel regionPane = createRegionPane();
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
double[] columnSize = {f};
|
||
|
double[] rowSize = {p, p, p, p};
|
||
|
Component[][] acomponents = new Component[][]{
|
||
|
new Component[]{pointPane},
|
||
|
new Component[]{regionPane}
|
||
|
};
|
||
|
|
||
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize);
|
||
|
this.add(panel, BorderLayout.CENTER);
|
||
|
this.setVisible(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private JPanel createPointPane() {
|
||
|
pointSize = new UISpinner(1, 200, 1, 80);
|
||
|
pointPane = new ImageChooserPane();
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
Component[][] components = new Component[][]{
|
||
|
{null, null},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-pointSize")), this.pointSize}
|
||
|
};
|
||
|
JPanel sizePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, f});
|
||
|
|
||
|
Component[][] comp1 = new Component[][]{
|
||
|
new Component[]{sizePane},
|
||
|
new Component[]{pointPane}
|
||
|
};
|
||
|
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p, p, p}, new double[]{f});
|
||
|
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-iconSymbolExpand"), pane);
|
||
|
}
|
||
|
|
||
|
private JPanel createRegionPane() {
|
||
|
this.lineWidth = new UISpinner(1, 10, 1, 1);
|
||
|
this.lineColor = new ColorSelectBox(100);
|
||
|
this.fillColor = new ColorSelectBox(100);
|
||
|
this.fillOpacity = new UINumberDragPane(0, 100);
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
Component[][] comps = new Component[][]{
|
||
|
{null, null},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-lineWidth")), this.lineWidth},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-lineColor")), this.lineColor},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-fillColor")), this.fillColor},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-fillOpacity")), this.fillOpacity}
|
||
|
};
|
||
|
JPanel regionPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{p, f});
|
||
|
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-regionSymbolExpand"), regionPane);
|
||
|
}
|
||
|
}
|