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.
 
 

115 lines
3.9 KiB

package com.fr.plugin.heatpointmapbox.ui;
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.heatpointmapbox.HeatPointMapChart;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import java.awt.*;
/**
* @author xx
*/
public class HeatPointMapStyleBaseMapPane extends ExtendedScrollPane<HeatPointMapChart> {
private UISpinner mapzoom;
private UITextField centerx;
private UITextField centery;
private UITextField mapStyle;
private UITextField mapKey;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(HeatPointMapChart 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"));
}
@Override
public void updateBean(HeatPointMapChart 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());
chart.setMapConf(regionConf);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-HeatPointMap-maptitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel mapContentPane = createMapContentPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] acomponents = new Component[][]{
new Component[]{mapContentPane}
};
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-HeatPointMap-mapzoom")), this.mapzoom},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-HeatPointMap-centerx")), this.centerx},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-HeatPointMap-centery")), this.centery},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-HeatPointMap-mapStyle")), this.mapStyle},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-HeatPointMap-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-HeatPointMap-BaseMapExpand"), pane);
}
}