diff --git a/designer/src/com/fr/poly/PolyComponetsBar.java b/designer/src/com/fr/poly/PolyComponetsBar.java index 347063d9d9..1413a26e1c 100644 --- a/designer/src/com/fr/poly/PolyComponetsBar.java +++ b/designer/src/com/fr/poly/PolyComponetsBar.java @@ -28,6 +28,7 @@ public class PolyComponetsBar extends JToolBar { private static Color FOLDER_PANE_BACKGROUND = new Color(214, 223, 247); private BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); private SerIcon[] serIcons; + private static final int MAX_BAR_NUM = 15; public PolyComponetsBar() { setOrientation(SwingConstants.VERTICAL); @@ -35,10 +36,11 @@ public class PolyComponetsBar extends JToolBar { setFloatable(false); setBackground(UIConstants.NORMAL_BACKGROUND); setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); - serIcons = new SerIcon[typeName.length + 1]; + int typeLen = typeName.length < MAX_BAR_NUM ? typeName.length : MAX_BAR_NUM; + serIcons = new SerIcon[typeLen + 1]; serIcons[0] = new SerIcon(PolyECBlock.class, Inter.getLocText("Poly-Report_Block"), "Poly-Report_Block"); this.add(serIcons[0]); - for (int i = 0, len = typeName.length; i < len; i++) { + for (int i = 0; i < typeLen; i++) { BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); serIcons[i + 1] = new SerIcon(rowChart[0], Inter.getLocText(typeName[i].getName()), typeName[i].getName()); this.add(serIcons[i + 1]); diff --git a/designer_base/src/com/fr/design/images/form/toolbar/ChartF-TreeMap.png b/designer_base/src/com/fr/design/images/form/toolbar/ChartF-TreeMap.png new file mode 100644 index 0000000000..09edd2b77e Binary files /dev/null and b/designer_base/src/com/fr/design/images/form/toolbar/ChartF-TreeMap.png differ diff --git a/designer_base/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png b/designer_base/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png new file mode 100644 index 0000000000..09edd2b77e Binary files /dev/null and b/designer_base/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png differ diff --git a/designer_chart/src/com/fr/design/module/ChartDesignerModule.java b/designer_chart/src/com/fr/design/module/ChartDesignerModule.java index 7d2b72cfd9..92a0d4f112 100644 --- a/designer_chart/src/com/fr/design/module/ChartDesignerModule.java +++ b/designer_chart/src/com/fr/design/module/ChartDesignerModule.java @@ -1 +1 @@ -package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartAndWidgetPropertyPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.PluginReadListener; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartAndWidgetPropertyPane(ChartAndWidgetPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } \ No newline at end of file +package com.fr.design.module; import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.App; import com.fr.design.mainframe.ChartAndWidgetPropertyPane; import com.fr.design.mainframe.ChartPropertyPane; import com.fr.form.ui.ChartEditor; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import javax.swing.*; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-7-8 * Time: 上午9:13 */ public class ChartDesignerModule extends DesignModule { public void start() { super.start(); dealBeforeRegister(); register(); registerFloatEditor(); } protected void dealBeforeRegister(){ StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); } private void register(){ DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); DesignModuleFactory.registerChartEditorClass(ChartEditor.class); DesignModuleFactory.registerChartComponentClass(ChartComponent.class); DesignModuleFactory.registerChartDialogClass(ChartDialog.class); DesignModuleFactory.registerChartAndWidgetPropertyPane(ChartAndWidgetPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); } protected void registerFloatEditor() { ActionFactory.registerChartCollection(ChartCollection.class); } /** * 返回设计器能打开的模板类型的一个数组列表 * * @return 可以打开的模板类型的数组 */ public App[] apps4TemplateOpener() { return new App[0]; } protected WidgetOption[] options4Show() { ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; for (int i = 0; i < typeName.length; i++) { String plotID = typeName[i].getPlotID(); Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if(rowChart == null) { continue; } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); } return child; } public String getInterNationalName() { return Inter.getLocText("FR-Chart-Design_ChartModule"); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index a1f8067b42..78af66a84d 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -46,7 +46,7 @@ public class FormParaWidgetPane extends JPanel{ //预定义控件最多显示20行 private int preWidgetShowMaxRow = 20; //显示8个图表组件 - private int commonChartNum = 8; + private static final int commonChartNum = 8; //显示10个普通控件 private int commonWidgetNum = 10; private JSeparator jSeparatorPara; @@ -118,7 +118,6 @@ public class FormParaWidgetPane extends JPanel{ // 初始化的时候根据图表的总个数获得单行显示图表的个数 int totalChartNums = loadChartOptions().length; if (totalChartNums > 0) { - commonChartNum = ++totalChartNums/2; JPanel chartTypePane = new JPanel(new FlowLayout()); for (int i = 0;i < commonChartNum ;i++) { chartTypePane.add( new ToolBarButton(loadChartOptions()[i])); @@ -209,11 +208,12 @@ public class FormParaWidgetPane extends JPanel{ public void mouseClicked(MouseEvent e) { if(chartTypeWindow == null) { JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT)); - for (WidgetOption chartOption : loadChartOptions()) { + WidgetOption[] chartOptions = loadChartOptions(); + for (WidgetOption chartOption : chartOptions) { componentsPara.add( new ToolBarButton(chartOption)); } int x = commonChartNum * (widgetButtonWidth + smallGAP); - int y = (int)Math.ceil(((double)loadWidgetOptions().length/(double)commonChartNum)) * (widgetButtonHeight + smallGAP); + int y = (int)Math.ceil(chartOptions.length/((double)commonChartNum)) * (widgetButtonHeight + smallGAP); componentsPara.setPreferredSize(new Dimension(x,y)); chartTypeWindow = new PopUpWindow(componentsPara, Inter.getLocText("FR-Designer-Form-ToolBar_Chart")); chartTypeWindow.setLocation((int)jSeparatorLayout.getLocationOnScreen().getX() + 1, (int)jSeparatorLayout.getLocationOnScreen().getY());