xiaxiang 9 years ago
parent
commit
a05e90c642
  1. 6
      designer/src/com/fr/poly/PolyComponetsBar.java
  2. BIN
      designer_base/src/com/fr/design/images/form/toolbar/ChartF-TreeMap.png
  3. BIN
      designer_base/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png
  4. 2
      designer_chart/src/com/fr/design/module/ChartDesignerModule.java
  5. 8
      designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

6
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 static Color FOLDER_PANE_BACKGROUND = new Color(214, 223, 247);
private BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); private BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames();
private SerIcon[] serIcons; private SerIcon[] serIcons;
private static final int MAX_BAR_NUM = 15;
public PolyComponetsBar() { public PolyComponetsBar() {
setOrientation(SwingConstants.VERTICAL); setOrientation(SwingConstants.VERTICAL);
@ -35,10 +36,11 @@ public class PolyComponetsBar extends JToolBar {
setFloatable(false); setFloatable(false);
setBackground(UIConstants.NORMAL_BACKGROUND); setBackground(UIConstants.NORMAL_BACKGROUND);
setLayout(FRGUIPaneFactory.create1ColumnGridLayout()); 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"); serIcons[0] = new SerIcon(PolyECBlock.class, Inter.getLocText("Poly-Report_Block"), "Poly-Report_Block");
this.add(serIcons[0]); 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()); BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID());
serIcons[i + 1] = new SerIcon(rowChart[0], Inter.getLocText(typeName[i].getName()), typeName[i].getName()); serIcons[i + 1] = new SerIcon(rowChart[0], Inter.getLocText(typeName[i].getName()), typeName[i].getName());
this.add(serIcons[i + 1]); this.add(serIcons[i + 1]);

BIN
designer_base/src/com/fr/design/images/form/toolbar/ChartF-TreeMap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

BIN
designer_base/src/com/fr/design/images/poly/toolbar/Plugin-ChartF_NewTreeMap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

2
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"); } } 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"); } }

8
designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

@ -46,7 +46,7 @@ public class FormParaWidgetPane extends JPanel{
//预定义控件最多显示20行 //预定义控件最多显示20行
private int preWidgetShowMaxRow = 20; private int preWidgetShowMaxRow = 20;
//显示8个图表组件 //显示8个图表组件
private int commonChartNum = 8; private static final int commonChartNum = 8;
//显示10个普通控件 //显示10个普通控件
private int commonWidgetNum = 10; private int commonWidgetNum = 10;
private JSeparator jSeparatorPara; private JSeparator jSeparatorPara;
@ -118,7 +118,6 @@ public class FormParaWidgetPane extends JPanel{
// 初始化的时候根据图表的总个数获得单行显示图表的个数 // 初始化的时候根据图表的总个数获得单行显示图表的个数
int totalChartNums = loadChartOptions().length; int totalChartNums = loadChartOptions().length;
if (totalChartNums > 0) { if (totalChartNums > 0) {
commonChartNum = ++totalChartNums/2;
JPanel chartTypePane = new JPanel(new FlowLayout()); JPanel chartTypePane = new JPanel(new FlowLayout());
for (int i = 0;i < commonChartNum ;i++) { for (int i = 0;i < commonChartNum ;i++) {
chartTypePane.add( new ToolBarButton(loadChartOptions()[i])); chartTypePane.add( new ToolBarButton(loadChartOptions()[i]));
@ -209,11 +208,12 @@ public class FormParaWidgetPane extends JPanel{
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(chartTypeWindow == null) { if(chartTypeWindow == null) {
JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel componentsPara = new JPanel(new FlowLayout(FlowLayout.LEFT));
for (WidgetOption chartOption : loadChartOptions()) { WidgetOption[] chartOptions = loadChartOptions();
for (WidgetOption chartOption : chartOptions) {
componentsPara.add( new ToolBarButton(chartOption)); componentsPara.add( new ToolBarButton(chartOption));
} }
int x = commonChartNum * (widgetButtonWidth + smallGAP); 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)); componentsPara.setPreferredSize(new Dimension(x,y));
chartTypeWindow = new PopUpWindow(componentsPara, Inter.getLocText("FR-Designer-Form-ToolBar_Chart")); chartTypeWindow = new PopUpWindow(componentsPara, Inter.getLocText("FR-Designer-Form-ToolBar_Chart"));
chartTypeWindow.setLocation((int)jSeparatorLayout.getLocationOnScreen().getX() + 1, (int)jSeparatorLayout.getLocationOnScreen().getY()); chartTypeWindow.setLocation((int)jSeparatorLayout.getLocationOnScreen().getX() + 1, (int)jSeparatorLayout.getLocationOnScreen().getY());

Loading…
Cancel
Save