Browse Source

Pull request #14516: REPORT-113994 设计器样式翻新组件翻新

Merge in DESIGN/design from ~RENEKTON/design:newui to newui

* commit '6e8b924c1c97c991a9cc0d92e3bc2ec71ae8dc42':
  popupMenuUI重写,没icon去除icon绘画;悬浮元素悬浮色/边框增加,间距调整等;英文版本启动失败修复
  popupMenuUI重写,没icon去除icon绘画;悬浮元素悬浮色/边框增加,间距调整等
  增加buttonUI悬浮背景和点击背景
  面包屑组件初实现,自动缩放,目录恢复
  面包屑组件
newui
Renekton-张世豪 5 months ago
parent
commit
ee99c49156
  1. 37
      designer-base/src/main/java/com/fine/theme/light/ui/FineMenuItemUI.java
  2. 1
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  3. 24
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  4. 5
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  5. 2
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuEastAttrItem.java
  6. 10
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  7. 14
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  8. 13
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java
  9. 5
      designer-realize/src/main/java/com/fr/design/mainframe/AbstractAttrPane.java
  10. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ReportFloatPane.java
  11. 2
      designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java

37
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);
}
}
}
}

1
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -42,6 +42,7 @@ public interface FineUIStyle {
String PURE_LIST = "pureList";
String PURE_TREE = "pureTree";
String PASTEL_BUTTON = "pastelButton";
String BREADCRUMB_BUTTON = "breadcrumbButton";
/**

24
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<NameObject> list = new ArrayList<>();
if (hyperlinkArray != null) {

5
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());

2
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 {

10
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());

14
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -1194,6 +1194,13 @@ Center.arc=10
#---- CellOtherSetPane ----
CellOtherSetPane.height=$Component.defaultHeight
Button.breadcrumbForeground = #8F999F
Button.breadcrumbSelectedForeground = #000000
chart.normalBorderColor = #DADEE7
chart.hoverBorderColor = #2576EF
chart.selectedBorderColor = #2576EF
#---- Styles ------------------------------------------------------------------
#---- inTextField ----
@ -1348,3 +1355,10 @@ CellOtherSetPane.height=$Component.defaultHeight
background: null;\
track: fade(@background, 0%); \
hoverTrackColor : fade(@background, 0%)
[style]Button.breadcrumbButton = \
background: null;\
foreground: #8F999F; \
hoverBackground: #E6E9EF; \
pressedBackground: #DADEE7; \
selectedBackground: null

13
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")));
}
}

5
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();

2
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(

2
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);

Loading…
Cancel
Save