diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index c3213c10ba..c5bfdc8390 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -4,7 +4,6 @@ import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.gui.ChartComponent; -import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartHyperlinkGroup; @@ -16,42 +15,37 @@ import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleScope; import com.fr.module.Activator; import com.fr.module.extension.Prepare; -import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; -import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.map.server.ChartMapEditorAction; /** * Created by juhaoyu on 2018/6/27. */ public class ChartDesignerActivator extends Activator implements Prepare { - + @Override public void start() { - + StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); - + DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); - + DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); - + DesignModuleFactory.registerChartDialogClass(ChartDialog.class); - + DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); - + ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); ActionFactory.registerChartEmptyDataStyleAction(new ChartEmptyDataStyleAction()); ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction()); - + ActionFactory.registerChartCollection(ChartCollection.class); - + DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); - - DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); - DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ChartTypeInterfaceManager.addPluginChangedListener(); } @@ -63,6 +57,6 @@ public class ChartDesignerActivator extends Activator implements Prepare { @Override public void stop() { - + } } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index ca1f4f1400..c8fafe9cdb 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -31,7 +31,7 @@ import java.awt.event.MouseMotionListener; * 类说明: 事件说明: 工具栏编辑--> 是刷新ChartComponent 然后响应整个设计块的改变事件 右键编辑 ---> 刷新ChartCompment 刷新对应的工具栏(加入事件) 然后响应整个设计块的改变事件 */ -public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener, CallbackEvent{ +public class ChartComponent extends MiddleChartComponent implements MouseListener, MouseMotionListener{ private static final long serialVersionUID = 744164838619052097L; private final List listeners = new ArrayList(); private ChartCollection chartCollection4Design; @@ -257,12 +257,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene if (resolution == 0){ resolution = ScreenResolution.getScreenResolution(); } - painter.paint(g2d, chartWidth, chartHeight, resolution, null, this); + painter.paint(g2d, chartWidth, chartHeight, resolution, null); } } - - @Override - public void callback() { - this.repaint(); - } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index 41202061cd..a3e610460b 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -118,6 +118,7 @@ public class MapAreaMatchPane extends BasicBeanPane { matchAreaTable.setItems(treeNodeAndItems.getSecond()); matchResultTable = new MatchResultTable(new Object[0][3], HEADER_WITH_EMPTY); + matchResultTable.setItems(treeNodeAndItems.getSecond()); DefaultTableModel model = new DefaultTableModel(new Object[0][3], HEADER_WITH_EMPTY); matchResultTable.setModel(model); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java index 9c16b4663d..9dd13e77fb 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchAreaTable.java @@ -1,6 +1,5 @@ package com.fr.design.chartx.component; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.general.GeneralUtils; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; @@ -63,6 +62,16 @@ public class MatchAreaTable extends JTable { this.areaNameIndex = areaNameIndex; } + @Override + public boolean isCellEditable(int row, int column) { + //第一列不可编辑 + int col = convertColumnIndexToModel(column); + if (col == 0) { + return false; + } + return true; + } + public void setModel(TableModel dataModel) { super.setModel(dataModel); @@ -70,7 +79,6 @@ public class MatchAreaTable extends JTable { items = new HashSet<>(); } TableColumnModel columnModel = getColumnModel(); - columnModel.getColumn(0).setCellEditor(new UILabelEditor()); columnModel.getColumn(1).setCellEditor(new UIComboBoxRenderAndEditor()); columnModel.getColumn(1).setCellRenderer(new UIComboBoxRenderAndEditor()); } @@ -131,20 +139,4 @@ public class MatchAreaTable extends JTable { return comboBox.getSelectedItem(); } } - - public static class UILabelEditor extends AbstractCellEditor implements TableCellEditor { - - UILabel uiLabel; - - public Component getTableCellEditorComponent(JTable table, Object value, - boolean isSelected, - int row, int column) { - uiLabel = new UILabel(GeneralUtils.objectToString(value)); - return uiLabel; - } - - public Object getCellEditorValue() { - return uiLabel.getText(); - } - } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java index 8a85c84a47..5f03a75516 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MatchResultTable.java @@ -3,8 +3,10 @@ package com.fr.design.chartx.component; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.plugin.chart.map.data.MapMatchResult; import com.fr.stable.StringUtils; @@ -18,7 +20,9 @@ import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import java.util.Vector; +import java.awt.Color; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -32,6 +36,8 @@ public class MatchResultTable extends JTable { private MatchAreaTable matchAreaTable; + private Set items; + public MatchResultTable(Object[][] data, Object[] header) { super(data, header); this.getTableHeader().setReorderingAllowed(false); @@ -41,12 +47,26 @@ public class MatchResultTable extends JTable { this.matchAreaTable = matchAreaTable; } + public void setItems(Set items) { + this.items = items; + } + + @Override + public boolean isCellEditable(int row, int column) { + //第一列和第二列不可编辑 + int col = convertColumnIndexToModel(column); + if (col == 0 || col == 1) { + return false; + } + return true; + } + + public void setModel(TableModel dataModel) { super.setModel(dataModel); TableColumnModel columnModel = getColumnModel(); - columnModel.getColumn(0).setCellEditor(new MatchAreaTable.UILabelEditor()); - columnModel.getColumn(1).setCellEditor(new MatchAreaTable.UILabelEditor()); + columnModel.getColumn(1).setCellRenderer(new UILabelEditorAndRender()); columnModel.getColumn(2).setCellEditor(new UIButtonEditorAndRender()); columnModel.getColumn(2).setCellRenderer(new UIButtonEditorAndRender()); columnModel.getColumn(2).setMaxWidth(20); @@ -56,7 +76,6 @@ public class MatchResultTable extends JTable { int rowCount = this.getRowCount(); for (int i = 0; i < rowCount; i++) { if (ComparatorUtils.equals(this.getValueAt(i, 0), areaName)) { - getColumnModel().getColumn(1).getCellEditor().stopCellEditing(); this.setValueAt(result, i, 1); return; } @@ -143,4 +162,18 @@ public class MatchResultTable extends JTable { } } + public class UILabelEditorAndRender implements TableCellRenderer { + + UILabel uiLabel; + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + uiLabel = new UILabel(GeneralUtils.objectToString(value)); + if (!items.contains(value)) { + uiLabel.setForeground(Color.GRAY); + uiLabel.setText(value + Toolkit.i18nText("Fine-Design_Chart_Lost_Data")); + } + return uiLabel; + } + } + } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index af65408931..0089785ce2 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -115,12 +115,6 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare if (!ComparatorUtils.equals(collection, lastCollection)) { - VanChart vanChart = collection.getSelectedChartProvider(VanChart.class); - if (vanChart != null) { - //此处画图 - vanChart.demoImgEvent(true); - } - try { lastCollection = collection.clone(); } catch (CloneNotSupportedException e) {