Browse Source

REPORT-52490 图表配置界面 添加属性改变事件接口

feature/big-screen
shine 3 years ago
parent
commit
b15fa9dbbd
  1. 16
      designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneActionListener.java
  2. 6
      designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java
  3. 13
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  4. 112
      designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java
  5. 33
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

16
designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneActionListener.java

@ -0,0 +1,16 @@
package com.fr.design.gui.chart;
import com.fr.chart.chartattr.ChartCollection;
import java.util.EventListener;
/**
* @author shine
* @version 10.0
* Created by shine on 2021/5/26
*/
public interface ChartEditPaneActionListener extends EventListener {
void attributeChange(ChartCollection chartCollection);
}

6
designer-base/src/main/java/com/fr/design/gui/chart/ChartEditPaneProvider.java

@ -10,4 +10,10 @@ public interface ChartEditPaneProvider {
void fire();
default void addChartEditPaneActionListener(ChartEditPaneActionListener l) {
}
default void removeChartEditPaneActionListener(ChartEditPaneActionListener l) {
}
}

13
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -16,6 +16,7 @@ import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -35,6 +36,9 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
protected ChartEditPane chartEditPane;
//ID一样的话 不用新建chartEditPane
private String currentID;
private ChartPropertyPane() {
initComponent();
}
@ -46,9 +50,12 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
@Override
public void updateChartEditPane(String plotID) {
chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID);
chartEditPane.setContainer(container);
resetChartEditPane();
if (!AssistUtils.equals(currentID, plotID)) {
chartEditPane = ChartTypeInterfaceManager.getInstance().getChartEditPane(plotID);
chartEditPane.setContainer(container);
currentID = plotID;
resetChartEditPane();
}
}
@Override

112
designer-chart/src/main/java/com/fr/design/mainframe/MapEditPane.java

@ -1,112 +0,0 @@
package com.fr.design.mainframe;
import com.fr.chart.base.MapSvgAttr;
import com.fr.chart.base.MapSvgXMLHelper;
import com.fr.chart.chartglyph.MapShapeValue;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.series.PlotSeries.AbstrctMapAttrEditPane;
import com.fr.design.chart.series.PlotSeries.MapCustomPane;
import com.fr.design.chart.series.PlotSeries.MapDefiAreaNamePane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* Author : daisy
* Version: 7.1.1
* Date: 14/12/2
* Time: 下午7:17
*/
public class MapEditPane extends BasicBeanPane<MapSvgAttr>{
private UITabbedPane tabbedPane;
private MapCustomPane areaPane ;
// private MapCustomPane pointPane;
private MapDefiAreaNamePane namedPane;
private String currentMapName;
private AbstrctMapAttrEditPane editingPane;
private ChangeListener tabbedChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
switch ( tabbedPane.getSelectedIndex()){
case 1:
namedPane.populateMapAttr(editingPane.updateCurrentAttr());
editingPane = namedPane;
break;
default:
areaPane.populateMapAttr(editingPane.updateCurrentAttr());
editingPane = areaPane;
}
}
} ;
public MapEditPane(){
initTabbedPane();
this.setLayout(new BorderLayout());
this.add(tabbedPane,BorderLayout.CENTER);
}
private void initTabbedPane(){
tabbedPane = new UITabbedPane();
areaPane = new MapCustomPane(false);
// pointPane = new MapCustomPane(false);
namedPane= new MapDefiAreaNamePane(false);
areaPane.setImageSelectType(MapShapeValue.AREA);
// pointPane.setImageSelectType(MapShapeValue.POINT);
tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Image_Area"),areaPane);
// tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("FR-Chart-Map_ImagePoint"),pointPane);
tabbedPane.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Corresponding_Fields"),namedPane);
editingPane = areaPane;
}
@Override
protected String title4PopupWindow() {
return null;
}
@Override
public void populateBean(MapSvgAttr ob) {
if(!StringUtils.isEmpty(ob.getName()) && !MapSvgXMLHelper.getInstance().containsMapName(ob.getName())){
MapSvgAttr mapSvgAttr = new MapSvgAttr();
mapSvgAttr.setFilePath(MapSvgXMLHelper.customMapPath()+ CoreConstants.SEPARATOR+ob.getName()+".svg");
MapSvgXMLHelper.getInstance().addNewSvgMaps(ob.getName(), mapSvgAttr);
}
currentMapName = ob.getName();
if(editingPane == null){
editingPane = areaPane;
}
editingPane.populateMapAttr(ob);
tabbedPane.addChangeListener(tabbedChangeListener);
}
public String getCurrentMapName(){
return currentMapName;
}
public void setCurrentMapName(String currentMapName){
this.currentMapName = currentMapName;
}
@Override
public MapSvgAttr updateBean() {
MapSvgAttr currentAttr = editingPane.updateCurrentAttr();
currentMapName =currentAttr != null ? currentAttr.getName() : currentMapName;
MapSvgAttr attr = MapSvgXMLHelper.getInstance().getMapAttr(currentMapName);
if(attr != null ){
MapSvgXMLHelper.getInstance().removeNewMapAttr(currentMapName);
MapSvgXMLHelper.getInstance().pushMapAttr(currentMapName,currentAttr);
return currentAttr;
}else{
return MapSvgXMLHelper.getInstance().getNewMapAttr(currentMapName);
}
}
}

33
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -9,6 +9,7 @@ import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.chart.ChartEditPaneActionListener;
import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup;
@ -27,11 +28,11 @@ import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
public class ChartEditPane extends BasicPane implements AttributeChange, Prepare4DataSourceChange, ChartEditPaneProvider {
@ -101,6 +102,33 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
this.add(center, BorderLayout.CENTER);
}
/**
* 增加面板Listener
*/
public void addChartEditPaneActionListener(ChartEditPaneActionListener l) {
this.listenerList.add(ChartEditPaneActionListener.class, l);
}
/**
* 移除面板Listener
*/
public void removeChartEditPaneActionListener(ChartEditPaneActionListener l) {
this.listenerList.remove(ChartEditPaneActionListener.class, l);
}
private void fireAttributeChange(ChartCollection chartCollection) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 1; i >= 0; i -= 1) {
if (listeners[i] == ChartEditPaneActionListener.class) {
((ChartEditPaneActionListener) listeners[i + 1]).attributeChange(chartCollection);
}
}
}
AttributeChangeListener listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
@ -130,6 +158,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
}
fire();
fireAttributeChange(collection);
}
}
};

Loading…
Cancel
Save