From b3401f978c49e475128e10492e0bf55af102d074 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Thu, 23 Jun 2016 17:35:29 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=BF=AD=E4=BB=A3-=E5=87=B8=E6=98=BE?= =?UTF-8?q?=E6=96=B0=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 9edac3e5f..4f5db4b69 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -1,5 +1,6 @@ package com.fr.design; +import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; @@ -29,16 +30,15 @@ import com.fr.stable.plugin.PluginSimplify; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by eason on 14/12/29. */ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { + private static final String OLD_CHART_PREFIX = "FineReport"; + private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ChartTypeInterfaceManager classManager = null; @@ -133,14 +133,32 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - + //先构建新旧图表数组 + List newChartList = new ArrayList(); + List oldChartList = new ArrayList(); Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); - paneList.add(creator.getPlotTypePane()); + if (isNewChart(entry.getKey())){ + newChartList.add((IndependentChartUIProvider) entry.getValue()); + }else { + oldChartList.add((IndependentChartUIProvider) entry.getValue()); + } + } + //新图表 + for (int i = 0; i < newChartList.size(); i++) { + paneList.add(newChartList.get(i).getPlotTypePane()); } + //老图表 + for (int i = 0; i < oldChartList.size(); i++) { + paneList.add(oldChartList.get(i).getPlotTypePane()); + } + + + } + private boolean isNewChart(Object key) { + return !Utils.objectToString(key).startsWith(OLD_CHART_PREFIX); } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { From 6ae8a27ead76eb8b46ff60aee6deb3f1b7406cb9 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 14:56:34 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 75 ++++++++----------- .../creator/cardlayout/XWCoverCardLayout.java | 7 ++ 2 files changed, 37 insertions(+), 45 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 4f5db4b69..599263004 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -1,6 +1,5 @@ package com.fr.design; -import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; @@ -30,26 +29,29 @@ import com.fr.stable.plugin.PluginSimplify; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; -import java.util.*; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Created by eason on 14/12/29. */ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { - private static final String OLD_CHART_PREFIX = "FineReport"; - private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ChartTypeInterfaceManager classManager = null; + private static boolean isReadDefault = false; + private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); - classManager.readDefault(); + //默认图表类型在新图表类型后面读取 classManager.readXMLFile(); } return classManager; @@ -68,25 +70,26 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private static void readDefault() { - - chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - + if (!isReadDefault) { + chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + } + isReadDefault = true; } @@ -133,32 +136,14 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - //先构建新旧图表数组 - List newChartList = new ArrayList(); - List oldChartList = new ArrayList(); + classManager.readDefault(); Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - if (isNewChart(entry.getKey())){ - newChartList.add((IndependentChartUIProvider) entry.getValue()); - }else { - oldChartList.add((IndependentChartUIProvider) entry.getValue()); - } + IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); + paneList.add(creator.getPlotTypePane()); } - //新图表 - for (int i = 0; i < newChartList.size(); i++) { - paneList.add(newChartList.get(i).getPlotTypePane()); - } - //老图表 - for (int i = 0; i < oldChartList.size(); i++) { - paneList.add(oldChartList.get(i).getPlotTypePane()); - } - - - } - private boolean isNewChart(Object key) { - return !Utils.objectToString(key).startsWith(OLD_CHART_PREFIX); } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java new file mode 100644 index 000000000..12c808382 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java @@ -0,0 +1,7 @@ +package com.fr.design.designer.creator.cardlayout; + +/** + * Created by Fangjie on 2016/6/30. + */ +public class XWCoverCardLayout { +} From b4d4f2eb4cd5f28fb7273467e5da378241e9a82c Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 15:14:55 +0800 Subject: [PATCH 3/8] update --- .../fr/design/ChartTypeInterfaceManager.java | 44 ++++++++----------- .../creator/cardlayout/XWCoverCardLayout.java | 7 --- 2 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 599263004..d102a3fc0 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -38,20 +38,17 @@ import java.util.Map; * Created by eason on 14/12/29. */ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { - private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ChartTypeInterfaceManager classManager = null; - private static boolean isReadDefault = false; - private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); - //默认图表类型在新图表类型后面读取 + classManager.readDefault(); classManager.readXMLFile(); } return classManager; @@ -70,27 +67,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private static void readDefault() { - if (!isReadDefault) { - chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - } - isReadDefault = true; - + chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); } public String getIconPath(String plotID) { @@ -136,7 +129,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - classManager.readDefault(); Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java deleted file mode 100644 index 12c808382..000000000 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.fr.design.designer.creator.cardlayout; - -/** - * Created by Fangjie on 2016/6/30. - */ -public class XWCoverCardLayout { -} From 812007545655579dd2ab892eaeb60a6642adddfb Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 15:42:13 +0800 Subject: [PATCH 4/8] update --- .../fr/design/ChartTypeInterfaceManager.java | 26 +++++--- .../creator/cardlayout/XWCoverCardLayout.java | 63 +++++++++++++++++++ 2 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d102a3fc0..ae30cb25f 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -1,9 +1,11 @@ package com.fr.design; import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chart.fun.IndependentChartProvider; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; @@ -29,10 +31,7 @@ import com.fr.stable.plugin.PluginSimplify; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by eason on 14/12/29. @@ -43,6 +42,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private static ChartTypeInterfaceManager classManager = null; private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); + private static List chartOrderList = new ArrayList(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { @@ -84,6 +84,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + + for (String plotID :chartTypeInterfaces.keySet()){ + if (!chartOrderList.contains(plotID)){ + chartOrderList.add(plotID); + } + } } public String getIconPath(String plotID) { @@ -109,6 +115,10 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh PluginMessage.remindUpdate(className); } else if (!chartTypeInterfaces.containsKey(plotID)) { chartTypeInterfaces.put(plotID, provider); + //新图表类型插入到前面 + if (!chartOrderList.contains(plotID)) { + chartOrderList.add(0, plotID); + } } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); @@ -129,13 +139,11 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - Iterator iterator = chartTypeInterfaces.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); + for (int i = 0; i < chartOrderList.size(); i++){ + String plotID = chartOrderList.get(i); + IndependentChartUIProvider creator = chartTypeInterfaces.get(plotID); paneList.add(creator.getPlotTypePane()); } - } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java new file mode 100644 index 000000000..8d0cb1089 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java @@ -0,0 +1,63 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; + +import java.awt.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; + +/** + * Created by Fangjie on 2016/6/30. + */ +public class XWCoverCardLayout extends XWCardMainBorderLayout{ + + private boolean mouseEnter; + + public boolean isMouseEnter() { + return mouseEnter; + } + + public void setMouseEnter(boolean mouseEnter) { + this.mouseEnter = mouseEnter; + } + + /** + * 构造函数 + * + * @param border + * @param dimension + */ + public XWCoverCardLayout(WCardMainBorderLayout border, Dimension dimension) { + super(border, dimension); + } + + public void paint(Graphics g) { + super.paint(g); + + if (mouseEnter) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + Paint old_paint = g2d.getPaint(); + + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); + + g2d.setColor(Color.YELLOW); + + int x = 1; + int y = 1; + int w = getWidth(); + int h = getHeight(); + + g2d.fillRect(x, y, w, h); + + g2d.setColor(Color.BLACK); + + g2d.drawRect(getX(), getY(), getWidth(), getHeight()); + + g2d.setComposite(oldComposite); + + g2d.setPaint(old_paint); + } + } + +} From 4efeeb7d75ea11645abc9d11be579ae6285fcfcb Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 15:46:45 +0800 Subject: [PATCH 5/8] updae --- .../creator/cardlayout/XWCoverCardLayout.java | 63 ------------------- 1 file changed, 63 deletions(-) delete mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java deleted file mode 100644 index 8d0cb1089..000000000 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fr.design.designer.creator.cardlayout; - -import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; - -import java.awt.*; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; - -/** - * Created by Fangjie on 2016/6/30. - */ -public class XWCoverCardLayout extends XWCardMainBorderLayout{ - - private boolean mouseEnter; - - public boolean isMouseEnter() { - return mouseEnter; - } - - public void setMouseEnter(boolean mouseEnter) { - this.mouseEnter = mouseEnter; - } - - /** - * 构造函数 - * - * @param border - * @param dimension - */ - public XWCoverCardLayout(WCardMainBorderLayout border, Dimension dimension) { - super(border, dimension); - } - - public void paint(Graphics g) { - super.paint(g); - - if (mouseEnter) { - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - Paint old_paint = g2d.getPaint(); - - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); - - g2d.setColor(Color.YELLOW); - - int x = 1; - int y = 1; - int w = getWidth(); - int h = getHeight(); - - g2d.fillRect(x, y, w, h); - - g2d.setColor(Color.BLACK); - - g2d.drawRect(getX(), getY(), getWidth(), getHeight()); - - g2d.setComposite(oldComposite); - - g2d.setPaint(old_paint); - } - } - -} From cb106878b5b40c9dfcc092b36b66bc7ef4162e69 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 15:49:19 +0800 Subject: [PATCH 6/8] update --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index ae30cb25f..3704db124 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -1,11 +1,9 @@ package com.fr.design; import com.fr.chart.base.ChartConstants; -import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chart.fun.IndependentChartProvider; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; From ef30f9e9d8711f9381b7a9f7363bd3e9073af94d Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 19:49:07 +0800 Subject: [PATCH 7/8] update --- .../fr/design/ChartTypeInterfaceManager.java | 46 +++++++++----- .../creator/cardlayout/XWCoverCardLayout.java | 63 +++++++++++++++++++ 2 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 3704db124..0d2b3ad68 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -25,28 +25,31 @@ import com.fr.stable.EnvChangedListener; import com.fr.stable.StringUtils; import com.fr.stable.fun.Authorize; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; +import com.fr.stable.plugin.PluginReadListener; import com.fr.stable.plugin.PluginSimplify; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; -import java.util.*; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Created by eason on 14/12/29. */ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { + private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ChartTypeInterfaceManager classManager = null; private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); - private static List chartOrderList = new ArrayList(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); - classManager.readDefault(); classManager.readXMLFile(); } return classManager; @@ -60,11 +63,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh }); } + static { + GeneralContext.addPluginReadListener(new PluginReadListener() { + @Override + public void success() { + if (chartTypeInterfaces != null) { + readDefault(); + } + } + }); + } + private synchronized static void envChanged() { classManager = null; } private static void readDefault() { + chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); @@ -83,15 +98,15 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - for (String plotID :chartTypeInterfaces.keySet()){ - if (!chartOrderList.contains(plotID)){ - chartOrderList.add(plotID); - } - } + } public String getIconPath(String plotID) { - return chartTypeInterfaces.get(plotID).getIconPath(); + if (chartTypeInterfaces.get(plotID) != null) { + return chartTypeInterfaces.get(plotID).getIconPath(); + }else { + return StringUtils.EMPTY; + } } /** @@ -113,10 +128,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh PluginMessage.remindUpdate(className); } else if (!chartTypeInterfaces.containsKey(plotID)) { chartTypeInterfaces.put(plotID, provider); - //新图表类型插入到前面 - if (!chartOrderList.contains(plotID)) { - chartOrderList.add(0, plotID); - } } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); @@ -137,11 +148,14 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - for (int i = 0; i < chartOrderList.size(); i++){ - String plotID = chartOrderList.get(i); - IndependentChartUIProvider creator = chartTypeInterfaces.get(plotID); + + Iterator iterator = chartTypeInterfaces.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = (Map.Entry) iterator.next(); + IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); paneList.add(creator.getPlotTypePane()); } + } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java new file mode 100644 index 000000000..8d0cb1089 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java @@ -0,0 +1,63 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; + +import java.awt.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; + +/** + * Created by Fangjie on 2016/6/30. + */ +public class XWCoverCardLayout extends XWCardMainBorderLayout{ + + private boolean mouseEnter; + + public boolean isMouseEnter() { + return mouseEnter; + } + + public void setMouseEnter(boolean mouseEnter) { + this.mouseEnter = mouseEnter; + } + + /** + * 构造函数 + * + * @param border + * @param dimension + */ + public XWCoverCardLayout(WCardMainBorderLayout border, Dimension dimension) { + super(border, dimension); + } + + public void paint(Graphics g) { + super.paint(g); + + if (mouseEnter) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + Paint old_paint = g2d.getPaint(); + + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); + + g2d.setColor(Color.YELLOW); + + int x = 1; + int y = 1; + int w = getWidth(); + int h = getHeight(); + + g2d.fillRect(x, y, w, h); + + g2d.setColor(Color.BLACK); + + g2d.drawRect(getX(), getY(), getWidth(), getHeight()); + + g2d.setComposite(oldComposite); + + g2d.setPaint(old_paint); + } + } + +} From 67e6c176153c129f3fa63b5ad45722eba9356228 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 19:51:24 +0800 Subject: [PATCH 8/8] update --- .../creator/cardlayout/XWCoverCardLayout.java | 63 ------------------- 1 file changed, 63 deletions(-) delete mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java deleted file mode 100644 index 8d0cb1089..000000000 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.fr.design.designer.creator.cardlayout; - -import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; - -import java.awt.*; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; - -/** - * Created by Fangjie on 2016/6/30. - */ -public class XWCoverCardLayout extends XWCardMainBorderLayout{ - - private boolean mouseEnter; - - public boolean isMouseEnter() { - return mouseEnter; - } - - public void setMouseEnter(boolean mouseEnter) { - this.mouseEnter = mouseEnter; - } - - /** - * 构造函数 - * - * @param border - * @param dimension - */ - public XWCoverCardLayout(WCardMainBorderLayout border, Dimension dimension) { - super(border, dimension); - } - - public void paint(Graphics g) { - super.paint(g); - - if (mouseEnter) { - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - Paint old_paint = g2d.getPaint(); - - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f)); - - g2d.setColor(Color.YELLOW); - - int x = 1; - int y = 1; - int w = getWidth(); - int h = getHeight(); - - g2d.fillRect(x, y, w, h); - - g2d.setColor(Color.BLACK); - - g2d.drawRect(getX(), getY(), getWidth(), getHeight()); - - g2d.setComposite(oldComposite); - - g2d.setPaint(old_paint); - } - } - -}