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.
120 lines
4.0 KiB
120 lines
4.0 KiB
3 years ago
|
package com.fr.plugin.shdcmap.ui;
|
||
|
|
||
|
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.extended.chart.ExtendedScrollPane;
|
||
|
import com.fr.json.JSONObject;
|
||
|
import com.fr.plugin.shdcmap.CustomChart;
|
||
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
|
||
|
|
||
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
|
||
|
/**
|
||
|
* @author duan.jingliang
|
||
|
*/
|
||
|
public class CustomChartMapPane extends ExtendedScrollPane<CustomChart> {
|
||
|
|
||
|
private UISpinner mapzoom;
|
||
|
private UITextField centerx;
|
||
|
private UITextField centery;
|
||
|
|
||
|
private UITextField mapStyle;
|
||
|
|
||
|
private UICheckBox showGovRegion;
|
||
|
|
||
|
private UICheckBox showSateLayer;
|
||
|
|
||
|
@Override
|
||
|
protected JPanel createContentPane() {
|
||
|
return new ContentPane();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void populateBean(CustomChart 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.showGovRegion.setSelected(regionConf.getBoolean("showGovRegion"));
|
||
|
this.showSateLayer.setSelected(regionConf.getBoolean("showSateLayer"));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void updateBean(CustomChart 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("showGovRegion", this.showGovRegion.isSelected());
|
||
|
regionConf.put("showSateLayer", this.showSateLayer.isSelected());
|
||
|
|
||
|
chart.setMapConf(regionConf);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected String title4PopupWindow() {
|
||
|
return Toolkit.i18nText("Plugin-ShdcMap-maptitle");
|
||
|
}
|
||
|
|
||
|
private class ContentPane extends JPanel {
|
||
|
public ContentPane() {
|
||
|
initComponents();
|
||
|
}
|
||
|
|
||
|
private void initComponents() {
|
||
|
this.setLayout(new BorderLayout());
|
||
|
|
||
|
JPanel regionContentPane = createRegionContentPane();
|
||
|
|
||
|
double p = TableLayout.PREFERRED;
|
||
|
double f = TableLayout.FILL;
|
||
|
double[] columnSize = {f};
|
||
|
double[] rowSize = {p, p};
|
||
|
Component[][] acomponents = new Component[][]{
|
||
|
new Component[]{regionContentPane}
|
||
|
};
|
||
|
|
||
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize);
|
||
|
this.add(panel,BorderLayout.CENTER);
|
||
|
this.setVisible(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private JPanel createRegionContentPane(){
|
||
|
|
||
|
mapzoom = new UISpinner(1, 18, 1, 1);
|
||
|
centerx = new UITextField();
|
||
|
centery = new UITextField();
|
||
|
|
||
|
mapStyle = new UITextField();
|
||
|
|
||
|
showGovRegion = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-showGovRegion"));
|
||
|
showSateLayer = new UICheckBox(Toolkit.i18nText("Plugin-ShdcMap-showSateLayer"));
|
||
|
Component[][] components = new Component[][]{
|
||
|
{null, null},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-mapzoom")), this.mapzoom},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-centerx")), this.centerx},
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-centery")), this.centery},
|
||
|
|
||
|
new Component[]{new UILabel(Toolkit.i18nText("Plugin-ShdcMap-mapStyle")), this.mapStyle},
|
||
|
new Component[]{null, showGovRegion},
|
||
|
new Component[]{null, showSateLayer}
|
||
|
} ;
|
||
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-ShdcMap-RegionExpand"), components);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|