diff --git a/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java b/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java index fd24573fe..2624318ae 100644 --- a/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java +++ b/designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java @@ -10,9 +10,10 @@ import javax.swing.event.ChangeListener; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.PluginManagerPane; -import com.fr.design.extra.PluginShopDialog; +import com.fr.design.extra.ShopManagerPane; +import com.fr.design.extra.ShopDialog; import com.fr.design.extra.PluginWebBridge; +import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; @@ -29,583 +30,572 @@ import com.fr.stable.bridge.StableFactory; */ public class RepeatAndFreezeSettingPane extends BasicPane { - //边框高度 - private static final int LABEL_HEIGHT = 45; - - // 重复标题行 - private RepeatRowPane repeatTitleRowPane; - // 重复标题列 - private RepeatColPane repeatTitleColPane; - // 重复结尾行 - private RepeatRowPane repeatFinisRowPane; - // 重复结尾列 - private RepeatColPane repeatFinisColPane; - // 分页冻结行 - private FreezePagePane freezePageRowPane; - // 分页冻结列 - private FreezePagePane freezePageColPane; - // 填报冻结行 - private FreezeWriteRowPane freezeWriteRowPane; - // 填报冻结列 - private FreezeWriteColPane freezeWriteColPane; - // 重复标题 - private UICheckBox useRepeatTitleRCheckBox; - private UICheckBox useRepeatTitleCCheckBox; - // 重复结尾 - private UICheckBox useRepeatFinisRCheckBox; - private UICheckBox useRepeatFinisCCheckBox; - - // 分页冻结 - private UICheckBox usePageFrozenCCheckBox; - private UICheckBox usePageFrozenRCheckBox; - // 填报冻结 - private UICheckBox useWriteFrozenCCheckBox; - private UICheckBox useWriteFrozenRCheckBox; - - /** - * 重复标题行 - */ - private JPanel initRowStartPane(){ - JPanel soverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - useRepeatTitleRCheckBox = new UICheckBox(); - soverlapRowStartPane.add(useRepeatTitleRCheckBox); - soverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Row", "From"}))); - repeatTitleRowPane = new RepeatRowPane(); - soverlapRowStartPane.add(repeatTitleRowPane); - - return soverlapRowStartPane; - } - - /** - * 重复标题列 - */ - private JPanel initColStartPane(){ - // 重复打印标题的起始列 - JPanel soverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - useRepeatTitleCCheckBox = new UICheckBox(); - soverlapColStartPane.add(useRepeatTitleCCheckBox); - soverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Column", "From"}))); - // 重复打印标题的结束列 - repeatTitleColPane = new RepeatColPane(); - soverlapColStartPane.add(repeatTitleColPane); - - return soverlapColStartPane; - } - - /** - * 重复结尾行 - */ - private JPanel initFootRowStarPane(){ - // 重复打印结尾的起始行 - JPanel foverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - useRepeatFinisRCheckBox = new UICheckBox(); - foverlapRowStartPane.add(useRepeatFinisRCheckBox); - foverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Row", "From"}))); - repeatFinisRowPane = new RepeatRowPane(); - foverlapRowStartPane.add(repeatFinisRowPane); - - return foverlapRowStartPane; - } - - /** - * 重复结尾列 - */ - private JPanel initFootColStartPane(){ - // 重复打印结尾的起始列 - JPanel foverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - useRepeatFinisCCheckBox = new UICheckBox(); - foverlapColStartPane.add(useRepeatFinisCCheckBox); - foverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Column", "From"}))); - repeatFinisColPane = new RepeatColPane(); - foverlapColStartPane.add(repeatFinisColPane); - - return foverlapColStartPane; - } - - /** - * 获取分页冻结的标题(表单中不需要写分页二字) - * - * @return 分页冻结的标题 - * - * - * @date 2014-11-14-下午1:32:08 - * - */ - protected String getPageFrozenTitle(){ - return Inter.getLocText("FR-Engine_Page-Frozen"); - } - - /** - * 分页冻结Pane - */ - private JPanel initPageFrozenPane(){ - JPanel pagePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - // 分页冻结 - UILabel pageLabel = new UILabel(getPageFrozenTitle()); - JPanel pageLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - pageLabelPanel.add(pageLabel); - pagePanel.add(pageLabelPanel, BorderLayout.NORTH); - JPanel pagecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - pagecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - pagePanel.add(pagecon, BorderLayout.CENTER); - UILabel warningx = new UILabel("(" + Inter.getLocText("FR-Engine_Please_Set_Repeat_First") + ")"); - warningx.setForeground(Color.red); - pageLabelPanel.add(warningx); - - JPanel pageRowGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - pageRowGridPane.add(this.usePageFrozenRCheckBox = new UICheckBox()); - pagecon.add(pageRowGridPane); - // 显示行冻结信息的panel - freezePageRowPane = new FreezePagePane(true); - pageRowGridPane.add(freezePageRowPane); - addPageFrozenCol(pagecon); - - return pagePanel; - } - - /** - * 分页冻结列 - */ - private void addPageFrozenCol(JPanel pagecon){ - // 显示列冻结信息的panel - freezePageColPane = new FreezePagePane(false); - JPanel pageColGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - pageColGridPane.add(this.usePageFrozenCCheckBox = new UICheckBox()); - pagecon.add(pageColGridPane); - pageColGridPane.add(freezePageColPane); - } - - /** - * 填报冻结Pane - */ - private JPanel initWriteFrozenPane(){ - JPanel writePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - // 填报冻结 - UILabel writeLabel = new UILabel(Inter.getLocText(new String[]{"Face_Write", "Frozen"}) + ":"); - JPanel writeLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - writeLabelPanel.add(writeLabel); - writePanel.add(writeLabelPanel, BorderLayout.NORTH); - JPanel writecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - writecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - writePanel.add(writecon, BorderLayout.CENTER); - - // 行冻结 - JPanel writeRowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - writeRowPane.add(this.useWriteFrozenRCheckBox = new UICheckBox()); - // 列冻结 - JPanel writeColPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - writeColPane.add(this.useWriteFrozenCCheckBox = new UICheckBox()); - writecon.add(writeRowPane); - freezeWriteRowPane = new FreezeWriteRowPane(); - writeRowPane.add(freezeWriteRowPane); - writecon.add(writeColPane); - freezeWriteColPane = new FreezeWriteColPane(); - writeColPane.add(freezeWriteColPane); - - return writePanel; - } - - public RepeatAndFreezeSettingPane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel outrepeatPanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Repeat")); - JPanel cenrepeatPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - outrepeatPanel.add(cenrepeatPanel); - JPanel outfreezePanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Frozen")); - this.add(outrepeatPanel, BorderLayout.NORTH); - this.add(outfreezePanel, BorderLayout.CENTER); - JPanel repeatPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); - repeatPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); - JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - //自适应插件 - JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Attention")); - - BoxCenterAligmentPane actionLabel = getURLActionLabel(Inter.getLocText("FR-Designer_Form-Fit-Tip")); - infoPane.add(actionLabel, BorderLayout.SOUTH); - - outfreezePanel.add(freezePanel); - this.add(infoPane, BorderLayout.SOUTH); - // 重复打印部分 - // 重复打印标题的起始行 - JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - labelPanel.add(new UILabel(Inter.getLocText("FR-Engine_Select_the_repeated_row_and_column") + ":")); - UILabel warning = new UILabel("(" + Inter.getLocText("FR-Engine_FreezeWarning1") + ")"); - warning.setForeground(Color.red); - labelPanel.add(warning); - cenrepeatPanel.add(labelPanel, BorderLayout.NORTH); - cenrepeatPanel.add(repeatPanel, BorderLayout.CENTER); - - repeatPanel.add(initRowStartPane()); - addColStart(repeatPanel); - repeatPanel.add(initFootRowStarPane()); - addFootColStart(repeatPanel); - - freezePanel.add(initPageFrozenPane(), BorderLayout.NORTH); - addWriteFrozen(freezePanel); - - initPageRwoListener(); - initPageColListener(); - initWriteListener(); - } - - protected void initWriteListener(){ - // 填报重复冻结行 - useWriteFrozenCCheckBox.addChangeListener(useWriteFrozenCListener); - // 填报重复冻结列 - useWriteFrozenRCheckBox.addChangeListener(useWriteFrozenRListener); - } - - private void initPageRwoListener(){ - repeatTitleRowPane.addListener(freezePageRowListener); - // 分页重复冻结行 - usePageFrozenRCheckBox.addChangeListener(usePageFrozenRListener); - //重复标题行 - useRepeatTitleRCheckBox.addChangeListener(useRepeatTitleRListener); - //重复结尾行 - useRepeatFinisRCheckBox.addChangeListener(useRepeatFinisRListener); - } - - protected void initPageColListener(){ - repeatTitleColPane.addListener(freezePageColListener); - // 分页重复冻结列 - usePageFrozenCCheckBox.addChangeListener(usePageFrozenCListener); - //重复标题列 - useRepeatTitleCCheckBox.addChangeListener(useRepeatTitleCListener); - //重复结尾列 - useRepeatFinisCCheckBox.addChangeListener(useRepeatFinisCListener); - } - - protected void addWriteFrozen(JPanel freezePanel) { - freezePanel.add(initWriteFrozenPane(), BorderLayout.CENTER); - } - - protected void addFootColStart(JPanel repeatPanel){ - repeatPanel.add(initFootColStartPane()); - } - - protected void addColStart(JPanel repeatPanel){ - repeatPanel.add(initColStartPane()); - } - - ChangeListener useRepeatFinisCListener = new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - repeatFinisColPane.setEnabled(useRepeatFinisCCheckBox.isSelected()); - - } - }; - - ChangeListener useRepeatFinisRListener = new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - repeatFinisRowPane.setEnabled(useRepeatFinisRCheckBox.isSelected()); - - } - }; - - ChangeListener useRepeatTitleCListener = new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - boolean flag = useRepeatTitleCCheckBox.isSelected(); - repeatTitleColPane.setEnabled(flag); - if (!flag) { - usePageFrozenCCheckBox.setSelected(false); - usePageFrozenCCheckBox.setEnabled(false); - } else { - usePageFrozenCCheckBox.setEnabled(true); - } - } - }; - - ChangeListener useRepeatTitleRListener = new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - boolean flag = useRepeatTitleRCheckBox.isSelected(); - repeatTitleRowPane.setEnabled(flag); - if (!flag) { - usePageFrozenRCheckBox.setSelected(false); - usePageFrozenRCheckBox.setEnabled(false); - } else { - usePageFrozenRCheckBox.setEnabled(true); - } - } - }; - - ChangeListener useWriteFrozenRListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - boolean flag = useWriteFrozenRCheckBox.isSelected(); - freezeWriteRowPane.setEnabled(flag); - - } - }; - - ChangeListener useWriteFrozenCListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - boolean flag = useWriteFrozenCCheckBox.isSelected(); - freezeWriteColPane.setEnabled(flag); - - } - }; - - ChangeListener usePageFrozenCListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - freezePageColPane.setEnabled(usePageFrozenCCheckBox.isSelected()); - } - }; - - ChangeListener usePageFrozenRListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - freezePageRowPane.setEnabled(usePageFrozenRCheckBox.isSelected()); - } - }; - - // 分页重复冻结行数据联动 - ChangeListener freezePageRowListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - FT ft = repeatTitleRowPane.updateBean(); - int to = ft.getTo(); - freezePageRowPane.populateBean(new FT(to > -1 ? 0 : -1, to)); - } - }; - - // 分页重复冻结列数据联动 - ChangeListener freezePageColListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - FT ft = repeatTitleColPane.updateBean(); - int to = ft.getTo(); - freezePageColPane.populateBean(new FT(to > -1 ? 0 : -1, to)); - } - }; - - /** - * 窗口标题 - * - * - * @date 2014-11-14-下午2:30:58 - * - */ - protected String title4PopupWindow() { - return Inter.getLocText("FR-Engine_Repeat-Freeze"); - } - - public void populate(ReportPageAttrProvider attribute) { - - if (attribute == null) { - attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG); - } - FT defaultFT = new FT(0, 0); - populatColPane(attribute, defaultFT); - populateRowPane(attribute, defaultFT); - } - - protected void populateRowPane(ReportPageAttrProvider attribute, FT defaultFT){ - FT ft = new FT(new Integer(attribute.getRepeatHeaderRowFrom()), new Integer(attribute.getRepeatHeaderRowTo())); - if (isDefalut(ft)) { - this.repeatTitleRowPane.populateBean(defaultFT); - this.repeatTitleRowPane.setEnabled(false); - usePageFrozenRCheckBox.setEnabled(false); - } else { - this.repeatTitleRowPane.populateBean(ft); - useRepeatTitleRCheckBox.setSelected(true); - } - - ft = new FT(new Integer(attribute.getRepeatFooterRowFrom()), new Integer(attribute.getRepeatFooterRowTo())); - if (isDefalut(ft)) { - this.repeatFinisRowPane.populateBean(defaultFT); - this.repeatFinisRowPane.setEnabled(false); - useRepeatFinisRCheckBox.setSelected(false); - } else { - this.repeatFinisRowPane.populateBean(ft); - useRepeatFinisRCheckBox.setSelected(true); - } - - this.usePageFrozenRCheckBox.setSelected(attribute.isUsePageFrozenRow()); - this.freezePageRowPane.setEnabled(attribute.isUsePageFrozenRow()); - } - - protected void populatColPane(ReportPageAttrProvider attribute, FT defaultFT){ - FT ft = new FT(new Integer(attribute.getRepeatHeaderColumnFrom()), new Integer(attribute.getRepeatHeaderColumnTo())); - if (isDefalut(ft)) { - this.repeatTitleColPane.populateBean(defaultFT); - this.repeatTitleColPane.setEnabled(false); - usePageFrozenCCheckBox.setEnabled(false); - } else { - this.repeatTitleColPane.populateBean(ft); - useRepeatTitleCCheckBox.setSelected(true); - } - - ft = new FT(new Integer(attribute.getRepeatFooterColumnFrom()), new Integer(attribute.getRepeatFooterColumnTo())); - if (isDefalut(ft)) { - this.repeatFinisColPane.populateBean(defaultFT); - this.repeatFinisColPane.setEnabled(false); - useRepeatFinisCCheckBox.setSelected(false); - } else { - this.repeatFinisColPane.populateBean(ft); - useRepeatFinisCCheckBox.setSelected(true); - } - - this.usePageFrozenCCheckBox.setSelected(attribute.isUsePageFrozenColumn()); - this.freezePageColPane.setEnabled(attribute.isUsePageFrozenColumn()); - } - - private boolean isDefalut(FT ob) { - return ob.getFrom() == -1 && ob.getTo() == -1; - } + //边框高度 + private static final int LABEL_HEIGHT = 45; + + // 重复标题行 + private RepeatRowPane repeatTitleRowPane; + // 重复标题列 + private RepeatColPane repeatTitleColPane; + // 重复结尾行 + private RepeatRowPane repeatFinisRowPane; + // 重复结尾列 + private RepeatColPane repeatFinisColPane; + // 分页冻结行 + private FreezePagePane freezePageRowPane; + // 分页冻结列 + private FreezePagePane freezePageColPane; + // 填报冻结行 + private FreezeWriteRowPane freezeWriteRowPane; + // 填报冻结列 + private FreezeWriteColPane freezeWriteColPane; + // 重复标题 + private UICheckBox useRepeatTitleRCheckBox; + private UICheckBox useRepeatTitleCCheckBox; + // 重复结尾 + private UICheckBox useRepeatFinisRCheckBox; + private UICheckBox useRepeatFinisCCheckBox; + + // 分页冻结 + private UICheckBox usePageFrozenCCheckBox; + private UICheckBox usePageFrozenRCheckBox; + // 填报冻结 + private UICheckBox useWriteFrozenCCheckBox; + private UICheckBox useWriteFrozenRCheckBox; /** - * 初始化填报冻结pane - * - * @param writeFrozenColumnRow 填报冻结格子 - * - * - * @date 2014-11-14-下午2:30:15 - * - */ - public void populateWriteFrozenColumnRow(ColumnRow writeFrozenColumnRow) { - if (writeFrozenColumnRow != null) { - int col = writeFrozenColumnRow.getColumn(); - int row = writeFrozenColumnRow.getRow(); - if (col > 0) { - freezeWriteColPane.populateBean(new FT(1, col - 1)); - } - if (row > 0) { - freezeWriteRowPane.populateBean(new FT(1, row - 1)); - } - - useWriteFrozenCCheckBox.setSelected(col > 0); - useWriteFrozenRCheckBox.setSelected(row > 0); - freezeWriteColPane.setEnabled(col > 0); - freezeWriteRowPane.setEnabled(row > 0); - } else { - useWriteFrozenCCheckBox.setSelected(false); - useWriteFrozenRCheckBox.setSelected(false); - freezeWriteRowPane.setEnabled(false); - freezeWriteColPane.setEnabled(false); - } - } - - public ReportPageAttrProvider update() { - ReportPageAttrProvider attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG); - - updateRowPane(attribute); - updateColPane(attribute); - - return attribute; - } - - protected void updateRowPane(ReportPageAttrProvider attribute){ - // 重复标题行 - int titleFrom = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getFrom()); - int titleTo = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getTo()); - attribute.setRepeatHeaderRowFrom(titleFrom); - attribute.setRepeatHeaderRowTo(titleTo); - - int finishFrom = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getFrom()); - int finishTo = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getTo()); - attribute.setRepeatFooterRowFrom(finishFrom); - attribute.setRepeatFooterRowTo(finishTo); - - attribute.setUsePageFrozenRow(this.usePageFrozenRCheckBox.isSelected()); - } - - private int valid(UICheckBox checkBox, int num){ - return checkBox.isSelected() ? num : -1; - } - - protected void updateColPane(ReportPageAttrProvider attribute){ - int titleFrom = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getFrom()); - int titleTo = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getTo()); - attribute.setRepeatHeaderColumnFrom(titleFrom); - attribute.setRepeatHeaderColumnTo(titleTo); - - int finishFrom = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getFrom()); - int finishTo = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getTo()); - attribute.setRepeatFooterColumnFrom(finishFrom); - attribute.setRepeatFooterColumnTo(finishTo); - - attribute.setUsePageFrozenColumn(this.usePageFrozenCCheckBox.isSelected()); - } - + * 重复标题行 + */ + private JPanel initRowStartPane() { + JPanel soverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + useRepeatTitleRCheckBox = new UICheckBox(); + soverlapRowStartPane.add(useRepeatTitleRCheckBox); + soverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Row", "From"}))); + repeatTitleRowPane = new RepeatRowPane(); + soverlapRowStartPane.add(repeatTitleRowPane); + + return soverlapRowStartPane; + } + + /** + * 重复标题列 + */ + private JPanel initColStartPane() { + // 重复打印标题的起始列 + JPanel soverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + useRepeatTitleCCheckBox = new UICheckBox(); + soverlapColStartPane.add(useRepeatTitleCCheckBox); + soverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Title_Start_Column", "From"}))); + // 重复打印标题的结束列 + repeatTitleColPane = new RepeatColPane(); + soverlapColStartPane.add(repeatTitleColPane); + + return soverlapColStartPane; + } + + /** + * 重复结尾行 + */ + private JPanel initFootRowStarPane() { + // 重复打印结尾的起始行 + JPanel foverlapRowStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + useRepeatFinisRCheckBox = new UICheckBox(); + foverlapRowStartPane.add(useRepeatFinisRCheckBox); + foverlapRowStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Row", "From"}))); + repeatFinisRowPane = new RepeatRowPane(); + foverlapRowStartPane.add(repeatFinisRowPane); + + return foverlapRowStartPane; + } + /** - * 更新WriteFrozenColumnRow - * - * @return 行列 - * - * - * @date 2014-11-14-下午2:29:45 - * - */ - public ColumnRow updateWriteFrozenColumnRow() { - if (useWriteFrozenCCheckBox.isSelected() || useWriteFrozenRCheckBox.isSelected()) { - int col = useWriteFrozenCCheckBox.isSelected() ? freezeWriteColPane.updateBean().getTo() + 1 : 0; - int row = useWriteFrozenRCheckBox.isSelected() ? freezeWriteRowPane.updateBean().getTo() + 1 : 0; + * 重复结尾列 + */ + private JPanel initFootColStartPane() { + // 重复打印结尾的起始列 + JPanel foverlapColStartPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + useRepeatFinisCCheckBox = new UICheckBox(); + foverlapColStartPane.add(useRepeatFinisCCheckBox); + foverlapColStartPane.add(new UILabel(Inter.getLocText(new String[]{"PageSetup-Finis_Start_Column", "From"}))); + repeatFinisColPane = new RepeatColPane(); + foverlapColStartPane.add(repeatFinisColPane); + + return foverlapColStartPane; + } + + /** + * 获取分页冻结的标题(表单中不需要写分页二字) + * + * @return 分页冻结的标题 + * @date 2014-11-14-下午1:32:08 + */ + protected String getPageFrozenTitle() { + return Inter.getLocText("FR-Engine_Page-Frozen"); + } + + /** + * 分页冻结Pane + */ + private JPanel initPageFrozenPane() { + JPanel pagePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + // 分页冻结 + UILabel pageLabel = new UILabel(getPageFrozenTitle()); + JPanel pageLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + pageLabelPanel.add(pageLabel); + pagePanel.add(pageLabelPanel, BorderLayout.NORTH); + JPanel pagecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + pagecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + pagePanel.add(pagecon, BorderLayout.CENTER); + UILabel warningx = new UILabel("(" + Inter.getLocText("FR-Engine_Please_Set_Repeat_First") + ")"); + warningx.setForeground(Color.red); + pageLabelPanel.add(warningx); + + JPanel pageRowGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + pageRowGridPane.add(this.usePageFrozenRCheckBox = new UICheckBox()); + pagecon.add(pageRowGridPane); + // 显示行冻结信息的panel + freezePageRowPane = new FreezePagePane(true); + pageRowGridPane.add(freezePageRowPane); + addPageFrozenCol(pagecon); + + return pagePanel; + } + + /** + * 分页冻结列 + */ + private void addPageFrozenCol(JPanel pagecon) { + // 显示列冻结信息的panel + freezePageColPane = new FreezePagePane(false); + JPanel pageColGridPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + pageColGridPane.add(this.usePageFrozenCCheckBox = new UICheckBox()); + pagecon.add(pageColGridPane); + pageColGridPane.add(freezePageColPane); + } + + /** + * 填报冻结Pane + */ + private JPanel initWriteFrozenPane() { + JPanel writePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + // 填报冻结 + UILabel writeLabel = new UILabel(Inter.getLocText(new String[]{"Face_Write", "Frozen"}) + ":"); + JPanel writeLabelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + writeLabelPanel.add(writeLabel); + writePanel.add(writeLabelPanel, BorderLayout.NORTH); + JPanel writecon = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + writecon.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + writePanel.add(writecon, BorderLayout.CENTER); + + // 行冻结 + JPanel writeRowPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + writeRowPane.add(this.useWriteFrozenRCheckBox = new UICheckBox()); + // 列冻结 + JPanel writeColPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + writeColPane.add(this.useWriteFrozenCCheckBox = new UICheckBox()); + writecon.add(writeRowPane); + freezeWriteRowPane = new FreezeWriteRowPane(); + writeRowPane.add(freezeWriteRowPane); + writecon.add(writeColPane); + freezeWriteColPane = new FreezeWriteColPane(); + writeColPane.add(freezeWriteColPane); + + return writePanel; + } + + public RepeatAndFreezeSettingPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel outrepeatPanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Repeat")); + JPanel cenrepeatPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + outrepeatPanel.add(cenrepeatPanel); + JPanel outfreezePanel = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Engine_Frozen")); + this.add(outrepeatPanel, BorderLayout.NORTH); + this.add(outfreezePanel, BorderLayout.CENTER); + JPanel repeatPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); + repeatPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); + JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + + //自适应插件 + JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Attention")); + + BoxCenterAligmentPane actionLabel = getURLActionLabel(Inter.getLocText("FR-Designer_Form-Fit-Tip")); + infoPane.add(actionLabel, BorderLayout.SOUTH); + + outfreezePanel.add(freezePanel); + this.add(infoPane, BorderLayout.SOUTH); + // 重复打印部分 + // 重复打印标题的起始行 + JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + labelPanel.add(new UILabel(Inter.getLocText("FR-Engine_Select_the_repeated_row_and_column") + ":")); + UILabel warning = new UILabel("(" + Inter.getLocText("FR-Engine_FreezeWarning1") + ")"); + warning.setForeground(Color.red); + labelPanel.add(warning); + cenrepeatPanel.add(labelPanel, BorderLayout.NORTH); + cenrepeatPanel.add(repeatPanel, BorderLayout.CENTER); + + repeatPanel.add(initRowStartPane()); + addColStart(repeatPanel); + repeatPanel.add(initFootRowStarPane()); + addFootColStart(repeatPanel); + + freezePanel.add(initPageFrozenPane(), BorderLayout.NORTH); + addWriteFrozen(freezePanel); + + initPageRwoListener(); + initPageColListener(); + initWriteListener(); + } + + protected void initWriteListener() { + // 填报重复冻结行 + useWriteFrozenCCheckBox.addChangeListener(useWriteFrozenCListener); + // 填报重复冻结列 + useWriteFrozenRCheckBox.addChangeListener(useWriteFrozenRListener); + } + + private void initPageRwoListener() { + repeatTitleRowPane.addListener(freezePageRowListener); + // 分页重复冻结行 + usePageFrozenRCheckBox.addChangeListener(usePageFrozenRListener); + //重复标题行 + useRepeatTitleRCheckBox.addChangeListener(useRepeatTitleRListener); + //重复结尾行 + useRepeatFinisRCheckBox.addChangeListener(useRepeatFinisRListener); + } + + protected void initPageColListener() { + repeatTitleColPane.addListener(freezePageColListener); + // 分页重复冻结列 + usePageFrozenCCheckBox.addChangeListener(usePageFrozenCListener); + //重复标题列 + useRepeatTitleCCheckBox.addChangeListener(useRepeatTitleCListener); + //重复结尾列 + useRepeatFinisCCheckBox.addChangeListener(useRepeatFinisCListener); + } + + protected void addWriteFrozen(JPanel freezePanel) { + freezePanel.add(initWriteFrozenPane(), BorderLayout.CENTER); + } + + protected void addFootColStart(JPanel repeatPanel) { + repeatPanel.add(initFootColStartPane()); + } + + protected void addColStart(JPanel repeatPanel) { + repeatPanel.add(initColStartPane()); + } + + ChangeListener useRepeatFinisCListener = new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + repeatFinisColPane.setEnabled(useRepeatFinisCCheckBox.isSelected()); + + } + }; + + ChangeListener useRepeatFinisRListener = new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + repeatFinisRowPane.setEnabled(useRepeatFinisRCheckBox.isSelected()); + + } + }; + + ChangeListener useRepeatTitleCListener = new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + boolean flag = useRepeatTitleCCheckBox.isSelected(); + repeatTitleColPane.setEnabled(flag); + if (!flag) { + usePageFrozenCCheckBox.setSelected(false); + usePageFrozenCCheckBox.setEnabled(false); + } else { + usePageFrozenCCheckBox.setEnabled(true); + } + } + }; + + ChangeListener useRepeatTitleRListener = new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + boolean flag = useRepeatTitleRCheckBox.isSelected(); + repeatTitleRowPane.setEnabled(flag); + if (!flag) { + usePageFrozenRCheckBox.setSelected(false); + usePageFrozenRCheckBox.setEnabled(false); + } else { + usePageFrozenRCheckBox.setEnabled(true); + } + } + }; + + ChangeListener useWriteFrozenRListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean flag = useWriteFrozenRCheckBox.isSelected(); + freezeWriteRowPane.setEnabled(flag); + + } + }; + + ChangeListener useWriteFrozenCListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + boolean flag = useWriteFrozenCCheckBox.isSelected(); + freezeWriteColPane.setEnabled(flag); + + } + }; + + ChangeListener usePageFrozenCListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + freezePageColPane.setEnabled(usePageFrozenCCheckBox.isSelected()); + } + }; + + ChangeListener usePageFrozenRListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + freezePageRowPane.setEnabled(usePageFrozenRCheckBox.isSelected()); + } + }; + + // 分页重复冻结行数据联动 + ChangeListener freezePageRowListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + FT ft = repeatTitleRowPane.updateBean(); + int to = ft.getTo(); + freezePageRowPane.populateBean(new FT(to > -1 ? 0 : -1, to)); + } + }; + + // 分页重复冻结列数据联动 + ChangeListener freezePageColListener = new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + FT ft = repeatTitleColPane.updateBean(); + int to = ft.getTo(); + freezePageColPane.populateBean(new FT(to > -1 ? 0 : -1, to)); + } + }; + + /** + * 窗口标题 + * + * @date 2014-11-14-下午2:30:58 + */ + protected String title4PopupWindow() { + return Inter.getLocText("FR-Engine_Repeat-Freeze"); + } + + public void populate(ReportPageAttrProvider attribute) { + + if (attribute == null) { + attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG); + } + FT defaultFT = new FT(0, 0); + populatColPane(attribute, defaultFT); + populateRowPane(attribute, defaultFT); + } + + protected void populateRowPane(ReportPageAttrProvider attribute, FT defaultFT) { + FT ft = new FT(new Integer(attribute.getRepeatHeaderRowFrom()), new Integer(attribute.getRepeatHeaderRowTo())); + if (isDefalut(ft)) { + this.repeatTitleRowPane.populateBean(defaultFT); + this.repeatTitleRowPane.setEnabled(false); + usePageFrozenRCheckBox.setEnabled(false); + } else { + this.repeatTitleRowPane.populateBean(ft); + useRepeatTitleRCheckBox.setSelected(true); + } + + ft = new FT(new Integer(attribute.getRepeatFooterRowFrom()), new Integer(attribute.getRepeatFooterRowTo())); + if (isDefalut(ft)) { + this.repeatFinisRowPane.populateBean(defaultFT); + this.repeatFinisRowPane.setEnabled(false); + useRepeatFinisRCheckBox.setSelected(false); + } else { + this.repeatFinisRowPane.populateBean(ft); + useRepeatFinisRCheckBox.setSelected(true); + } + + this.usePageFrozenRCheckBox.setSelected(attribute.isUsePageFrozenRow()); + this.freezePageRowPane.setEnabled(attribute.isUsePageFrozenRow()); + } + + protected void populatColPane(ReportPageAttrProvider attribute, FT defaultFT) { + FT ft = new FT(new Integer(attribute.getRepeatHeaderColumnFrom()), new Integer(attribute.getRepeatHeaderColumnTo())); + if (isDefalut(ft)) { + this.repeatTitleColPane.populateBean(defaultFT); + this.repeatTitleColPane.setEnabled(false); + usePageFrozenCCheckBox.setEnabled(false); + } else { + this.repeatTitleColPane.populateBean(ft); + useRepeatTitleCCheckBox.setSelected(true); + } + + ft = new FT(new Integer(attribute.getRepeatFooterColumnFrom()), new Integer(attribute.getRepeatFooterColumnTo())); + if (isDefalut(ft)) { + this.repeatFinisColPane.populateBean(defaultFT); + this.repeatFinisColPane.setEnabled(false); + useRepeatFinisCCheckBox.setSelected(false); + } else { + this.repeatFinisColPane.populateBean(ft); + useRepeatFinisCCheckBox.setSelected(true); + } + + this.usePageFrozenCCheckBox.setSelected(attribute.isUsePageFrozenColumn()); + this.freezePageColPane.setEnabled(attribute.isUsePageFrozenColumn()); + } + + private boolean isDefalut(FT ob) { + return ob.getFrom() == -1 && ob.getTo() == -1; + } + + /** + * 初始化填报冻结pane + * + * @param writeFrozenColumnRow 填报冻结格子 + * @date 2014-11-14-下午2:30:15 + */ + public void populateWriteFrozenColumnRow(ColumnRow writeFrozenColumnRow) { + if (writeFrozenColumnRow != null) { + int col = writeFrozenColumnRow.getColumn(); + int row = writeFrozenColumnRow.getRow(); + if (col > 0) { + freezeWriteColPane.populateBean(new FT(1, col - 1)); + } + if (row > 0) { + freezeWriteRowPane.populateBean(new FT(1, row - 1)); + } + + useWriteFrozenCCheckBox.setSelected(col > 0); + useWriteFrozenRCheckBox.setSelected(row > 0); + freezeWriteColPane.setEnabled(col > 0); + freezeWriteRowPane.setEnabled(row > 0); + } else { + useWriteFrozenCCheckBox.setSelected(false); + useWriteFrozenRCheckBox.setSelected(false); + freezeWriteRowPane.setEnabled(false); + freezeWriteColPane.setEnabled(false); + } + } + + public ReportPageAttrProvider update() { + ReportPageAttrProvider attribute = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG); + + updateRowPane(attribute); + updateColPane(attribute); + + return attribute; + } + + protected void updateRowPane(ReportPageAttrProvider attribute) { + // 重复标题行 + int titleFrom = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getFrom()); + int titleTo = valid(useRepeatTitleRCheckBox, this.repeatTitleRowPane.updateBean().getTo()); + attribute.setRepeatHeaderRowFrom(titleFrom); + attribute.setRepeatHeaderRowTo(titleTo); + + int finishFrom = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getFrom()); + int finishTo = valid(useRepeatFinisRCheckBox, this.repeatFinisRowPane.updateBean().getTo()); + attribute.setRepeatFooterRowFrom(finishFrom); + attribute.setRepeatFooterRowTo(finishTo); + + attribute.setUsePageFrozenRow(this.usePageFrozenRCheckBox.isSelected()); + } + + private int valid(UICheckBox checkBox, int num) { + return checkBox.isSelected() ? num : -1; + } + + protected void updateColPane(ReportPageAttrProvider attribute) { + int titleFrom = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getFrom()); + int titleTo = valid(useRepeatTitleCCheckBox, this.repeatTitleColPane.updateBean().getTo()); + attribute.setRepeatHeaderColumnFrom(titleFrom); + attribute.setRepeatHeaderColumnTo(titleTo); + + int finishFrom = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getFrom()); + int finishTo = valid(useRepeatFinisCCheckBox, this.repeatFinisColPane.updateBean().getTo()); + attribute.setRepeatFooterColumnFrom(finishFrom); + attribute.setRepeatFooterColumnTo(finishTo); + + attribute.setUsePageFrozenColumn(this.usePageFrozenCCheckBox.isSelected()); + } + + /** + * 更新WriteFrozenColumnRow + * + * @return 行列 + * @date 2014-11-14-下午2:29:45 + */ + public ColumnRow updateWriteFrozenColumnRow() { + if (useWriteFrozenCCheckBox.isSelected() || useWriteFrozenRCheckBox.isSelected()) { + int col = useWriteFrozenCCheckBox.isSelected() ? freezeWriteColPane.updateBean().getTo() + 1 : 0; + int row = useWriteFrozenRCheckBox.isSelected() ? freezeWriteRowPane.updateBean().getTo() + 1 : 0; return ColumnRow.valueOf(col, row); } - return null; - } - - private BoxCenterAligmentPane getURLActionLabel(final String text) { - ActionLabel actionLabel = new ActionLabel(text); - - actionLabel.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - try { - //Desktop.getDesktop().browse(new URI(url)); - final PluginManagerPane managerPane = new PluginManagerPane(); - UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane); - PluginWebBridge.getHelper().setDialogHandle(dlg); - dlg.setVisible(true); - RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false); - } catch (Exception exp) { - - } - } - }); - - return new BoxCenterAligmentPane(actionLabel); - } - - class BoxCenterAligmentPane extends JPanel { - - private UILabel textLabel; - - public BoxCenterAligmentPane(String text) { - this(new UILabel(text)); - } - - public BoxCenterAligmentPane(UILabel label) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - this.add(centerPane, BorderLayout.CENTER); - UILabel label1 = new UILabel(Inter.getLocText("FR-Designer_Form-Frozen-Tip")); - label1.setForeground(new Color(255, 0, 0)); - UILabel label2 = new UILabel(Inter.getLocText("FR-Designer_Form-Forzen-Speed")); - label2.setForeground(new Color(255, 0, 0)); - this.textLabel = label; - centerPane.add(label1); - centerPane.add(textLabel); - centerPane.add(label2); - } - - public void setFont(Font font) { - super.setFont(font); - - if (textLabel != null) { - textLabel.setFont(font); - } - } - } + return null; + } + + private BoxCenterAligmentPane getURLActionLabel(final String text) { + ActionLabel actionLabel = new ActionLabel(text); + + actionLabel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + try { + //Desktop.getDesktop().browse(new URI(url)); + BasicPane managerPane = new WebManagerPaneFactory().createPluginPane(); + UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); + PluginWebBridge.getHelper().setDialogHandle(dlg); + dlg.setVisible(true); + RepeatAndFreezeSettingPane.this.getTopLevelAncestor().setVisible(false); + } catch (Exception exp) { + + } + } + }); + + return new BoxCenterAligmentPane(actionLabel); + } + + class BoxCenterAligmentPane extends JPanel { + + private UILabel textLabel; + + public BoxCenterAligmentPane(String text) { + this(new UILabel(text)); + } + + public BoxCenterAligmentPane(UILabel label) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + this.add(centerPane, BorderLayout.CENTER); + UILabel label1 = new UILabel(Inter.getLocText("FR-Designer_Form-Frozen-Tip")); + label1.setForeground(new Color(255, 0, 0)); + UILabel label2 = new UILabel(Inter.getLocText("FR-Designer_Form-Forzen-Speed")); + label2.setForeground(new Color(255, 0, 0)); + this.textLabel = label; + centerPane.add(label1); + centerPane.add(textLabel); + centerPane.add(label2); + } + + public void setFont(Font font) { + super.setFont(font); + + if (textLabel != null) { + textLabel.setFont(font); + } + } + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java b/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java index d88fdf992..fee467820 100644 --- a/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer_base/src/com/fr/design/actions/server/PluginManagerAction.java @@ -2,10 +2,11 @@ package com.fr.design.actions.server; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.PluginManagerPane; import com.fr.design.extra.PluginWebBridge; -import com.fr.design.extra.PluginShopDialog; +import com.fr.design.extra.ShopDialog; +import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.MenuKeySet; import com.fr.general.Inter; @@ -29,8 +30,8 @@ public class PluginManagerAction extends UpdateAction { @Override public void actionPerformed(ActionEvent e) { - final PluginManagerPane managerPane = new PluginManagerPane(); - UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane); + BasicPane managerPane = new WebManagerPaneFactory().createPluginPane(); + UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); PluginWebBridge.getHelper().setDialogHandle(dlg); dlg.setVisible(true); } diff --git a/designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java b/designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java new file mode 100644 index 000000000..3bd21a0d9 --- /dev/null +++ b/designer_base/src/com/fr/design/actions/server/ReuseManagerAction.java @@ -0,0 +1,53 @@ +package com.fr.design.actions.server; + +import com.fr.base.BaseUtils; +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.UIDialog; +import com.fr.design.extra.ShopDialog; +import com.fr.design.extra.PluginWebBridge; +import com.fr.design.extra.WebManagerPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.menu.MenuKeySet; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +/** + * Created by vito on 2016/9/27. + */ +public class ReuseManagerAction extends UpdateAction { + + public ReuseManagerAction() { + this.setMenuKeySet(REUSE_MANAGER); + this.setName(getMenuKeySet().getMenuKeySetName()); + this.setMnemonic(getMenuKeySet().getMnemonic()); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/plugin.png")); + } + + @Override + public void actionPerformed(ActionEvent e) { + BasicPane managerPane = new WebManagerPaneFactory().createReusePane(); + UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); + PluginWebBridge.getHelper().setDialogHandle(dlg); + dlg.setVisible(true); + } + + public static final MenuKeySet REUSE_MANAGER = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'R'; + } + + @Override + public String getMenuName() { + return Inter.getLocText("FR-Designer-Reuse_Manager"); + } + + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 4446ffae8..c211dd93b 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -42,6 +42,7 @@ public class PluginWebBridge { private String ACTION = "action"; private String KEYWORD = "keyword"; private Map config; + private WebEngine webEngine; private UILabel uiLabel; @@ -79,8 +80,6 @@ public class PluginWebBridge { return helper; } - private WebEngine webEngine; - private PluginWebBridge() { } diff --git a/designer_base/src/com/fr/design/extra/PluginWebPane.java b/designer_base/src/com/fr/design/extra/PluginWebPane.java index 0f2bd0760..ce32babc7 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebPane.java +++ b/designer_base/src/com/fr/design/extra/PluginWebPane.java @@ -19,7 +19,7 @@ public class PluginWebPane extends JFXPanel { private WebEngine webEngine; - public PluginWebPane(final String installHome) { + public PluginWebPane(final String mainJs) { Platform.setImplicitExit(false); Platform.runLater(new Runnable() { @Override @@ -29,7 +29,7 @@ public class PluginWebPane extends JFXPanel { PluginWebPane.this.setScene(scene); WebView webView = new WebView(); webEngine = webView.getEngine(); - webEngine.load("file:///" + installHome + "/scripts/store/web/index.html"); + webEngine.load("file:///" + mainJs); webEngine.setOnAlert(new EventHandler>() { @Override public void handle(WebEvent event) { diff --git a/designer_base/src/com/fr/design/extra/ReuseWebBridge.java b/designer_base/src/com/fr/design/extra/ReuseWebBridge.java new file mode 100644 index 000000000..413f86275 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/ReuseWebBridge.java @@ -0,0 +1,36 @@ +package com.fr.design.extra; + +import javafx.scene.web.WebEngine; + +/** + * Created by vito on 2016/9/28. + */ +public class ReuseWebBridge { + public static ReuseWebBridge helper; + private WebEngine webEngine; + + public static ReuseWebBridge getHelper() { + if (helper != null) { + return helper; + } + synchronized (ReuseWebBridge.class) { + if (helper == null) { + helper = new ReuseWebBridge(); + } + return helper; + } + } + + public static ReuseWebBridge getHelper(WebEngine webEngine) { + getHelper(); + helper.setEngine(webEngine); + return helper; + } + + private ReuseWebBridge() { + } + + public void setEngine(WebEngine webEngine) { + this.webEngine = webEngine; + } +} diff --git a/designer_base/src/com/fr/design/extra/ReuseWebPane.java b/designer_base/src/com/fr/design/extra/ReuseWebPane.java new file mode 100644 index 000000000..b48957e0f --- /dev/null +++ b/designer_base/src/com/fr/design/extra/ReuseWebPane.java @@ -0,0 +1,54 @@ +package com.fr.design.extra; + +import javafx.application.Platform; +import javafx.embed.swing.JFXPanel; +import javafx.event.EventHandler; +import javafx.scene.Scene; +import javafx.scene.layout.BorderPane; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebEvent; +import javafx.scene.web.WebView; +import netscape.javascript.JSObject; + +import javax.swing.*; + +/** + * Created by vito on 2016/9/28. + */ +public class ReuseWebPane extends JFXPanel { + private WebEngine webEngine; + + public ReuseWebPane(final String mainJs) { + Platform.setImplicitExit(false); + Platform.runLater(new Runnable() { + @Override + public void run() { + BorderPane root = new BorderPane(); + Scene scene = new Scene(root); + ReuseWebPane.this.setScene(scene); + WebView webView = new WebView(); + webEngine = webView.getEngine(); + webEngine.load("file:///" + mainJs); + webEngine.setOnAlert(new EventHandler>() { + @Override + public void handle(WebEvent event) { + showAlert(event.getData()); + } + }); + JSObject obj = (JSObject) webEngine.executeScript("window"); + obj.setMember("ReuseHelper", ReuseWebBridge.getHelper(webEngine)); + webView.setContextMenuEnabled(false);//屏蔽右键 + root.setCenter(webView); + } + }); + } + + private void showAlert(final String message) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JOptionPane.showMessageDialog(ReuseWebPane.this, message); + } + }); + } +} diff --git a/designer_base/src/com/fr/design/extra/PluginShopDialog.java b/designer_base/src/com/fr/design/extra/ShopDialog.java similarity index 70% rename from designer_base/src/com/fr/design/extra/PluginShopDialog.java rename to designer_base/src/com/fr/design/extra/ShopDialog.java index f2e1e93ec..e2fb97b62 100644 --- a/designer_base/src/com/fr/design/extra/PluginShopDialog.java +++ b/designer_base/src/com/fr/design/extra/ShopDialog.java @@ -3,8 +3,7 @@ package com.fr.design.extra; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.Inter; -import javafx.embed.swing.JFXPanel; +import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; @@ -12,19 +11,20 @@ import java.awt.*; /** * Created by vito on 16/4/18. */ -public class PluginShopDialog extends UIDialog { +public class ShopDialog extends UIDialog { private static final Dimension DEFAULT_SHOP = new Dimension(900, 700); - public PluginShopDialog(Frame frame, BasicPane pane) { + public ShopDialog(Frame frame, BasicPane pane) { super(frame); - setUndecorated(true); + if (StableUtils.getMajorJavaVersion() == 8) { + setUndecorated(true); + } JPanel panel = (JPanel) getContentPane(); panel.setLayout(new BorderLayout()); add(pane, BorderLayout.CENTER); setSize(DEFAULT_SHOP); GUICoreUtils.centerWindow(this); setResizable(false); - setTitle(Inter.getLocText("FR-Designer-Plugin_Manager")); } @Override diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/ShopManagerPane.java similarity index 65% rename from designer_base/src/com/fr/design/extra/PluginManagerPane.java rename to designer_base/src/com/fr/design/extra/ShopManagerPane.java index 1c9f7aafa..12900c720 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/ShopManagerPane.java @@ -4,7 +4,6 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicPane; -import com.fr.design.gui.frpane.UITabbedPane; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.general.Inter; @@ -12,12 +11,12 @@ import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; import com.fr.plugin.PluginVerifyException; import com.fr.stable.StableUtils; +import javafx.embed.swing.JFXPanel; import javax.swing.*; import java.awt.*; import java.io.File; import java.net.HttpURLConnection; -import java.net.URL; import java.util.concurrent.ExecutionException; /** @@ -31,82 +30,55 @@ import java.util.concurrent.ExecutionException; * 因为如果直接嵌入WebView,和设计器的交互就需要预先设定好,这样灵活性会差很多,而如果使用JavaScript引擎, * 就可以直接在JavaScript中和WebView组件做交互,而同时JavaScript中可以调用任何的设计器API. */ -public class PluginManagerPane extends BasicPane { +public class ShopManagerPane extends BasicPane { private static final String LATEST = "latest"; + private ShopPaneConfig shopPaneConfig; - public PluginManagerPane() { + public ShopManagerPane(ShopPaneConfig shopPaneConfig) { + this.shopPaneConfig = shopPaneConfig; setLayout(new BorderLayout()); - if (StableUtils.getMajorJavaVersion() == 8) { - String installHome; - if (StableUtils.isDebug()) { - URL url = ClassLoader.getSystemResource(""); - installHome = url.getPath(); - addPane(installHome); - } else { - installHome = StableUtils.getInstallHome(); - File file = new File(StableUtils.pathJoin(installHome, "scripts")); - if (!file.exists()) { - int rv = JOptionPane.showConfirmDialog( - this, - Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), - Inter.getLocText("FR-Designer-Plugin_Warning"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE - ); - if (rv == JOptionPane.OK_OPTION) { - downloadShopScripts(); - } - } else { - addPane(installHome); - updateShopScripts(); + if (StableUtils.isDebug()) { + addPane(); + } else { + File file = new File(shopPaneConfig.getMainJS()); + if (!file.exists()) { + int rv = JOptionPane.showConfirmDialog( + this, + Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), + Inter.getLocText("FR-Designer-Plugin_Warning"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.INFORMATION_MESSAGE + ); + if (rv == JOptionPane.OK_OPTION) { + downloadShopScripts(); } + } else { + addPane(); + updateShopScripts(); } - } else { - initTraditionalStore(); } } - /** - * 以关键词打开设计器商店 - * - * @param keyword 关键词 - */ - public PluginManagerPane(String keyword) { - this(); - PluginWebBridge.getHelper().openWithSearch(keyword); - } - - private void addPane(String installHome) { - PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); + private void addPane() { + JFXPanel webPane = shopPaneConfig.getWebPane(); add(webPane, BorderLayout.CENTER); } - - private void initTraditionalStore() { - UITabbedPane tabbedPane = new UITabbedPane(); - add(tabbedPane, BorderLayout.CENTER); - PluginInstalledPane installedPane = new PluginInstalledPane(); - tabbedPane.addTab(installedPane.tabTitle(), installedPane); - tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane)); - tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane)); - } - private void downloadShopScripts() { new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - String id = "shop_scripts"; String username = DesignerEnvManager.getEnvManager().getBBSName(); String password = DesignerEnvManager.getEnvManager().getBBSPassword(); try { - PluginHelper.downloadPluginFile(id, username, password, new Process() { + PluginHelper.downloadPluginFile(shopPaneConfig.getScriptsId(), username, password, new Process() { @Override public void process(Double integer) { } }); } catch (PluginVerifyException e) { - JOptionPane.showMessageDialog(PluginManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(ShopManagerPane.this, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); return false; } catch (Exception e) { FRContext.getLogger().error(e.getMessage(), e); @@ -122,7 +94,7 @@ public class PluginManagerPane extends BasicPane { if (get()) { IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); int rv = JOptionPane.showOptionDialog( - PluginManagerPane.this, + ShopManagerPane.this, Inter.getLocText("FR-Designer-Plugin_Shop_Installed"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.YES_NO_OPTION, @@ -151,7 +123,7 @@ public class PluginManagerPane extends BasicPane { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (!ComparatorUtils.equals(httpClient.getResponseText(), LATEST)) { int rv = JOptionPane.showConfirmDialog( - PluginManagerPane.this, + ShopManagerPane.this, Inter.getLocText("FR-Designer-Plugin_Shop_Need_Update"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.OK_CANCEL_OPTION, diff --git a/designer_base/src/com/fr/design/extra/ShopPaneConfig.java b/designer_base/src/com/fr/design/extra/ShopPaneConfig.java new file mode 100644 index 000000000..87bc719ee --- /dev/null +++ b/designer_base/src/com/fr/design/extra/ShopPaneConfig.java @@ -0,0 +1,24 @@ +package com.fr.design.extra; + +import javafx.embed.swing.JFXPanel; + +/** + * Created by vito on 2016/9/28. + */ +public abstract class ShopPaneConfig { + private String mainJS; + private String scriptsId; + private JFXPanel webPane; + + public ShopPaneConfig() { + this.mainJS = getMainJS(); + this.scriptsId = getScriptsId(); + this.webPane = getWebPane(); + } + + abstract String getMainJS(); + + abstract String getScriptsId(); + + abstract JFXPanel getWebPane(); +} diff --git a/designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java b/designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java new file mode 100644 index 000000000..75a79dedd --- /dev/null +++ b/designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java @@ -0,0 +1,99 @@ +package com.fr.design.extra; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UITabbedPane; +import com.fr.general.Inter; +import com.fr.stable.StableUtils; +import javafx.embed.swing.JFXPanel; + +import java.awt.*; +import java.io.File; +import java.net.URL; + +/** + * Created by vito on 2016/9/28. + */ +public class WebManagerPaneFactory { + private String installHome; + + public WebManagerPaneFactory() { + if (StableUtils.isDebug()) { + URL url = ClassLoader.getSystemResource(""); + this.installHome = url.getPath(); + } else { + this.installHome = StableUtils.getInstallHome(); + } + } + + public BasicPane createPluginPane() { + if (StableUtils.getMajorJavaVersion() == 8) { + return new ShopManagerPane(new ShopPaneConfig() { + @Override + String getMainJS() { + String relativePath = "/scripts/store/web/index.html"; + return StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath); + } + + @Override + String getScriptsId() { + return "shop_scripts"; + } + + @Override + JFXPanel getWebPane() { + return new PluginWebPane(getMainJS()); + } + + }); + } else { + BasicPane traditionalStorePane = new BasicPane() { + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer-Plugin_Manager"); + } + }; + traditionalStorePane.setLayout(new BorderLayout()); + traditionalStorePane.add(initTraditionalStore(), BorderLayout.CENTER); + return traditionalStorePane; + } + } + + public BasicPane createReusePane() { + return new ShopManagerPane(new ShopPaneConfig() { + @Override + String getMainJS() { + String relativePath = "/scripts/store/reuse/index.html"; + return StableUtils.pathJoin(new File(installHome).getAbsolutePath(), relativePath); + } + + @Override + String getScriptsId() { + return "reuse_scripts"; + } + + @Override + JFXPanel getWebPane() { + return new ReuseWebPane(getMainJS()); + } + }); + } + + /** + * 以关键词打开设计器商店 + * + * @param keyword 关键词 + */ + public BasicPane createPluginPane(String keyword) { + PluginWebBridge.getHelper().openWithSearch(keyword); + return createPluginPane(); + } + + private Component initTraditionalStore() { + UITabbedPane tabbedPane = new UITabbedPane(); + PluginInstalledPane installedPane = new PluginInstalledPane(); + tabbedPane.addTab(installedPane.tabTitle(), installedPane); + tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane)); + tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane)); + return tabbedPane; + } +} diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index b04e1e5b1..aae0b1ea6 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -146,13 +146,13 @@ public abstract class ToolBarMenuDock { // 给菜单加插件入口 for (MenuDef m : menuDefs) { switch (m.getAnchor()) { - case MenuHandler.TEMPLATE : + case MenuHandler.TEMPLATE: insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); break; - case MenuHandler.INSERT : + case MenuHandler.INSERT: insertMenu(m, MenuHandler.INSERT); break; - case MenuHandler.CELL : + case MenuHandler.CELL: insertMenu(m, MenuHandler.CELL); break; default: @@ -199,7 +199,7 @@ public abstract class ToolBarMenuDock { addSwitchExistEnvAction(menuDef); - menuDef.addShortCut( new ExitDesignerAction()); + menuDef.addShortCut(new ExitDesignerAction()); insertMenu(menuDef, MenuHandler.FILE); return menuDef; @@ -221,7 +221,7 @@ public abstract class ToolBarMenuDock { menuDef.addShortCut(new SwitchExistEnv()); } - protected ShortCut openTemplateAction(){ + protected ShortCut openTemplateAction() { return new OpenTemplateAction(); } @@ -231,15 +231,14 @@ public abstract class ToolBarMenuDock { * @return 菜单 */ public abstract ShortCut[] createNewFileShortCuts(); - + /** - * 创建论坛登录面板, chart那边不需要 - * - * @return 面板组件 - * - */ - public Component createBBSLoginPane(){ - return new UILabel(); + * 创建论坛登录面板, chart那边不需要 + * + * @return 面板组件 + */ + public Component createBBSLoginPane() { + return new UILabel(); } @@ -264,9 +263,10 @@ public abstract class ToolBarMenuDock { ); if (!BaseUtils.isAuthorityEditing()) { - if (shouldShowPlugin()){ + if (shouldShowPlugin()) { menuDef.addShortCut( - new PluginManagerAction() + new PluginManagerAction(), + new ReuseManagerAction() ); } menuDef.addShortCut( @@ -290,6 +290,7 @@ public abstract class ToolBarMenuDock { /** * 创建帮助子菜单 + * * @return 帮组菜单的子菜单 */ public ShortCut[] createHelpShortCuts() { @@ -298,11 +299,11 @@ public abstract class ToolBarMenuDock { shortCuts.add(SeparatorDef.DEFAULT); //shortCuts.add(new TutorialAction()); shortCuts.add(SeparatorDef.DEFAULT); - if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { + if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) { shortCuts.add(new FeedBackAction()); shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT); - // shortCuts.add(new ForumAction()); + // shortCuts.add(new ForumAction()); } shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new AboutAction()); @@ -312,6 +313,7 @@ public abstract class ToolBarMenuDock { /** * 创建社区子菜单 + * * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { @@ -346,6 +348,7 @@ public abstract class ToolBarMenuDock { insertMenu(menuDef, MenuHandler.BBS); return menuDef; } + /** * 生成工具栏 * @@ -470,7 +473,8 @@ public abstract class ToolBarMenuDock { public int getMenuState() { return DesignState.WORK_SHEET; } - public int getToolBarHeight(){ + + public int getToolBarHeight() { return PANLE_HEIGNT; } @@ -479,29 +483,29 @@ public abstract class ToolBarMenuDock { * * @return 子菜单 */ - public ShortCut[] shortcut4ExportMenu(){ + public ShortCut[] shortcut4ExportMenu() { return new ShortCut[0]; } }; - public NewTemplatePane getNewTemplatePane(){ - return new NewTemplatePane() { - @Override - public Icon getNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); - } + public NewTemplatePane getNewTemplatePane() { + return new NewTemplatePane() { + @Override + public Icon getNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png"); + } - @Override - public Icon getMouseOverNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); - } + @Override + public Icon getMouseOverNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); + } - @Override - public Icon getMousePressNew() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); - } - }; + @Override + public Icon getMousePressNew() { + return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png"); + } + }; } protected void insertMenu(MenuDef menuDef, String anchor) { @@ -521,7 +525,7 @@ public abstract class ToolBarMenuDock { for (MenuHandler handler : target) { int insertPosition = handler.insertPosition(menuDef.getShortCutCount()); ShortCut shortCut = action.methodAction(handler); - if (shortCut == null){ + if (shortCut == null) { continue; } @@ -534,48 +538,47 @@ public abstract class ToolBarMenuDock { menuDef.insertShortCut(insertPosition, shortCut); if (handler.insertSeparatorBefore()) { menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); - insertPosition ++; + insertPosition++; } if (handler.insertSeparatorAfter()) { - insertPosition ++; + insertPosition++; menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); } } } } - + /** - * 设计器退出时, 做的一些操作. - * - */ - public void shutDown(){ - + * 设计器退出时, 做的一些操作. + */ + public void shutDown() { + } - private interface ShortCutMethodAction{ + private interface ShortCutMethodAction { public ShortCut methodAction(MenuHandler handler); } - private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{ + private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction { - public ShortCut methodAction(MenuHandler handler){ - return handler.shortcut(); + public ShortCut methodAction(MenuHandler handler) { + return handler.shortcut(); } } //不需要编辑对象的菜单, 比如文件, 服务器, 关于 - private class NoTargetAction extends AbstractShortCutMethodAction{ + private class NoTargetAction extends AbstractShortCutMethodAction { } //模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可. //在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell). - private class TemplateTargetAction extends AbstractShortCutMethodAction{ + private class TemplateTargetAction extends AbstractShortCutMethodAction { private ToolBarMenuDockPlus plus; - public TemplateTargetAction(ToolBarMenuDockPlus plus){ + public TemplateTargetAction(ToolBarMenuDockPlus plus) { this.plus = plus; } diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 470affb44..9e25a76c6 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -7,10 +7,11 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.RestartHelper; +import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; -import com.fr.design.extra.PluginManagerPane; -import com.fr.design.extra.PluginShopDialog; +import com.fr.design.extra.ShopDialog; import com.fr.design.extra.PluginWebBridge; +import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.TemplateTreePane; @@ -130,8 +131,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock { String text = StableUtils.join(plugins, ",") + Inter.getLocText("FR-Designer_Plugin_Should_Update"); int r = JOptionPane.showConfirmDialog(null, text, Inter.getLocText("FR-Designer_Plugin_Should_Update_Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (r == JOptionPane.OK_OPTION) { - final PluginManagerPane managerPane = new PluginManagerPane(); - UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane); + BasicPane managerPane = new WebManagerPaneFactory().createPluginPane(); + UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane); PluginWebBridge.getHelper().setDialogHandle(dlg); dlg.setVisible(true); }