From aae3af92dfaf930e8ac8cbf8e0f43f4a5f5759df Mon Sep 17 00:00:00 2001 From: renekton Date: Mon, 5 Aug 2024 21:37:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E7=AE=A1=E7=90=86/=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=A1=AB=E6=8A=A5=E5=B1=9E=E6=80=A7/=E8=B6=85?= =?UTF-8?q?=E7=BA=A7=E9=93=BE=E6=8E=A5/=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/utils/FineUIStyle.java | 2 + .../fr/env/detect/ui/EnvDetectorDialog.java | 27 +------ .../light/ui/laf/FineLightLaf.properties | 7 +- .../fr/design/module/ChartHyperlinkGroup.java | 8 +-- .../mainframe/CellWidgetPropertyPane.java | 2 +- .../fr/design/widget/CellWidgetCardPane.java | 70 +++++++++++-------- .../design/widget/EastCellWidgetCardPane.java | 55 +++++++++++++++ .../com/fr/design/widget/ValueWidgetPane.java | 29 ++++---- .../java/com/fr/design/widget/WidgetPane.java | 9 ++- .../widget/ui/DateEditorDefinePane.java | 44 ++++++------ .../fr/start/module/DesignerActivator.java | 12 ++-- 11 files changed, 164 insertions(+), 101 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index d7cee71f4b..f701fc6ced 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -41,6 +41,8 @@ public interface FineUIStyle { String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String TRANSPARENT_TEXT_FIELD = "transparentTextField"; + String ENV_DECTETOR_BUTTON = "envDetectorButton"; + /** * 添加组件的样式类,类似css,该方法会接在原样式后方 diff --git a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java index fbd4e7f0a1..c23b39ce44 100644 --- a/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java +++ b/designer-base/src/main/java/com/fr/env/detect/ui/EnvDetectorDialog.java @@ -146,27 +146,9 @@ public class EnvDetectorDialog extends JDialog { JPanel headerPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); headerPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 12, 0)); - this.detectButton = new UIToggleButton(buttonStatus.getDesc()) { - @Override - public ButtonUI getUI() { - - return new UIButtonUI() { - @Override - protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { - if (isPressed(b) && b.isPressedPainted()) { - GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), - DesignerColor.Button.Primary.PRESSED); - } else if (isRollOver(b)) { - GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), - DesignerColor.Button.Primary.HOVER); - } else if (b.isNormalPainted()) { - GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), - DesignerColor.Button.Primary.NORMAL); - } - } - }; - } - }; + this.detectButton = new UIButton(buttonStatus.getDesc()); + FineUIStyle.setStyle(detectButton, FineUIStyle.ENV_DECTETOR_BUTTON); + detectButton.setForeground(FineUIUtils.getUIColor("background.normal", "background.normal")); detectButton.setToolTipText(buttonStatus.getDesc()); detectButton.addActionListener(event -> { if (buttonStatus.isNotExecuting()) { @@ -175,9 +157,6 @@ public class EnvDetectorDialog extends JDialog { stopDetecting(detectButton); } }); - detectButton.setForeground(FineUIUtils.getUIColor("background.normal", "background.normal")); - detectButton.setBackground(FineUIUtils.getUIColor("EnvDetectorButton.background", "EnvDetectorButton.background")); - headerPanel.add(detectButton, BorderLayout.WEST); UILabel openUtilBoxLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Carton_Feedback_ToolBox")); diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index eabd62e110..d7d205bf0d 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -222,7 +222,6 @@ CombinationButton.background = $Button.background CombinationButton.borderColor = $Component.borderColor CombinationButton.arc = $Button.arc -EnvDetecorButton.background = #FF419BF9 #---- CheckBox ---- CheckBox.arc = 4 @@ -1322,4 +1321,8 @@ CellOtherSetPane.height=$Component.defaultHeight pressedBackground : null [style]ToggleButton.compactButton = \ - margin: 2,0,2,0 \ No newline at end of file + margin: 2,0,2,0 + +[style]Button.envDetectorButton = \ + foreground: #FFF; \ + background: #2576EF \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java index ab5a923ca8..16959512bd 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java @@ -42,10 +42,10 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup { FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); NameableCreator[] related4ChartHyper = { - new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), new LazyIcon("cellHyperLinkAttr"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class), - new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), new LazyIcon("cellHyperLinkAttr"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class), - new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float"), new LazyIcon("cellHyperLinkAttr"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class), - new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), new LazyIcon("cellHyperLinkAttr"), formHyperlink.getClass(), FormHyperlinkPane.class)}; + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float_Chart"), ChartHyperPoplink.class, ChartHyperPoplinkPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Cell"), ChartHyperRelateCellLink.class, ChartHyperRelateCellLinkPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Float"), ChartHyperRelateFloatLink.class, ChartHyperRelateFloatLinkPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hyperlink_Form_Link"), formHyperlink.getClass(), FormHyperlinkPane.class)}; return ArrayUtils.addAll(super.getHyperlinkCreators(), related4ChartHyper); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java index f0ff751f17..527e3cdfc6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -81,7 +81,7 @@ public class CellWidgetPropertyPane extends BasicPane { public void reInit(ElementCasePane ePane) { this.ePane = ePane; - cellEditorDefPane = new WidgetPane(ePane); + cellEditorDefPane = new WidgetPane(ePane, true); this.removeAll(); this.add(cellEditorDefPane, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java index 71dbd52603..e23b7e08c6 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java @@ -1,12 +1,13 @@ package com.fr.design.widget; -import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.fine.swing.ui.layout.BaseLayoutContainer; import com.fr.design.border.FineBorderFactory; import com.fr.design.data.DataCreatorUI; import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.FineTabbedPane; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; @@ -18,6 +19,7 @@ import com.fr.form.ui.Widget; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Component; import java.util.ArrayList; import static com.fine.swing.ui.layout.Layouts.cell; @@ -34,9 +36,7 @@ public class CellWidgetCardPane extends BasicPane { private WidgetMobilePane currentWidgetMobilePane; //属性配置切换面板 private ArrayList paneList; - private JPanel center; - private UIHeadGroup tabsHeaderIconPane; - private CardLayout tabbedPane; + private BaseLayoutContainer tabsHeaderIconPane; private BasicWidgetPropertySettingPane widgetPropertyPane; //通用属性容器 @@ -64,23 +64,29 @@ public class CellWidgetCardPane extends BasicPane { this.removeAll(); this.setLayout(FRGUIPaneFactory.createBorderLayout()); - tabbedPane = new CardLayout(); - center = new JPanel(tabbedPane); final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; - tabsHeaderIconPane = new UIHeadGroup(tabTitles) { - @Override - public void tabChanged(int index) { - tabbedPane.show(center, tabTitles[index]); - } - }; - JPanel wrapperPane = new JPanel(new BorderLayout()); - wrapperPane.add(tabsHeaderIconPane, BorderLayout.NORTH); - wrapperPane.add(center, BorderLayout.CENTER); - wrapperPane.setBorder(new ScaledEmptyBorder(0, 10, 0, 10)); - this.add(wrapperPane, BorderLayout.CENTER); + Component component = initTabPane(); + + initTabHead(tabTitles, component); + + this.add(tabsHeaderIconPane, BorderLayout.CENTER); + + initPaneList(); + + } + + private void initTabHead(String[] tabTitles, Component component) { + tabsHeaderIconPane = FineTabbedPane.builder() + .addTab(tabTitles[0], component) + .addTab(tabTitles[1], eventTabPane) + .addTab(tabTitles[2], mobileTabPane) + .withHeadRatio(1.0f) + .build(); + } + protected Component initTabPane() { // 属性 attriTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); BasicScrollPane basicScrollPane = new AttrScrollPane() { @@ -95,9 +101,9 @@ public class CellWidgetCardPane extends BasicPane { attriCardLayout = (CardLayout) attriCardPane.getLayout(); attriTabPane.add(column( - cell(basicPane), - fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), - cell(attriCardPane) + cell(basicPane), + fix(1).with(it -> it.setBorder(FineBorderFactory.createDefaultUnderlineBorder())), + cell(attriCardPane) ).getComponent() ); @@ -112,14 +118,10 @@ public class CellWidgetCardPane extends BasicPane { mobileTabPane.add(mobileCardPane, BorderLayout.CENTER); mobileCardLayout = (CardLayout) mobileCardPane.getLayout(); - center.add(basicScrollPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute")); - center.add(eventTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event")); - center.add(mobileTabPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")); - initPaneList(); - + return basicScrollPane; } - private void initPaneList() { + protected void initPaneList() { paneList = new ArrayList(); paneList.add(attriTabPane); paneList.add(eventPane); @@ -137,7 +139,10 @@ public class CellWidgetCardPane extends BasicPane { public void populate(Widget cellWidget) { initComponents(pane); + populateWidget(cellWidget); + } + protected void populateWidget(Widget cellWidget) { WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() { @Override public void did(DataCreatorUI ui, String cardName) { @@ -160,8 +165,9 @@ public class CellWidgetCardPane extends BasicPane { mobileCardLayout.show(mobileCardPane, mobilePane.getClass().toString()); currentWidgetMobilePane = mobilePane; - - tabsHeaderIconPane.setSelectedIndex(0); + if (tabsHeaderIconPane instanceof UIHeadGroup) { + ((UIHeadGroup) tabsHeaderIconPane).setSelectedIndex(0); + } } public Widget update() { @@ -195,4 +201,12 @@ public class CellWidgetCardPane extends BasicPane { eventPane.checkValid(); } + protected JPanel getEventTabPane() { + return this.eventTabPane; + } + + protected JPanel getMobileTabPane() { + return this.mobileTabPane; + } + } diff --git a/designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java b/designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java new file mode 100644 index 0000000000..8cb980e78c --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/widget/EastCellWidgetCardPane.java @@ -0,0 +1,55 @@ +package com.fr.design.widget; + +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.form.ui.Widget; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; + +public class EastCellWidgetCardPane extends CellWidgetCardPane { + + private CardLayout tabbedPane; + + private JPanel center; + + private UIHeadGroup tabsHeaderIconPane; + + public EastCellWidgetCardPane(ElementCasePane pane) { + super(pane); + } + + private void initComponents() { + + this.removeAll(); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.tabbedPane = new CardLayout(); + center = new JPanel(tabbedPane); + this.add(center, BorderLayout.CENTER); + final String[] tabTitles = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")}; + tabsHeaderIconPane = new UIHeadGroup(tabTitles) { + @Override + public void tabChanged(int index) { + tabbedPane.show(center, tabTitles[index]); + } + }; + tabsHeaderIconPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.SHADOW_GREY)); + this.add(tabsHeaderIconPane, BorderLayout.NORTH); + Component component = initTabPane(); + center.add(component, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Attribute")); + center.add(getEventTabPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event")); + center.add(getMobileTabPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal")); + initPaneList(); + } + + public void populate(Widget cellWidget) { + initComponents(); + super.populateWidget(cellWidget); + } + +} diff --git a/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java index b941b02efa..cfdbf9e21f 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ValueWidgetPane.java @@ -4,16 +4,17 @@ import javax.swing.*; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.widget.editors.WidgetValueEditor; import com.fr.form.ui.DataControl; import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetValue; - -import java.awt.*; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; public class ValueWidgetPane extends WidgetPane { private JPanel widgetValuePane; @@ -27,18 +28,20 @@ public class ValueWidgetPane extends WidgetPane { public JPanel initNorthPane(){ JPanel northPane = super.initNorthPane(); - label = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")+ ":"); + label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Value")); label.setVisible(false); widgetValuePane = new JPanel(); widgetValuePane.setLayout(FRGUIPaneFactory.createBorderLayout()); - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, p, f}; - double[] rowSize = {p}; - Component[][] components = new Component[][]{ - new Component[]{northPane, label,widgetValuePane}, - }; - JPanel jPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel jPanel = new JPanel(FRGUIPaneFactory.createBorderLayout()); + jPanel.add(column(10, + cell(northPane), + column( + row( + cell(label).weight(LEFT_WEIGHT), + cell(widgetValuePane).weight(RIGHT_WEIGHT) + ) + ) + ).getComponent()); return jPanel; } diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java index 80ba33ef26..1887a4007c 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetPane.java @@ -50,6 +50,8 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener private boolean shouldFireSelectedEvent = true; private JComponent northPane; + private boolean eastRegion = false; + public WidgetPane() { this(null); } @@ -61,6 +63,11 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener this.initComponents(pane); } + public WidgetPane(ElementCasePane pane, boolean eastRegion) { + this.eastRegion = eastRegion; + this.initComponents(pane); + } + public boolean isShouldFireSelectedEvent(){ return shouldFireSelectedEvent; @@ -97,7 +104,7 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener } protected CellWidgetCardPane initWidgetCardPane(ElementCasePane pane) { - return new CellWidgetCardPane(pane); + return eastRegion ? new EastCellWidgetCardPane(pane) : new CellWidgetCardPane(pane); } protected JPanel createContentPane() { diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java index d1ecaeca5c..c5e0abec75 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -1,16 +1,14 @@ package com.fr.design.widget.ui; +import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.fr.base.FRContext; import com.fr.data.core.FormatField; import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; -import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.UIComboBoxNoArrow; import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; @@ -31,6 +29,12 @@ import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import java.util.Date; +import static com.fine.swing.ui.layout.Layouts.column; +import static com.fine.swing.ui.layout.Layouts.row; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fr.design.constants.LayoutConstants.LEFT_WEIGHT; +import static com.fr.design.constants.LayoutConstants.RIGHT_WEIGHT; + public class DateEditorDefinePane extends DirectWriteEditorDefinePane { private UIButtonGroup returnTypeComboBox; @@ -57,27 +61,22 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane