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.
193 lines
8.8 KiB
193 lines
8.8 KiB
3 years ago
|
package com.fr.plugin.lzljgdmap.ui;
|
||
|
|
||
|
import com.fr.design.gui.frpane.UINumberDragPane;
|
||
|
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent;
|
||
|
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.itextfield.UITextField;
|
||
|
import com.fr.design.i18n.Toolkit;
|
||
|
import com.fr.design.layout.TableLayout;
|
||
|
import com.fr.design.layout.TableLayoutHelper;
|
||
|
import com.fr.design.style.color.ColorSelectBox;
|
||
|
import com.fr.extended.chart.ExtendedScrollPane;
|
||
|
import com.fr.json.JSONObject;
|
||
|
import com.fr.plugin.lzljgdmap.LzljMapChart;
|
||
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
|
||
|
|
||
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
|
||
|
/**
|
||
|
* @author fr.open
|
||
|
*/
|
||
|
public class LzljMapStyleBaseMapPane extends ExtendedScrollPane<LzljMapChart> {
|
||
|
|
||
|
private UISpinner mapzoom;
|
||
|
private UITextField centerx;
|
||
|
private UITextField centery;
|
||
|
|
||
|
private UITextField mapStyle;
|
||
|
private UITextField mapKey;
|
||
|
|
||
|
private UISpinner regionBorderWidth;
|
||
|
private ColorSelectBox regionBorderColor;
|
||
|
private ColorSelectBox areaBorderColor;
|
||
|
private ColorSelectBox countryBorderColor;
|
||
|
|
||
|
private UISpinner circleBorderWidth;
|
||
|
private ColorSelectBox circleBorderColor;
|
||
|
private ColorSelectBox circleFillColor;
|
||
|
private UINumberDragPane circleOpacity;
|
||
|
private UICheckBox showCircleDetail;
|
||
|
|
||
|
@Override
|
||
|
protected JPanel createContentPane() {
|
||
|
return new ContentPane();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void populateBean(LzljMapChart chart) {
|
||
|
JSONObject regionConf = chart.getMapConf();
|
||
|
this.mapzoom.setValue(regionConf.getDouble("mapzoom"));
|
||
|
this.centerx.setText(regionConf.getString("centerx"));
|
||
|
this.centery.setText(regionConf.getString("centery"));
|
||
|
|
||
|
this.mapStyle.setText(regionConf.getString("mapStyle"));
|
||
|
this.mapKey.setText(regionConf.getString("mapKey"));
|
||
|
|
||
|
this.regionBorderWidth.setValue(regionConf.getDouble("regionBorderWidth"));
|
||
|
this.regionBorderColor.setSelectObject(MapUtil.toColor(regionConf.getString("regionBorderColor")));
|
||
|
this.areaBorderColor.setSelectObject(MapUtil.toColor(regionConf.getString("areaBorderColor")));
|
||
|
this.countryBorderColor.setSelectObject(MapUtil.toColor(regionConf.getString("countryBorderColor")));
|
||
|
|
||
|
this.circleBorderWidth.setValue(regionConf.getDouble("circleBorderWidth"));
|
||
|
this.circleBorderColor.setSelectObject(MapUtil.toColor(regionConf.getString("circleBorderColor")));
|
||
|
this.circleFillColor.setSelectObject(MapUtil.toColor(regionConf.getString("circleFillColor")));
|
||
|
this.circleOpacity.populateBean(regionConf.getDouble("circleOpacity"));
|
||
|
this.showCircleDetail.setSelected(regionConf.getBoolean("showCircleDetail"));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void updateBean(LzljMapChart chart) {
|
||
|
JSONObject regionConf = JSONObject.create();
|
||
|
regionConf.put("mapzoom", this.mapzoom.getValue());
|
||
|
regionConf.put("centerx", this.centerx.getText());
|
||
|
regionConf.put("centery", this.centery.getText());
|
||
|
|
||
|
regionConf.put("mapStyle", this.mapStyle.getText());
|
||
|
regionConf.put("mapKey", this.mapKey.getText());
|
||
|
|
||
|
regionConf.put("regionBorderWidth", this.regionBorderWidth.getValue());
|
||
|
regionConf.put("regionBorderColor", MapUtil.toHex(this.regionBorderColor.getSelectObject()));
|
||
|
regionConf.put("areaBorderColor", MapUtil.toHex(this.areaBorderColor.getSelectObject()));
|
||
|
regionConf.put("countryBorderColor", MapUtil.toHex(this.countryBorderColor.getSelectObject()));
|
||
|
|
||
|
regionConf.put("circleBorderWidth", this.circleBorderWidth.getValue());
|
||
|
regionConf.put("circleBorderColor", MapUtil.toHex(this.circleBorderColor.getSelectObject()));
|
||
|
regionConf.put("circleFillColor", MapUtil.toHex(this.circleFillColor.getSelectObject()));
|
||
|
regionConf.put("circleOpacity", this.circleOpacity.updateBean());
|
||
|
regionConf.put("showCircleDetail", this.showCircleDetail.isSelected());
|
||
|
|
||
|
chart.setMapConf(regionConf);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected String title4PopupWindow() {
|
||
|
return Toolkit.i18nText("Plugin-LzljMap-maptitle");
|
||
|
}
|
||
|
|
||
|
private class ContentPane extends JPanel {
|
||
|
public ContentPane() {
|
||
|
initComponents();
|
||
|
}
|
||
|
|
||
|
private void initComponents() {
|
||
|
this.setLayout(new BorderLayout());
|
||
|
|
||
|
JPanel mapContentPane = createMapContentPane();
|
||
|
JPanel regionContentPane = createRegionContentPane();
|
||
|
JPanel circleContentPane = createCircleContentPane();
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
double[] columnSize = {f};
|
||
|
double[] rowSize = {p, p, p, p};
|
||
|
Component[][] acomponents = new Component[][]{
|
||
|
new Component[]{mapContentPane},
|
||
|
new Component[]{regionContentPane},
|
||
|
new Component[]{circleContentPane}
|
||
|
};
|
||
|
|
||
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize);
|
||
|
this.add(panel,BorderLayout.CENTER);
|
||
|
this.setVisible(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private JPanel createMapContentPane(){
|
||
|
|
||
|
mapzoom = new UISpinner(1, 18, 1, 1);
|
||
|
centerx = new UITextField();
|
||
|
centery = new UITextField();
|
||
|
|
||
|
mapStyle = new UITextField();
|
||
|
mapKey = new UITextField();
|
||
|
|
||
|
Component[][] components = new Component[][]{
|
||
|
{null, null},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-mapzoom")), this.mapzoom},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-centerx")), this.centerx},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-centery")), this.centery},
|
||
|
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-mapStyle")), this.mapStyle},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-mapKey")), this.mapKey}
|
||
|
} ;
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p, p, p, p, p}, new double[]{p, f});
|
||
|
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-LzljMap-BaseMapExpand"), pane);
|
||
|
}
|
||
|
|
||
|
private JPanel createRegionContentPane(){
|
||
|
regionBorderWidth = new UISpinner(0, 100, 1, 1);
|
||
|
regionBorderColor = new ColorSelectBox(100);
|
||
|
areaBorderColor = new ColorSelectBox(100);
|
||
|
countryBorderColor = new ColorSelectBox(100);
|
||
|
Component[][] components = new Component[][]{
|
||
|
{null, null},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-regionBorderWidth")), this.regionBorderWidth},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-regionBorderColor")), this.regionBorderColor},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-areaBorderColor")), this.areaBorderColor},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-countryBorderColor")), this.countryBorderColor},
|
||
|
} ;
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p, p, p, p}, new double[]{p, f});
|
||
|
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-LzljMap-RegionExpand"), pane);
|
||
|
}
|
||
|
|
||
|
private JPanel createCircleContentPane(){
|
||
|
circleBorderWidth = new UISpinner(0, 100, 1, 1);
|
||
|
circleBorderColor = new ColorSelectBox(100);
|
||
|
circleFillColor = new ColorSelectBox(100);
|
||
|
circleOpacity = new UINumberDragPane(0, 100);
|
||
|
showCircleDetail = new UICheckBox(Toolkit.i18nText("Plugin-LzljMap-showCircleDetail"));
|
||
|
Component[][] components = new Component[][]{
|
||
|
{null, null},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-circleBorderWidth")), this.circleBorderWidth},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-circleBorderColor")), this.circleBorderColor},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-circleFillColor")), this.circleFillColor},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-LzljMap-circleOpacity")), this.circleOpacity},
|
||
|
new Component[]{null, this.showCircleDetail}
|
||
|
} ;
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p, p, p, p, p}, new double[]{p, f});
|
||
|
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-LzljMap-CircleExpand"), pane);
|
||
|
}
|
||
|
}
|