From 00113dc9aee90f9a40729b44387299fa027ef910 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 9 Jan 2024 19:21:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-99485=20=E6=9A=82=E6=97=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=B8=A6=E6=9C=89filter=E7=9A=84svg=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BB=A5=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=EF=BC=88=E5=A4=B1=E5=8E=BB=E9=98=B4=E5=BD=B1=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fine/theme/icon/svg/SvgIcon.java | 17 +++++++++++------ .../com/fine/theme/icon/checkbox/checked.svg | 13 +------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java index 7e4cb9684f..a10e3105ef 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java @@ -8,6 +8,7 @@ import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.GrayFilter; import com.fr.clone.cloning.Immutable; +import com.fr.log.FineLoggerFactory; import com.fr.value.NullableLazyValue; import com.github.weisj.jsvg.SVGDocument; import com.github.weisj.jsvg.attributes.ViewBox; @@ -112,12 +113,16 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { } private void render(Component c, Graphics g, int x, int y) { - if (type == Type.white) { - Objects.requireNonNull(whiteSvgDocument.getValue()) - .render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); - } else { - Objects.requireNonNull(svgDocument.getValue()) - .render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); + try { + if (type == Type.white) { + Objects.requireNonNull(whiteSvgDocument.getValue()) + .render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); + } else { + Objects.requireNonNull(svgDocument.getValue()) + .render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, size.width, size.height)); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error("SvgIcon from url: " + resource + "can not paint.", e); } } diff --git a/designer-base/src/main/resources/com/fine/theme/icon/checkbox/checked.svg b/designer-base/src/main/resources/com/fine/theme/icon/checkbox/checked.svg index fa4b47ddd7..5323d23b6d 100644 --- a/designer-base/src/main/resources/com/fine/theme/icon/checkbox/checked.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/checkbox/checked.svg @@ -1,19 +1,8 @@ - + - - - - - - - - - - - From a27ad872c69163d1a20600679ed82ffdc0f44e45 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 9 Jan 2024 19:47:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-99485=20=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=B8=83=E5=B1=80=E8=B0=83?= =?UTF-8?q?=E6=95=B4&=E5=9B=BE=E6=A0=87=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/WidgetOption.java | 79 +++-- .../design/gui/core/WidgetOptionFactory.java | 3 +- .../mainframe/CenterRegionContainerPane.java | 2 +- .../toolbar/ToolBarMenuDockPlus.java | 3 +- .../parameter/ParameterDesignerProvider.java | 2 +- .../com/fine/theme/icon/widget/button.svg | 6 + .../fine/theme/icon/widget/button_disable.svg | 6 + .../fine/theme/icon/widget/button_group.svg | 7 + .../icon/widget/button_group_disable.svg | 7 + .../com/fine/theme/icon/widget/checkbox.svg | 4 + .../theme/icon/widget/checkbox_disable.svg | 4 + .../fine/theme/icon/widget/checkbox_group.svg | 7 + .../icon/widget/checkbox_group_disable.svg | 7 + .../com/fine/theme/icon/widget/combo_box.svg | 11 + .../theme/icon/widget/combo_box_disable.svg | 11 + .../fine/theme/icon/widget/combo_check.svg | 7 + .../theme/icon/widget/combo_check_disable.svg | 7 + .../fine/theme/icon/widget/comboboxtree.svg | 7 + .../icon/widget/comboboxtree_disable.svg | 7 + .../com/fine/theme/icon/widget/date.svg | 8 + .../fine/theme/icon/widget/date_disable.svg | 8 + .../com/fine/theme/icon/widget/files_up.svg | 11 + .../theme/icon/widget/files_up_disable.svg | 11 + .../com/fine/theme/icon/widget/iframe.svg | 13 + .../fine/theme/icon/widget/iframe_disable.svg | 13 + .../com/fine/theme/icon/widget/label.svg | 4 + .../fine/theme/icon/widget/label_disable.svg | 4 + .../fine/theme/icon/widget/number_field.svg | 6 + .../icon/widget/number_field_disable.svg | 6 + .../fine/theme/icon/widget/password_field.svg | 4 + .../icon/widget/password_field_disable.svg | 4 + .../com/fine/theme/icon/widget/picture.svg | 11 + .../theme/icon/widget/picture_disable.svg | 11 + .../com/fine/theme/icon/widget/preview.svg | 11 + .../theme/icon/widget/preview_disable.svg | 11 + .../com/fine/theme/icon/widget/prewidget.svg | 13 + .../theme/icon/widget/prewidget_disable.svg | 13 + .../com/fine/theme/icon/widget/tab.svg | 3 + .../fine/theme/icon/widget/tab_disable.svg | 3 + .../com/fine/theme/icon/widget/text_area.svg | 11 + .../theme/icon/widget/text_area_disable.svg | 11 + .../com/fine/theme/icon/widget/text_field.svg | 3 + .../theme/icon/widget/text_field_disable.svg | 3 + .../com/fine/theme/icon/widget/tree.svg | 4 + .../fine/theme/icon/widget/tree_disable.svg | 4 + .../fr/design/gui/storybook/Storybook.java | 10 +- .../form/parameter/FormParaDesigner.java | 4 +- .../form/parameter/FormParaTargetMode.java | 16 +- .../com/fr/design/mainframe/FormDesigner.java | 8 +- .../com/fr/design/mainframe/FormParaPane.java | 90 ++---- .../design/mainframe/FormParaWidgetPane.java | 11 +- .../fr/design/mainframe/FormTargetMode.java | 13 +- .../design/mainframe/FormWidgetPopWindow.java | 251 +++++++-------- .../java/com/fr/design/mainframe/JForm.java | 6 +- .../fr/design/mainframe/ToolBarButton.java | 303 +++++++++--------- .../com/fr/design/mainframe/JWorkBook.java | 2 +- .../parameter/ParameterDefinitePane.java | 2 +- .../main/java/com/fr/start/MainDesigner.java | 27 +- 58 files changed, 703 insertions(+), 431 deletions(-) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/button.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/button_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/button_group.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/button_group_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/date.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/date_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/files_up.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/files_up_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/iframe.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/iframe_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/label.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/label_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/number_field.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/number_field_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/password_field.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/password_field_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/picture.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/picture_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/preview.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/preview_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/tab.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/tab_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/text_area.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/text_area_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/text_field.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/text_field_disable.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/tree.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/widget/tree_disable.svg diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index 4c9db5a6a0..6dd9826fb7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java @@ -1,7 +1,6 @@ package com.fr.design.gui.core; import com.fr.base.BaseUtils; -import com.fr.base.svg.IconUtils; import com.fr.form.ui.Button; import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBoxGroup; @@ -26,9 +25,12 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetConfig; import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.ComparatorUtils; + +import javax.swing.Icon; import java.io.Serializable; import java.util.ArrayList; -import javax.swing.Icon; + +import static com.fr.design.i18n.Toolkit.i18nText; public abstract class WidgetOption implements Serializable { @@ -123,7 +125,7 @@ public abstract class WidgetOption implements Serializable { */ public static WidgetOption[] getReportWidgetInstance() { return new WidgetOption[]{TEXTEDITOR, TEXTAREA, NUMBEREDITOR, PASSWORD, BUTTON, CHECKBOX, RADIOGROUP, CHECKBOXGROUP, COMBOBOX, - COMBOCHECKBOX, DATEEDITOR, MULTI_FILEEDITOR, LIST, IFRAMEDITOR, TREECOMBOBOX, TREE}; + COMBOCHECKBOX, DATEEDITOR, MULTI_FILEEDITOR, LIST, IFRAMEDITOR, TREECOMBOBOX, TREE}; } @@ -144,79 +146,102 @@ public abstract class WidgetOption implements Serializable { */ public static WidgetOption[] getFormWidgetIntance() { return new WidgetOption[]{TEXTEDITOR, LABEL, FREEBUTTON, COMBOBOX, COMBOCHECKBOX, DATEEDITOR, - NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR,PICTURE}; + NUMBEREDITOR, TREECOMBOBOX, RADIOGROUP, CHECKBOXGROUP, TEXTAREA, PASSWORD, CHECKBOX, TREE, MULTI_FILEEDITOR, PICTURE}; } - public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), - "/com/fr/design/images/buttonicon/widget/date_16", + public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass( + i18nText("Fine-Design_Basic_Widget_Type_Date"), + "date", DateEditor.class); - public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"), - "/com/fr/design/images/buttonicon/widget/tree_16", TreeEditor.class); + public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass( + i18nText("Fine-Design_Report_View_Tree"), + "tree", + TreeEditor.class); - public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), "/com/fr/design/images/buttonicon/widget/comboboxtree16", + public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass( + i18nText("Fine-Design_Report_Tree_ComboBox"), + "comboboxtree", TreeComboBoxEditor.class); public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), "/com/fr/design/images/buttonicon/widget/checkbox_group_16", CheckBoxGroup.class); + i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), + "checkbox_group", + CheckBoxGroup.class); public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), "/com/fr/design/images/buttonicon/widget/button_group_16", + i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), + "button_group", RadioGroup.class); public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), "/com/fr/design/images/buttonicon/widget/number_field_16", NumberEditor.class); + i18nText("Fine-Design_Basic_Widget_Type_Number"), + "number_field", + NumberEditor.class); public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), "/com/fr/design/images/buttonicon/widget/label_16", + i18nText("Fine-Design_Basic_Widget_Type_Label"), + "label", Label.class); public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), BaseUtils.readIcon("/com/fr/web/images/form/resources/button_16.png"), + i18nText("Fine-Design_Basic_Widget_Type_Button"), + "button", Button.class); public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), "/com/fr/design/images/buttonicon/widget/button_16", + i18nText("Fine-Design_Basic_Widget_Type_Button"), + "button", FreeButton.class); public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), "/com/fr/design/images/buttonicon/widget/files_up", + i18nText("Fine-Design_Basic_Widget_Type_File"), + "files_up", MultiFileEditor.class); public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), "/com/fr/design/images/buttonicon/widget/combo_box_16", + i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), + "combo_box", ComboBox.class); public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), "/com/fr/design/images/buttonicon/widget/combo_check_16", + i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), + "combo_check", ComboCheckBox.class); public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), "/com/fr/design/images/buttonicon/widget/check_box_16", + i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), + "check_box", CheckBox.class); public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_List"), BaseUtils.readIcon("/com/fr/web/images/form/resources/list_16.png"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_List"), + BaseUtils.readIcon("/com/fr/web/images/form/resources/list_16.png"), ListEditor.class); public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text") - , "/com/fr/design/images/buttonicon/widget/text_field_16", + i18nText("Fine-Design_Basic_Widget_Type_Text"), + "text_field", TextEditor.class); public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), "/com/fr/design/images/buttonicon/widget/text_area_16", + i18nText("Fine-Design_Basic_Widget_Type_Textarea"), + "text_area", TextArea.class); public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"), - "/com/fr/design/images/buttonicon/widget/password_field_16", Password.class); + i18nText("Fine-Design_Basic_Widget_Type_Password"), + "password_field", Password.class); - public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"), + public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass( + i18nText("Fine-Design_Report_Form_Iframe"), + "iframe", IframeEditor.class); - public static final WidgetOption PICTURE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Image"), IconUtils.readIcon("/com/fr/web/images/form/resources/picture_widget_16.png"), + public static final WidgetOption PICTURE = WidgetOptionFactory.createByWidgetClass( + i18nText("Fine-Design_Basic_Widget_Type_Image"), + "picture", PictureWidget.class); } diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java index 8d290ac2a8..9834d995a2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java @@ -1,5 +1,6 @@ package com.fr.design.gui.core; +import com.fine.theme.icon.LazyIcon; import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils; import com.fr.form.ui.Widget; @@ -17,7 +18,7 @@ public class WidgetOptionFactory { } public static WidgetOption createByWidgetClass(String optionName, String resource, Class widgetClass) { - Icon optionIcon = IconUtils.readIcon(resource); + Icon optionIcon = resource.startsWith("/")? IconUtils.readIcon(resource):new LazyIcon(resource); return new CustomWidgetOption(optionName, optionIcon, widgetClass); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java index 54944f2d30..bdb2989574 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java @@ -228,7 +228,7 @@ public class CenterRegionContainerPane extends JPanel { // 颜色,字体那些按钮的工具栏 toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); setStyle(toolbarComponent, TOP_TOOLS); - toolbarComponent.setBorder(new ScaledEmptyBorder(0, 10, 10, 10)); + toolbarComponent.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); JPanel customNorthPane = strategy.customNorthPane(toolbarPane, plus); if (!isExist(customNorthPane)) { this.removeNorth(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java index 4de9018ace..4c588009ea 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDockPlus.java @@ -6,7 +6,6 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import javax.swing.JComponent; -import javax.swing.JPanel; public interface ToolBarMenuDockPlus { /** @@ -35,7 +34,7 @@ public interface ToolBarMenuDockPlus { * * @return 表单工具栏 */ - JPanel[] toolbarPanes4Form(); + JComponent[] toolbarPanes4Form(); /** * 表单的工具按钮 diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java index efafa7cb2e..c5dbd1ae84 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java @@ -54,7 +54,7 @@ public interface ParameterDesignerProvider { return 0; } - JPanel[] toolbarPanes4Form(); + JComponent[] toolbarPanes4Form(); JComponent[] toolBarButton4Form(); diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/button.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/button.svg new file mode 100644 index 0000000000..4bbdbe9cbb --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/button.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/button_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/button_disable.svg new file mode 100644 index 0000000000..37b41b3640 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/button_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/button_group.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/button_group.svg new file mode 100644 index 0000000000..ed74e90966 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/button_group.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/button_group_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/button_group_disable.svg new file mode 100644 index 0000000000..c4c7f1d97f --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/button_group_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox.svg new file mode 100644 index 0000000000..bd379ea23d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_disable.svg new file mode 100644 index 0000000000..be8f4bab16 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group.svg new file mode 100644 index 0000000000..a06b362359 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group_disable.svg new file mode 100644 index 0000000000..caa279ab06 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/checkbox_group_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box.svg new file mode 100644 index 0000000000..2e7643d633 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box_disable.svg new file mode 100644 index 0000000000..96083244a6 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_box_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check.svg new file mode 100644 index 0000000000..618338ab6c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check_disable.svg new file mode 100644 index 0000000000..4a0d769208 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/combo_check_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree.svg new file mode 100644 index 0000000000..e9fcf6aaf9 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree_disable.svg new file mode 100644 index 0000000000..1f928e1805 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/comboboxtree_disable.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/date.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/date.svg new file mode 100644 index 0000000000..9f3c24c5e8 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/date.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/date_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/date_disable.svg new file mode 100644 index 0000000000..b0d3e0d3cb --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/date_disable.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/files_up.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/files_up.svg new file mode 100644 index 0000000000..0b8ff2b221 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/files_up.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/files_up_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/files_up_disable.svg new file mode 100644 index 0000000000..ed22586f86 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/files_up_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/iframe.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/iframe.svg new file mode 100644 index 0000000000..bb08acb5bb --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/iframe.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/iframe_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/iframe_disable.svg new file mode 100644 index 0000000000..5c61541333 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/iframe_disable.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/label.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/label.svg new file mode 100644 index 0000000000..0cf19814a1 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/label.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/label_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/label_disable.svg new file mode 100644 index 0000000000..9090502566 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/label_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/number_field.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/number_field.svg new file mode 100644 index 0000000000..20b147b1e7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/number_field.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/number_field_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/number_field_disable.svg new file mode 100644 index 0000000000..7c838a95cf --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/number_field_disable.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/password_field.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/password_field.svg new file mode 100644 index 0000000000..77c851a26b --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/password_field.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/password_field_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/password_field_disable.svg new file mode 100644 index 0000000000..281b7565e0 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/password_field_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/picture.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/picture.svg new file mode 100644 index 0000000000..74ec505206 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/picture.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/picture_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/picture_disable.svg new file mode 100644 index 0000000000..3a35cfb7a0 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/picture_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/preview.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/preview.svg new file mode 100644 index 0000000000..12dfadf802 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/preview.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/preview_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/preview_disable.svg new file mode 100644 index 0000000000..44841a7e29 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/preview_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg new file mode 100644 index 0000000000..8bea108a5a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg new file mode 100644 index 0000000000..49cc4a0b8a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/prewidget_disable.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/tab.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/tab.svg new file mode 100644 index 0000000000..2ee4e3012d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/tab.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/tab_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/tab_disable.svg new file mode 100644 index 0000000000..db847114a9 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/tab_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/text_area.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_area.svg new file mode 100644 index 0000000000..5367bebf03 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_area.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/text_area_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_area_disable.svg new file mode 100644 index 0000000000..6120485025 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_area_disable.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/text_field.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_field.svg new file mode 100644 index 0000000000..cc3298da8c --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_field.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/text_field_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_field_disable.svg new file mode 100644 index 0000000000..73d62a3439 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/text_field_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/tree.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/tree.svg new file mode 100644 index 0000000000..50b9ec8e46 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/tree.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/widget/tree_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/widget/tree_disable.svg new file mode 100644 index 0000000000..5c42bf7f4d --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/widget/tree_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java index ee9f211b16..635b342c15 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java @@ -143,12 +143,20 @@ public class Storybook { private static boolean isStory(String className) { try { Class aClass = Class.forName(COMPONENTS_PACKAGE + className); - return aClass.isAnnotationPresent(Story.class) || StoryBoard.class.isAssignableFrom(aClass); + return aClass.isAnnotationPresent(Story.class) + || StoryBoard.class.isAssignableFrom(aClass) + || isStoryboardByName(aClass); } catch (ClassNotFoundException e) { return false; } } + private static boolean isStoryboardByName(Class aClass) { + return aClass.getName().toLowerCase().contains("storyboard") + && !aClass.isMemberClass() + && !aClass.isAnonymousClass(); + } + /** * 应用主题 */ diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 20f8203ace..d3321e8b14 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -726,8 +726,8 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP * * @return 工具栏面板 g */ - public JPanel[] toolbarPanes4Form() { - return new JPanel[]{FormParaPane.getInstance(this)}; + public JComponent[] toolbarPanes4Form() { + return new JComponent[]{FormParaPane.getInstance(this)}; } /** diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java index 02ea653f2b..0169921bce 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java @@ -6,12 +6,12 @@ import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.itable.PropertyGroup; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesignerModeForSpecial; import com.fr.form.main.parameter.FormParameterUI; import com.fr.form.parameter.FormSubmitButton; - - import com.fr.form.ui.PageFixedRowComboBox; + import java.util.ArrayList; public class FormParaTargetMode extends FormDesignerModeForSpecial { @@ -27,10 +27,14 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial implements TreeSelection }); - DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { - @Override - public void designerOpened() { - setToolbarButtons(); - } - }); + DesignerContext.getDesignerFrame().addDesignerOpenedListener(this::setToolbarButtons); } /** diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 784a8ecf59..a683e3f7d4 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -7,25 +7,24 @@ import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.utils.gui.LayoutUtils; -import com.fr.form.ui.*; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; +import com.fr.form.ui.UserDefinedWidgetConfig; +import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetConfig; +import com.fr.form.ui.WidgetInfoConfig; import com.fr.general.GeneralContext; - -import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; -import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ArrayUtils; -import javax.swing.*; -import java.awt.*; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; +import java.util.List; /** * Created with IntelliJ IDEA. @@ -35,15 +34,13 @@ import java.util.Iterator; * To change this template use File | Settings | File Templates. */ -public class FormParaPane extends JPanel { - private static final int PANE_HEIGHT = 24; +public class FormParaPane extends UIToolbar { private static final int TOOLTIP_X = 5; - private static final int TOOLTIP_Y = 10; - private static Dimension originalSize; private static volatile FormParaPane THIS; - private java.util.List predifinedwidgeList = new ArrayList(); - private UIButton predefineButton; + private final List predifinedwidgeList = new ArrayList<>(); + private final UIButton predefineButton; + private final ArrayList componentsList4Para = new ArrayList<>(); private FormWidgetPopWindow predifinedWindow; @@ -57,41 +54,22 @@ public class FormParaPane extends JPanel { THIS = null; } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign); - } - }); + }, context -> context.contain(PluginModule.ExtraDesign)); } - public static final FormParaPane getInstance(FormDesigner designer) { - if(THIS == null) { + public static FormParaPane getInstance(FormDesigner designer) { + if (THIS == null) { THIS = new FormParaPane(); } THIS.designer = designer; THIS.setTarget(designer); - if (originalSize != null) { - THIS.setPreferredSize(originalSize); - } return THIS; } - private ArrayList componentsList4Para = new ArrayList(); - public FormParaPane() { - predefineButton = new UIButton(UIConstants.PRE_WIDGET_NORMAL_ICON) { - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = PANE_HEIGHT; - return dim; - } - }; + predefineButton = new UIButton(UIConstants.PRE_WIDGET_NORMAL_ICON); predefineButton.set4ToolbarButton(); - predefineButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_User_Defined_Widget_Config")); + predefineButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Widget_User_Defined_Widget_Config")); predefineButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -99,22 +77,10 @@ public class FormParaPane extends JPanel { predifinedWindow = new FormWidgetPopWindow(); } loadPredifinedWidget(); - predifinedWindow.showToolTip(predefineButton.getLocationOnScreen().x + predefineButton.getWidth() + TOOLTIP_X, predefineButton.getLocationOnScreen().y - TOOLTIP_Y, (WidgetOption[])predifinedwidgeList.toArray(new WidgetOption[predifinedwidgeList.size()])); - } - }); - setLayout(new FlowLayout(FlowLayout.LEFT)); - DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - if (FormParaPane.this.getParent() != null) { - JPanel fother = (JPanel)FormParaPane.this.getParent(); - Dimension d = fother.getSize(); - int delta_wdith = 0; - for (int i = 0; i < fother.getComponentCount() - 1; i ++) { - delta_wdith += fother.getComponent(i).getWidth(); - } - setPreferredSize(new Dimension(d.width - delta_wdith, d.height)); - LayoutUtils.layoutContainer(fother); - } + predifinedWindow.showToolTip( + predefineButton.getLocationOnScreen().x + predefineButton.getWidth() + TOOLTIP_X, + predefineButton.getLocationOnScreen().y, + predifinedwidgeList.toArray(new WidgetOption[predifinedwidgeList.size()])); } }); initParaComponent(); @@ -132,9 +98,9 @@ public class FormParaPane extends JPanel { private void loadPredifinedWidget() { predifinedwidgeList.clear(); - if(designer != null) { + if (designer != null) { WidgetOption[] designerPre = designer.getDesignerMode().getPredefinedWidgetOptions(); - for(int i = 0; i < designerPre.length; i++) { + for (int i = 0; i < designerPre.length; i++) { predifinedwidgeList.add(designerPre[i]); } } @@ -150,7 +116,7 @@ public class FormParaPane extends JPanel { // ... continue; } - if (!XCreatorUtils.createXCreator(widget).canEnterIntoParaPane()){ + if (!XCreatorUtils.createXCreator(widget).canEnterIntoParaPane()) { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } @@ -172,17 +138,15 @@ public class FormParaPane extends JPanel { private void initParaButtons() { - if(componentsList4Para.isEmpty()) { + if (componentsList4Para.isEmpty()) { WidgetOption[] options = WidgetOption.getReportParaWidgetIntance(); - WidgetOption[] basicWidgetArray = (WidgetOption[]) ArrayUtils.addAll( + WidgetOption[] basicWidgetArray = ArrayUtils.addAll( options, ExtraDesignClassManager.getInstance().getParameterWidgetOptions() ); - for (WidgetOption no : basicWidgetArray) { - this.componentsList4Para.add(no); - } + Collections.addAll(this.componentsList4Para, basicWidgetArray); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 57e49780cf..27df0600e5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -17,6 +17,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.share.ComponentShareUtil; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; @@ -44,10 +45,6 @@ import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.SwingConstants; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; @@ -58,11 +55,15 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; /** * @author null */ -public class FormParaWidgetPane extends JPanel { +public class FormParaWidgetPane extends UIToolbar { private static FormParaWidgetPane THIS; private final static int BORDER = 5; private final static int WIDGET_WIDTHGAP = 4; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java b/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java index 948796f494..dcdff4e1fc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java @@ -1,15 +1,14 @@ package com.fr.design.mainframe; -import java.util.ArrayList; - - -import com.fr.base.svg.IconUtils; +import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.itable.PropertyGroup; -import com.fr.design.designer.properties.WidgetPropertyTable; +import com.fr.design.i18n.Toolkit; import com.fr.form.parameter.FormSubmitButton; +import java.util.ArrayList; + public class FormTargetMode extends FormDesignerModeForSpecial { @@ -22,8 +21,8 @@ public class FormTargetMode extends FormDesignerModeForSpecial { */ public WidgetOption[] getPredefinedWidgetOptions() { return new WidgetOption[]{ - WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), - "/com/fr/web/images/form/resources/preview_16", FormSubmitButton.class)}; + WidgetOptionFactory.createByWidgetClass(Toolkit.i18nText("Fine-Design_Form_Query_Button"), + "preview", FormSubmitButton.class)}; } public ArrayList createRootDesignerPropertyGroup() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java index 7f1304d3a1..8a33aa3c0f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java @@ -1,10 +1,14 @@ package com.fr.design.mainframe; +import com.fr.design.gui.core.WidgetOption; +import com.fr.stable.os.OperatingSystem; + +import javax.swing.JPanel; +import javax.swing.JWindow; import java.awt.AWTEvent; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; -import java.awt.Graphics; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.Point; @@ -12,137 +16,122 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; -import javax.swing.JPanel; -import javax.swing.JWindow; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.core.WidgetOption; -import com.fr.stable.os.OperatingSystem; //august: public class FormWidgetPopWindow extends JWindow { - private WidgetOption[] options; - private EditorChoosePane pane; - public FormWidgetPopWindow() { - super(); - } - - private void initComp() { - if(pane != null) { - this.remove(pane); - } - pane = new EditorChoosePane(); - this.getContentPane().add(pane); - this.setSize(pane.getPreferredSize()); - } - - public void showToolTip(int xAbs, int yAbs, WidgetOption[] options) { - Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); - this.setLocation(xAbs, yAbs); - this.options = options; - initComp(); - this.setVisible(true); - this.doLayout(); - } - - private AWTEventListener awt = new AWTEventListener() { - public void eventDispatched(AWTEvent event) { - if (event instanceof MouseEvent) { - MouseEvent mv = (MouseEvent) event; - if (mv.getClickCount() > 0) { - hideWindow(mv); - } - } - } - }; - - private void hideWindow(MouseEvent mv){ - Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY()); - if (OperatingSystem.isWindows()) { - if (!FormWidgetPopWindow.this.contains(point)) { - FormWidgetPopWindow.this.setVisible(false); - } - }else if(OperatingSystem.isMacos() || OperatingSystem.isLinux()){ - Dimension d = FormWidgetPopWindow.this.getSize(); - Point p = FormWidgetPopWindow.this.getLocation(); - Rectangle rect = new Rectangle(p, d); - if (!rect.contains(point)) { - FormWidgetPopWindow.this.setVisible(false); - } - } - } - - private class EditorChoosePane extends JPanel { - public EditorChoosePane() { - super(); - this.setLayout(new EditorLayout()); - this.initComponents(); - } - - @Override - public void paintComponent(Graphics g) { - Rectangle r = this.getBounds(); - g.setColor(UIConstants.NORMAL_BACKGROUND); - g.fillRoundRect(r.x, r.y, r.width, r.height, UIConstants.ARC, UIConstants.ARC); - g.setColor(UIConstants.LINE_COLOR); - g.drawRoundRect(r.x, r.y, r.width - 1, r.height - 1, UIConstants.ARC, UIConstants.ARC); - } - - protected void initComponents() { - for (WidgetOption o : options) { - ToolBarButton toolBarButton = new ToolBarButton(o); - this.add(toolBarButton); - } - } - } - - private static class EditorLayout implements LayoutManager { - - int top = 4; - int left = 4; - int right = 4; - int bottom = 4; - int hgap = 5; - int vgap = 4; - int maxLine = 8; - - @Override - public void addLayoutComponent(String name, Component comp) { - - } - - @Override - public void layoutContainer(Container target) { - synchronized (target.getTreeLock()) { - Insets insets = target.getInsets(); - int nmembers = target.getComponentCount(); - for (int i = 0; i < nmembers; i++) { - Component m = target.getComponent(i); - if (m.isVisible()) { - Dimension d = m.getPreferredSize(); - m.setBounds(insets.left + left + i % maxLine * (hgap + d.width), top + insets.top + i / maxLine - * (vgap + d.height), d.width, d.height); - } - } - } - } - - @Override - public Dimension minimumLayoutSize(Container parent) { - return new Dimension(0, 0); - } - - @Override - public Dimension preferredLayoutSize(Container parent) { - Insets insets = parent.getInsets(); - int nmembers = parent.getComponentCount(); - return new Dimension(maxLine * 28 + insets.left + insets.right + right + left, (nmembers / maxLine + 1) - * 24 + insets.top + insets.bottom + top + bottom); - } - - @Override - public void removeLayoutComponent(Component comp) { - - } - - } + private WidgetOption[] options; + private EditorChoosePane pane; + + public FormWidgetPopWindow() { + super(); + } + + private void initComp() { + if (pane != null) { + this.remove(pane); + } + pane = new EditorChoosePane(); + this.getContentPane().add(pane); + this.setSize(pane.getPreferredSize()); + } + + public void showToolTip(int xAbs, int yAbs, WidgetOption[] options) { + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + this.setLocation(xAbs, yAbs); + this.options = options; + initComp(); + this.setVisible(true); + this.doLayout(); + } + + private final AWTEventListener awt = event -> { + if (event instanceof MouseEvent) { + MouseEvent mv = (MouseEvent) event; + if (mv.getClickCount() > 0) { + hideWindow(mv); + } + } + }; + + private void hideWindow(MouseEvent mv) { + Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY()); + if (OperatingSystem.isWindows()) { + if (!FormWidgetPopWindow.this.contains(point)) { + FormWidgetPopWindow.this.setVisible(false); + } + } else if (OperatingSystem.isMacos() || OperatingSystem.isLinux()) { + Dimension d = FormWidgetPopWindow.this.getSize(); + Point p = FormWidgetPopWindow.this.getLocation(); + Rectangle rect = new Rectangle(p, d); + if (!rect.contains(point)) { + FormWidgetPopWindow.this.setVisible(false); + } + } + } + + private class EditorChoosePane extends JPanel { + public EditorChoosePane() { + super(); + this.setLayout(new EditorLayout()); + this.initComponents(); + } + + protected void initComponents() { + for (WidgetOption o : options) { + ToolBarButton toolBarButton = new ToolBarButton(o); + this.add(toolBarButton); + } + } + } + + private static class EditorLayout implements LayoutManager { + + int top = 4; + int left = 4; + int right = 4; + int bottom = 4; + int hgap = 5; + int vgap = 4; + int maxLine = 8; + + @Override + public void addLayoutComponent(String name, Component comp) { + + } + + @Override + public void layoutContainer(Container target) { + synchronized (target.getTreeLock()) { + Insets insets = target.getInsets(); + int nmembers = target.getComponentCount(); + for (int i = 0; i < nmembers; i++) { + Component m = target.getComponent(i); + if (m.isVisible()) { + Dimension d = m.getPreferredSize(); + m.setBounds(insets.left + left + i % maxLine * (hgap + d.width), top + insets.top + i / maxLine + * (vgap + d.height), d.width, d.height); + } + } + } + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + return new Dimension(0, 0); + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + Insets insets = parent.getInsets(); + int nmembers = parent.getComponentCount(); + return new Dimension(maxLine * 28 + insets.left + insets.right + right + left, (nmembers / maxLine + 1) + * 24 + insets.top + insets.bottom + top + bottom); + } + + @Override + public void removeLayoutComponent(Component comp) { + + } + + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 34603c59e0..6f231c5a10 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -759,10 +759,10 @@ public class JForm extends JTemplate implements BaseJForm= 2) { - } - } - - - public void mousePressed(MouseEvent e) { - lastPressEvent = e; - } - - public void mouseReleased(MouseEvent e) { - } - - @Override - public void mouseDragged(MouseEvent e) { - if (!isEnabled()) { - return; - } - - if (DesignerMode.isAuthorityEditing()) { - return; - } - if (lastPressEvent == null) { - return; - } - getModel().setPressed(false); - getModel().setSelected(false); - getModel().setRollover(false); - - Object source = e.getSource(); - Widget creatorSource = null; - if (source instanceof ToolBarButton) { - ToolBarButton no = (ToolBarButton) e.getSource(); - if (no == null) { - return; - } - creatorSource = no.getNameOption().createWidget(); - } - if (creatorSource != null) { - XCreator xCreator = XCreatorUtils.createThemedXCreator(creatorSource); - WidgetToolBarPane.getTarget().startDraggingNewWidget(xCreator, lastPressEvent, e); - FormDesignerUtils.addWidgetProcessInfo(xCreator.toData()); - lastPressEvent = null; - this.setBorder(null); - } - } - - @Override - public void mouseMoved(MouseEvent e) { - } - - public class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { - private DragSource source; - - public DragAndDropDragGestureListener(ToolBarButton tt, int actions) { - source = new DragSource(); - source.createDefaultDragGestureRecognizer(tt, actions, this); - } - - public void dragGestureRecognized(DragGestureEvent dge) { - ToolBarButton toolBarButton = (ToolBarButton) dge.getComponent(); - if (toolBarButton != null) { - Widget widget = toolBarButton.getNameOption().createWidget(); - DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget); - dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this); - } - } - - @Override - public void dragEnter(DragSourceDragEvent dragSourceDragEvent) { - - } - } - - public class DragAndDropTransferable implements Transferable { - private Widget widget; - - public DragAndDropTransferable(Widget widget) { - this.widget = widget; - } - - DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")}; - - public DataFlavor[] getTransferDataFlavors() { - return flavors; - } - - public boolean isDataFlavorSupported(DataFlavor flavor) { - for (DataFlavor df : flavors) { - if (ComparatorUtils.equals(df, flavor)) { - return true; - } - } - return false; - } - - public Object getTransferData(DataFlavor df) throws UnsupportedFlavorException, IOException { - return widget; - } - } - - @Override - public void mouseEntered(MouseEvent e) { - - - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public ButtonUI getUI() { - return new UIForbiddenButtonUI(); - } - - @Override - public boolean isEnabled() { - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - boolean enable = true; - if (template != null) { - enable = super.isEnabled() && template.checkEnable(); - } - return enable; - } + private WidgetOption no; + private MouseEvent lastPressEvent; + + public ToolBarButton(WidgetOption no) { + super(no.optionIcon()); + this.no = no; + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.setToolTipText(no.optionName()); + this.setRequestFocusEnabled(false); + putClientProperty(FineClientProperties.BUTTON_TYPE, FineClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON); + // FormEditor那边用的DND的复杂方式 这边还必须也用,不然就方便多了 + new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); + } + + public WidgetOption getNameOption() { + return this.no; + } + + public void setNameOption(WidgetOption no) { + this.no = no; + } + + + public void mouseClicked(MouseEvent e) { + if (e.getClickCount() >= 2) { + } + } + + + public void mousePressed(MouseEvent e) { + lastPressEvent = e; + } + + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseDragged(MouseEvent e) { + if (!isEnabled()) { + return; + } + + if (DesignerMode.isAuthorityEditing()) { + return; + } + if (lastPressEvent == null) { + return; + } + getModel().setPressed(false); + getModel().setSelected(false); + getModel().setRollover(false); + + Object source = e.getSource(); + Widget creatorSource = null; + if (source instanceof ToolBarButton) { + ToolBarButton no = (ToolBarButton) e.getSource(); + if (no == null) { + return; + } + creatorSource = no.getNameOption().createWidget(); + } + if (creatorSource != null) { + XCreator xCreator = XCreatorUtils.createThemedXCreator(creatorSource); + WidgetToolBarPane.getTarget().startDraggingNewWidget(xCreator, lastPressEvent, e); + FormDesignerUtils.addWidgetProcessInfo(xCreator.toData()); + lastPressEvent = null; + } + } + + @Override + public void mouseMoved(MouseEvent e) { + } + + public class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { + private DragSource source; + + public DragAndDropDragGestureListener(ToolBarButton tt, int actions) { + source = new DragSource(); + source.createDefaultDragGestureRecognizer(tt, actions, this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + ToolBarButton toolBarButton = (ToolBarButton) dge.getComponent(); + if (toolBarButton != null) { + Widget widget = toolBarButton.getNameOption().createWidget(); + DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget); + dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this); + } + } + + @Override + public void dragEnter(DragSourceDragEvent dragSourceDragEvent) { + + } + } + + public class DragAndDropTransferable implements Transferable { + private Widget widget; + + public DragAndDropTransferable(Widget widget) { + this.widget = widget; + } + + DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")}; + + public DataFlavor[] getTransferDataFlavors() { + return flavors; + } + + public boolean isDataFlavorSupported(DataFlavor flavor) { + for (DataFlavor df : flavors) { + if (ComparatorUtils.equals(df, flavor)) { + return true; + } + } + return false; + } + + public Object getTransferData(DataFlavor df) throws UnsupportedFlavorException, IOException { + return widget; + } + } + + @Override + public void mouseEntered(MouseEvent e) { + + + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public boolean isEnabled() { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + boolean enable = true; + if (template != null) { + enable = super.isEnabled() && template.checkEnable(); + } + return enable; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index d82bda4659..f2f47935c7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -928,7 +928,7 @@ public class JWorkBook extends JTemplate { * @return 表单工具栏 */ @Override - public JPanel[] toolbarPanes4Form() { + public JComponent[] toolbarPanes4Form() { if (centerPane.isUpEditMode() && hasParameterPane()) { return parameterPane.toolbarPanes4Form(); } diff --git a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java index 049761417d..75ece02086 100644 --- a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java @@ -541,7 +541,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus * * @return 返回工具 */ - public JPanel[] toolbarPanes4Form() { + public JComponent[] toolbarPanes4Form() { return paraDesignEditor.toolbarPanes4Form(); } diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 91c5d8e542..2f63cb62b3 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -406,20 +406,21 @@ public class MainDesigner extends BaseDesigner { } } - if (plus.toolbarPanes4Form().length == 0) { - return super.resetToolBar(toolbarComponent, plus); - } else { - JPanel toolbarPane; - toolbarPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, TOOLBARPANEVGAP)); - Dimension dim = new Dimension(); - dim.height = plus.getToolBarHeight(); - toolbarPane.setPreferredSize(dim); - toolbarPane.setFocusable(true); - JPanel[] paneArray = plus.toolbarPanes4Form(); - for (int i = 0; i < paneArray.length; i++) { - toolbarPane.add(paneArray[i]); + switch (plus.toolbarPanes4Form().length) { + case 0: + return super.resetToolBar(toolbarComponent, plus); + case 1: + return plus.toolbarPanes4Form()[0]; + default: { + JPanel toolbarPane; + toolbarPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); + toolbarPane.setFocusable(true); + JComponent[] paneArray = plus.toolbarPanes4Form(); + for (JComponent component : paneArray) { + toolbarPane.add(component); + } + return toolbarPane; } - return toolbarPane; } } From 5f3b2401aee651de9d4ee16c7596ea4a50e7ee1e Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 9 Jan 2024 19:59:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parameter/ParameterDesignerProvider.java | 5 +++ .../com/fr/design/mainframe/FormParaPane.java | 13 +++--- .../design/mainframe/FormParaWidgetPane.java | 4 ++ .../design/mainframe/FormWidgetPopWindow.java | 3 ++ .../fr/design/mainframe/ToolBarButton.java | 43 +++++++++++++------ 5 files changed, 51 insertions(+), 17 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java index c5dbd1ae84..12f4707032 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java @@ -54,6 +54,11 @@ public interface ParameterDesignerProvider { return 0; } + /** + * 参数界面工具栏 + * + * @return 工具栏组件 + */ JComponent[] toolbarPanes4Form(); JComponent[] toolBarButton4Form(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index a683e3f7d4..8677b27096 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -27,13 +27,13 @@ import java.util.Iterator; import java.util.List; /** - * Created with IntelliJ IDEA. - * User: zx - * Date: 14-7-8 - * Time: 上午10:09 * To change this template use File | Settings | File Templates. + * + * @author zx + * @since 7.0 + * Created on 14-7-8 + * Time: 上午10:09 */ - public class FormParaPane extends UIToolbar { private static final int TOOLTIP_X = 5; @@ -57,6 +57,9 @@ public class FormParaPane extends UIToolbar { }, context -> context.contain(PluginModule.ExtraDesign)); } + /** + * 单例。不合适,下次重构 + */ public static FormParaPane getInstance(FormDesigner designer) { if (THIS == null) { THIS = new FormParaPane(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 27df0600e5..33eae2a9f2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -61,7 +61,11 @@ import java.util.Iterator; import java.util.List; /** + * 参数面板控件工具栏 + * * @author null + * @since 7.0 + * Created on 2008 */ public class FormParaWidgetPane extends UIToolbar { private static FormParaWidgetPane THIS; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java index 8a33aa3c0f..e29548e57b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java @@ -35,6 +35,9 @@ public class FormWidgetPopWindow extends JWindow { this.setSize(pane.getPreferredSize()); } + /** + * 展示提示 + */ public void showToolTip(int xAbs, int yAbs, WidgetOption[] options) { Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); this.setLocation(xAbs, yAbs); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java index d3ca5b0423..6229d3c6a0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ToolBarButton.java @@ -19,15 +19,18 @@ import java.awt.dnd.DragGestureEvent; import java.awt.dnd.DragGestureListener; import java.awt.dnd.DragSource; import java.awt.dnd.DragSourceAdapter; -import java.awt.dnd.DragSourceDragEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.IOException; import java.io.Serializable; -/* - *august: 控件按钮 +/** + * 控件按钮 + * + * @author august + * @since 7.0 + * Created on 2008 */ public class ToolBarButton extends UIButton implements MouseListener, MouseMotionListener, Serializable { @@ -46,25 +49,36 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); } + /** + * 获取控件配置 + * + * @return 控件配置 + */ public WidgetOption getNameOption() { return this.no; } + /** + * 设置控件配置 + * + * @param no 控件配置 + */ public void setNameOption(WidgetOption no) { this.no = no; } + @Override public void mouseClicked(MouseEvent e) { - if (e.getClickCount() >= 2) { - } - } + } + @Override public void mousePressed(MouseEvent e) { lastPressEvent = e; } + @Override public void mouseReleased(MouseEvent e) { } @@ -105,7 +119,10 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio public void mouseMoved(MouseEvent e) { } - public class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { + /** + * 拖放拖动手势侦听器 + */ + public static class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { private DragSource source; public DragAndDropDragGestureListener(ToolBarButton tt, int actions) { @@ -113,6 +130,7 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio source.createDefaultDragGestureRecognizer(tt, actions, this); } + @Override public void dragGestureRecognized(DragGestureEvent dge) { ToolBarButton toolBarButton = (ToolBarButton) dge.getComponent(); if (toolBarButton != null) { @@ -122,13 +140,12 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio } } - @Override - public void dragEnter(DragSourceDragEvent dragSourceDragEvent) { - - } } - public class DragAndDropTransferable implements Transferable { + /** + * 拖放转换器 + */ + public static class DragAndDropTransferable implements Transferable { private Widget widget; public DragAndDropTransferable(Widget widget) { @@ -137,10 +154,12 @@ public class ToolBarButton extends UIButton implements MouseListener, MouseMotio DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")}; + @Override public DataFlavor[] getTransferDataFlavors() { return flavors; } + @Override public boolean isDataFlavorSupported(DataFlavor flavor) { for (DataFlavor df : flavors) { if (ComparatorUtils.equals(df, flavor)) {