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.

127 lines
4.3 KiB

2 years ago
package com.fr.plugin.heatpointmapbox.ui;
import com.bulenkov.iconloader.util.Base64Converter;
import com.fr.config.predefined.ColorFillStyle;
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.design.layout.TableLayoutHelper;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.json.JSONObject;
import com.fr.plugin.heatpointmapbox.HeatPointMapChart;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
/**
* @author xx
*/
public class HeatPointMapStylePointMapPane extends ExtendedScrollPane<HeatPointMapChart> {
private UISpinner pointSize;
private ImageChooserPane pointPane;
@Override
protected JPanel createContentPane() {
return new ContentPane();
}
@Override
public void populateBean(HeatPointMapChart chart) {
JSONObject pointConf = chart.getPointConf();
this.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);
}
@Override
public void updateBean(HeatPointMapChart chart) {
JSONObject pointConf = JSONObject.create();
pointConf.put("pointSize", this.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());
}
chart.setPointConf(pointConf);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-HeatPointMap-pointtitle");
}
private class ContentPane extends JPanel {
public ContentPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel pointContentPane = createPointContentPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] acomponents = new Component[][]{
new Component[]{pointContentPane}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize);
this.add(panel, BorderLayout.CENTER);
this.setVisible(true);
}
}
private JPanel createPointContentPane() {
pointSize = new UISpinner(1, 200, 1, 32);
pointPane = new ImageChooserPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
Component[][] compType = new Component[][]{
{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Plugin-HeatPointMap-pointSize")), this.pointSize}
};
JPanel pointStyleTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(compType, new double[]{p, p, p, p}, new double[]{p, f});
Component[][] comp1 = new Component[][]{
new Component[]{pointPane}
};
JPanel imgPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p, p, p}, new double[]{f});
Component[][] comp = new Component[][]{
new Component[]{pointStyleTypePane},
new Component[]{imgPane}
};
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{f});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-HeatPointMap-pointMapExpand"), pane);
}
}