diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java index 4e47d1587e..615a44f581 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java @@ -2,11 +2,19 @@ package com.fine.theme.light.ui; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineClientProperties; +import com.formdev.flatlaf.ui.FlatMenuItemRenderer; import com.formdev.flatlaf.ui.FlatMenuItemUI; +import javax.swing.Icon; import javax.swing.JComponent; +import javax.swing.JMenuItem; import javax.swing.plaf.ComponentUI; +import java.awt.Color; + +import java.awt.Font; + import java.awt.Graphics; +import java.awt.Rectangle; /** * menuItem UI类 @@ -29,6 +37,11 @@ public class FineMenuItemUI extends FlatMenuItemUI { return new FineMenuItemUI(); } + @Override + protected FlatMenuItemRenderer createRenderer() { + return new FineMenuItemRenderer(menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter); + } + @Override public void paint(Graphics g, JComponent c) { super.paint(g, c); @@ -40,4 +53,28 @@ public class FineMenuItemUI extends FlatMenuItemUI { icon.paintIcon(c, g, c.getWidth() - rightMargin - iconSize, (c.getHeight() - iconSize) / 2); } } + + static class FineMenuItemRenderer extends FlatMenuItemRenderer { + protected FineMenuItemRenderer(JMenuItem menuItem, Icon checkIcon, Icon arrowIcon, + Font acceleratorFont, String acceleratorDelimiter ) + { + super(menuItem, checkIcon, arrowIcon, acceleratorFont, acceleratorDelimiter); + } + + @Override + protected void paintText( Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground ) { + if (!isTopLevelMenu(menuItem) && menuItem.getIcon() == null) { + textRect.x -= minimumIconSize.width; + } + super.paintText(g, textRect, text, selectionForeground, disabledForeground); + } + + @Override + protected void paintIcon(Graphics g, Rectangle iconRect, Icon icon, Color checkBackground, Color selectionBackground) { + if (menuItem.getIcon() != null) { + super.paintIcon(g, iconRect, icon, checkBackground, selectionBackground); + } + } + + } } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java index 0a8e4769a9..979c3f973f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -1,12 +1,17 @@ package com.fr.design.gui.frpane; +import com.fine.theme.utils.FineUIScale; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.border.FineBorderFactory; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.module.DesignModuleFactory; +import com.fr.design.widget.FRWidgetFactory; import com.fr.general.GeneralContext; import com.fr.general.NameObject; @@ -20,10 +25,16 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.ListMap; import com.fr.stable.Nameable; +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; import java.util.ArrayList; import java.util.Map; import java.util.Set; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * 超级链接 界面. * @@ -91,6 +102,19 @@ public abstract class HyperlinkGroupPane extends UIListControlPane { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_Hyperlink"); } + @Override + protected JPanel getLeftTopPane(UIToolbar topToolBar) { + return row(10, + cell(FRWidgetFactory.createLineWrapLabel(getAddItemText())), + cell(topToolBar).with(it -> { + it.setPreferredSize(new Dimension(0, FineUIScale.scale(24))); + it.setBorderPainted(true); + it.setBorder(FineBorderFactory.createWrappedRoundBorder()); + it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + }).weight(1.0) + ).getComponent(); + } + public void populate(NameJavaScriptGroup hyperlinkArray) { java.util.List list = new ArrayList<>(); if (hyperlinkArray != null) { diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java index bec751e26a..6f8589a104 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java @@ -21,6 +21,7 @@ import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.MenuSelectionManager; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.PopupMenuListener; @@ -358,7 +359,9 @@ public class FRTreeComboBox extends UIComboBox { public TreePopup(JComboBox comboBox) { this.comboBox = (FRTreeComboBox) comboBox; - this.setBorder(BorderFactory.createLineBorder(Color.black)); + this.setBackground(UIManager.getColor("PopupMenu.background")); + + this.setBorder(UIManager.getBorder( "PopupMenu.border" )); this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLightWeightPopupEnabled(comboBox .isLightWeightPopupEnabled()); diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java index 78f0ae06fa..e85284c717 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java @@ -43,7 +43,7 @@ public class UIMenuEastAttrItem extends JMenuItem { @Override public String getText() { - return StringUtils.BLANK + super.getText(); + return super.getText(); } private class UIMenuItemEastAttrUI extends BasicMenuItemUI { diff --git a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java index 3bd408b90c..38cc90db87 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -70,12 +70,10 @@ public class NumberEditorValidatePane extends JPanel { this.allowNegativeCheckBox.addActionListener(allowNegativeListener); this.setMaxValueCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Need_Max_Value"), false); this.maxValueSpinner = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1D, 0D); - this.maxValueSpinner.setSize(this.decimalLength.getSize()); this.setMaxValueCheckBox.addActionListener(setMaxListener); this.maxValueSpinner.addChangeListener(maxValueChangeListener); this.setMinValueCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Need_Min_Value"), false); this.minValueSpinner = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1D, 0D); - this.minValueSpinner.setSize(this.decimalLength.getSize()); this.setMinValueCheckBox.addActionListener(setMinListener); this.minValueSpinner.addChangeListener(minValueChangeListener); initErrorMsgPane(); @@ -92,11 +90,11 @@ public class NumberEditorValidatePane extends JPanel { cell(allowDecimalsCheckBox), cell(limitNumberPane), cell(allowNegativeCheckBox), - row( - cell(setMaxValueCheckBox).weight(1.2), cell(maxValueSpinner).weight(3) + row(10, + cell(setMaxValueCheckBox).weight(1.8), cell(maxValueSpinner).weight(3) ), - row( - cell(setMinValueCheckBox).weight(1.2), cell(minValueSpinner).weight(3) + row(10, + cell(setMinValueCheckBox).weight(1.8), cell(minValueSpinner).weight(3) ), cell(errorMsgBorderPane) ).getComponent()); 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 4a5fb7d79a..2cdcc0d096 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 @@ -1192,6 +1192,10 @@ CellOtherSetPane.height=$Component.defaultHeight Button.breadcrumbForeground = #8F999F Button.breadcrumbSelectedForeground = #000000 +chart.normalBorderColor = #DADEE7 +chart.hoverBorderColor = #2576EF +chart.selectedBorderColor = #2576EF + #---- Styles ------------------------------------------------------------------ #---- inTextField ---- diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java index e150466ecc..5bbea51697 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java @@ -1,5 +1,7 @@ package com.fr.design.mainframe.chart.gui.type; +import com.fine.theme.utils.FineUIStyle; +import com.fine.theme.utils.FineUIUtils; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; @@ -19,7 +21,6 @@ public class ChartImagePane extends ChartSelectDemoPane { private static final long serialVersionUID = -2785128245790568603L; private static final int IMAGE_WIDTH = 56; private static final int IMAGE_HIGTH = 50; - private static final Color ENTER_COLOR = new Color(216, 242, 253); private boolean isDrawRightLine = false; public boolean isDoubleClicked = false; @@ -30,7 +31,7 @@ public class ChartImagePane extends ChartSelectDemoPane { addMouseListener(this); this.setToolTipText(tipName); - this.setBorder(BorderFactory.createMatteBorder(0, 0, 0, isDrawRightLine ? 1 : 0, UIConstants.SELECT_TAB)); + this.setBorder(BorderFactory.createMatteBorder(0, 0, 0, isDrawRightLine ? 1 : 0, FineUIUtils.getUIColor("chart.normalBorderColor", "chart.normalBorderColor"))); this.setBackground(UIConstants.TOOLBARUI_BACKGROUND); this.setPreferredSize(getScaledDimension()); } @@ -58,7 +59,7 @@ public class ChartImagePane extends ChartSelectDemoPane { this.setToolTipText(tipName); - this.setBorder(BorderFactory.createMatteBorder(0, 0, 0, isDrawRightLine ? 1 : 0, UIConstants.SELECT_TAB)); + this.setBorder(BorderFactory.createMatteBorder(0, 0, 0, isDrawRightLine ? 1 : 0, FineUIUtils.getUIColor("chart.normalBorderColor", "chart.normalBorderColor"))); this.setBackground(UIConstants.TOOLBARUI_BACKGROUND); this.setPreferredSize(getScaledDimension()); @@ -87,11 +88,11 @@ public class ChartImagePane extends ChartSelectDemoPane { */ public void checkBorder() { if (!isRollOver && !isPressing) { - this.setBorder(BorderFactory.createMatteBorder(0, 0, 0, isDrawRightLine ? 1 : 0, UIConstants.SELECT_TAB)); + this.setBorder(BorderFactory.createMatteBorder(1, 1, 1, isDrawRightLine ? 1 : 0, FineUIUtils.getUIColor("chart.normalBorderColor", "chart.normalBorderColor"))); } else if (isRollOver && !isPressing) { - this.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, ENTER_COLOR)); + this.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, FineUIUtils.getUIColor("chart.hoverBorderColor", "chart.hoverBorderColor"))); } else { - this.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, UIConstants.FLESH_BLUE)); + this.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, FineUIUtils.getUIColor("chart.selectedBorderColor", "chart.selectedBorderColor"))); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java index ea888a0b6f..b6bd0f164b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java @@ -96,10 +96,11 @@ public abstract class AbstractAttrPane extends AbstractAttrNoScrollPane { public void layoutContainer(Container parent) { maxHeight = getMaxHeight(); int beginY = 0; - if ((MAXVALUE - scrollBar.getVisibleAmount()) != 0) { + int len = MAXVALUE - scrollBar.getVisibleAmount(); + if (len != 0) { int preferredHeight = leftContentPane.getPreferredSize().height; int value = scrollBar.getValue(); - beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount()); + beginY = value * (preferredHeight - maxHeight) / len; } int width = parent.getWidth(); int height = parent.getHeight(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java index 2c4b48106b..0a33581c93 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java @@ -49,7 +49,7 @@ public class ReportFloatPane extends Column { } private void initComponent() { - setBorder(new ScaledEmptyBorder(10, 10, 10, 10)); + setBorder(new ScaledEmptyBorder(10, 10, 0, 10)); setSpacing(10); initInsertToolBar(); this.add( diff --git a/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java index 06d9380b54..2e67822760 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java @@ -59,7 +59,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor { formulaButton.setVisible(false); this.setLayout(new BorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - add(row(10, + add(row(4, cell(stringTextField).weight(1), cell(formulaButton) ).getComponent(), BorderLayout.NORTH);