diff --git a/designer/src/com/fr/design/webattr/EditToolBar.java b/designer/src/com/fr/design/webattr/EditToolBar.java index 58f4558704..ac12959345 100644 --- a/designer/src/com/fr/design/webattr/EditToolBar.java +++ b/designer/src/com/fr/design/webattr/EditToolBar.java @@ -7,6 +7,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.fun.ExportToolBarProvider; +import com.fr.design.fun.ExtraButtonToolBarProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -199,7 +200,7 @@ public class EditToolBar extends BasicPane { toolBarButton.setWidget(widget); if (widget instanceof Button) { String iconname = ((Button) widget).getIconName(); - if (!StringUtils.isBlank(iconname)) { + if (StringUtils.isNotBlank(iconname)) { Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconname); toolBarButton.setIcon(new ImageIcon(iimage)); } @@ -326,7 +327,7 @@ public class EditToolBar extends BasicPane { private IconDefinePane iconPane; private UIButton button; private JavaScriptActionPane javaScriptPane; - private ExportToolBarProvider[] exportToolBarProviders; + private ExportToolBarProvider[] exportToolBarProviders; private ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { @@ -386,6 +387,11 @@ public class EditToolBar extends BasicPane { centerPane.add(getCpane(), "appendcount"); centerPane.add(getSubmitPane(), "submit"); + Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); + for (ExtraButtonToolBarProvider provider : extraButtonSet) { + provider.updateCenterPane(centerPane); + } + this.add(centerPane, BorderLayout.CENTER); } @@ -479,7 +485,6 @@ public class EditToolBar extends BasicPane { return submitPane; } - @Override protected String title4PopupWindow() { return "Button"; @@ -528,13 +533,18 @@ public class EditToolBar extends BasicPane { } else if (widget instanceof CustomToolBarButton) { populateCustomToolBarButton(); } - } - + + Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); + for (ExtraButtonToolBarProvider provider : extraButtonSet) { + provider.populate(widget, card, centerPane); + } + } + private void populateAppendColumnRow(){ card.show(centerPane, "appendcount"); count.setValue(((AppendColumnRow) widget).getCount()); } - + private void populateExport(){ card.show(centerPane, "export"); Export export = (Export) widget; @@ -550,7 +560,7 @@ public class EditToolBar extends BasicPane { } } } - + private void populateCustomToolBarButton(){ card.show(centerPane, "custom"); CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget; @@ -558,7 +568,7 @@ public class EditToolBar extends BasicPane { this.javaScriptPane.populateBean(customToolBarButton.getJSImpl()); } } - + private void populateSubmit(){ card.show(centerPane, "submit"); Submit submit = ((Submit) widget); @@ -566,13 +576,13 @@ public class EditToolBar extends BasicPane { this.failSubmit.setSelected(submit.isFailVerifySubmit()); this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); } - + private void populatePDFPrint(){ card.show(centerPane, "pdfprint"); PDFPrint pdfPrint = (PDFPrint) widget; this.isPopup.setSelected(pdfPrint.isPopup()); } - + private void populatePrint(){ card.show(centerPane, "print"); Print print = (Print) widget; @@ -581,7 +591,7 @@ public class EditToolBar extends BasicPane { this.flashPrint.setSelected(print.isFlashPrint()); this.serverPrint.setSelected(print.isServerPrint()); } - + private void populateDefault(){ Button button = (Button) widget; this.icon.setSelected(button.isShowIcon()); @@ -592,7 +602,7 @@ public class EditToolBar extends BasicPane { /** * 更新 - * + * * @return 对应组件 */ public Widget update() { @@ -613,23 +623,29 @@ public class EditToolBar extends BasicPane { if (widget instanceof Button) { updateDefault(); } + + Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); + for (ExtraButtonToolBarProvider provider : extraButtonSet) { + provider.update(widget); + } + return widget; } - + private void updateDefault(){ ((Button) widget).setShowIcon(this.icon.isSelected()); ((Button) widget).setShowText(this.text.isSelected()); ((Button) widget).setText(this.nameField.getText()); ((Button) widget).setIconName(this.iconPane.update()); } - + private void updateSubmit(){ Submit submit = ((Submit) widget); submit.setVerify(this.isVerify.isSelected()); submit.setFailVerifySubmit(this.failSubmit.isSelected()); submit.setOnlySubmitSelect(this.isCurSheet.isSelected()); } - + private void updatePrint(){ Print print = (Print) widget; print.setAppletPrint(this.appletPrint.isSelected()); @@ -637,7 +653,7 @@ public class EditToolBar extends BasicPane { print.setPDFPrint(this.pdfPrint.isSelected()); print.setServerPrint(this.serverPrint.isSelected()); } - + private void updateExport(){ Export export = (Export) widget; export.setPdfAvailable(this.pdf.isSelected()); diff --git a/designer_base/src/com/fr/design/fun/ExtraButtonToolBarProvider.java b/designer_base/src/com/fr/design/fun/ExtraButtonToolBarProvider.java new file mode 100644 index 0000000000..09bff1f1a6 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/ExtraButtonToolBarProvider.java @@ -0,0 +1,41 @@ +package com.fr.design.fun; + +import com.fr.form.ui.Widget; +import com.fr.stable.fun.mark.Mutable; + +import javax.swing.*; +import java.awt.*; + +/** + * 报表工具栏设计器端拓展,用于配置按钮额外属性 + * Created by harry on 2016-12-23. + */ +public interface ExtraButtonToolBarProvider extends Mutable { + + String XML_TAG = "ExtraButtonToolBarProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 用于添加属性面板 + * + * @param centerPane 面板 + */ + void updateCenterPane(JPanel centerPane); + + /** + * 更新界面 + * + * @param widget 控件 + * @param card 卡片布局 + * @param centerPane 面板 + */ + void populate(Widget widget, CardLayout card, JPanel centerPane); + + /** + * 保存界面设置 + * + * @param widget 控件 + */ + void update(Widget widget); +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractExtraButtonToolBarProvider.java b/designer_base/src/com/fr/design/fun/impl/AbstractExtraButtonToolBarProvider.java new file mode 100644 index 0000000000..064d72d1cb --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractExtraButtonToolBarProvider.java @@ -0,0 +1,19 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.ExtraButtonToolBarProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * Created by harry on 2016-12-23. + */ +@API(level = ExtraButtonToolBarProvider.CURRENT_LEVEL) +public abstract class AbstractExtraButtonToolBarProvider extends AbstractProvider implements ExtraButtonToolBarProvider { + public int currentAPILevel() { + return ExtraButtonToolBarProvider.CURRENT_LEVEL; + } + + public String mark4Provider() { + return getClass().getName(); + } +}