Browse Source

REPORT-107973 修改部分透明色按钮、弹窗边距、可折叠面板点击色

newui
Leo.Qin 10 months ago
parent
commit
f277e0984a
  1. 55
      designer-base/src/main/java/com/fine/theme/light/ui/FineInputUI.java
  2. 2
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  3. 10
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java
  5. 10
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  6. 6
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  7. 8
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java
  8. 10
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  9. 9
      designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java

55
designer-base/src/main/java/com/fine/theme/light/ui/FineInputUI.java

@ -1,10 +1,8 @@
package com.fine.theme.light.ui;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatButtonUI;
import com.formdev.flatlaf.ui.FlatPanelUI;
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.UIManager;
@ -67,57 +65,4 @@ public class FineInputUI extends FlatPanelUI {
}
}
/**
* input输入框中的Button UI类
*
* @author Leo.Qin
* @since 11.0
* Created on 2023/12/12
*/
public static class FineInputButtonUI extends FlatButtonUI {
public FineInputButtonUI(boolean shared) {
super(shared);
}
/**
* 创建UI
*/
public static ComponentUI createUI(JComponent c) {
return new FineInputButtonUI(false);
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
c.setBorder(null);
c.setOpaque(false);
}
@Override
protected void installDefaults(AbstractButton b) {
super.installDefaults(b);
hoverBackground = UIManager.getColor("InputButton.hoverBackground");
pressedBackground = UIManager.getColor("InputButton.pressedBackground");
background = UIManager.getColor("InputButton.background");
}
@Override
public void propertyChange(AbstractButton b, PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (EDITABLE.equals(propertyName) || ENABLED.equals(propertyName)) {
updateBackground(b, e);
} else {
super.propertyChange(b, e);
}
}
private void updateBackground(AbstractButton b, PropertyChangeEvent e) {
if (e.getNewValue() == Boolean.FALSE) {
b.setBackground(UIManager.getColor("InputButton.disabledBackground"));
} else {
b.setBackground(UIManager.getColor("InputButton.background"));
}
}
}
}

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

@ -31,6 +31,8 @@ public interface FineUIStyle {
String MENU_TOOL_BAR = "menuToolBar";
String MENU_ITEM_TOOL_BAR = "menuItemToolBar";
String POPUP_MENU_TOOL_BAR = "popupMenuToolBar";
String POPUP_MENU_DROPDOWN = "dropdownPopupMenu";
String TRANSPARENT_TEXT_FIELD = "transparentTextField";
/**

10
designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/FineSearchPane.java

@ -1,7 +1,6 @@
package com.fr.design.data.datapane.management.search.pane;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineInputUI;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.event.HoverAware;
import com.fr.design.gui.ibutton.UIButton;
@ -18,6 +17,10 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.TRANSPARENT_TEXT_FIELD;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/**
* 搜索面板
*
@ -56,8 +59,7 @@ public class FineSearchPane extends JPanel implements HoverAware {
// 中间输入框
searchTextField = new UITextField();
searchTextField.setBorder(null);
searchTextField.setOpaque(false);
setStyle(searchTextField, TRANSPARENT_TEXT_FIELD);
searchTextField.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
@ -74,7 +76,7 @@ public class FineSearchPane extends JPanel implements HoverAware {
// 右侧返回图标
clearButton = new UIButton(new LazyIcon("clear"));
clearButton.setUI(new FineInputUI.FineInputButtonUI(false));
setStyle(clearButton, STYLE_TEXT);
Insets buttonInsets = FineUIUtils.getAndScaleUIInsets("SearchPanel.buttonBorderInsets", defaultButtonInsets);
clearButton.setBorder(BorderFactory.createEmptyBorder(buttonInsets.top, buttonInsets.left, buttonInsets.bottom, buttonInsets.right));

7
designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java

@ -14,6 +14,7 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
/**
* Created by MoMeak on 2017/7/5.
@ -48,7 +49,11 @@ public class HeaderPane extends JPanel {
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setColor(getBackground());
g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
if (isPressed) {
g2d.setColor(UIManager.getColor("Button.pressedBackground"));
}
Insets insets = this.getInsets();
g2d.fillRect(0, insets.top / 2, this.getWidth(), this.getHeight() - (insets.top + insets.bottom) / 2);
int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2;
if (this.isShow) {

10
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -1,8 +1,6 @@
package com.fr.design.gui.ispinner;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineInputUI;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
@ -17,7 +15,6 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
@ -36,6 +33,9 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/**
* Spinner类
*
@ -239,7 +239,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height = FineUIScale.scale(UIManager.getInt("Input.height"));
dim.height = FineUIUtils.getAndScaleInt("Input.height", defaultButtonSize);
return dim;
}
@ -309,7 +309,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
return false;
}
};
arrowButton.setUI(new FineInputUI.FineInputButtonUI(false));
setStyle(arrowButton, STYLE_TEXT);
return arrowButton;
}

6
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineInputUI;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.Exception.ValidationException;
@ -32,6 +31,9 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/**
* 编辑器
* @author anonymous
@ -126,7 +128,7 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor,
if (showButton) {
btPopup = new UIButton();
initPopupButton();
btPopup.setUI(new FineInputUI.FineInputButtonUI(false));
setStyle(btPopup, STYLE_TEXT);
btPopup.addActionListener(new ActionListener() {
@Override

8
designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java

@ -9,6 +9,9 @@ import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import static com.fine.theme.utils.FineUIStyle.POPUP_MENU_DROPDOWN;
import static com.fine.theme.utils.FineUIStyle.setStyle;
public abstract class ColorControlWindow extends JPopupMenu {
private static final long serialVersionUID = 4317136753151221742L;
private PopupHider popupHider;
@ -29,6 +32,7 @@ public abstract class ColorControlWindow extends JPopupMenu {
public ColorControlWindow(boolean isSupportTransparent, PopupHider popupHider) {
this.initComponents(isSupportTransparent);
this.popupHider = popupHider;
setStyle(this, POPUP_MENU_DROPDOWN);
}
public Color getColor() {
@ -53,10 +57,6 @@ public abstract class ColorControlWindow extends JPopupMenu {
setLightWeightPopupEnabled(JPopupMenu.getDefaultLightWeightPopupEnabled());
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setBorderPainted(false);
setOpaque(false);
setDoubleBuffered(true);
setFocusable(false);
initSelectionPopupPane(isSupportTransparent);
this.pack();
}

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

@ -748,10 +748,6 @@ Spinner.editorBorderPainted = false
# allowed values: button or none
Spinner.buttonStyle = button
#---- Input ----
InputButton.background=$fill.normal
InputButton.hoverBackground=$fill.hover
InputButton.pressedBackground=$fill.click
InputButton.disabledBackground=$fill.disabled
InputButton.width=$Component.defaultHeight
InputButton.height=$Component.defaultHeight
InputTextField.borderInsets=0, 6, 0, 6
@ -1281,6 +1277,12 @@ CellOtherSetPane.height=$Component.defaultHeight
acceleratorSelectionForeground : $text.white
[style]PopupMenu.popupMenuToolBar=\
background: $fill.gray
[style]TextField.transparentTextField=\
background: fade(@background, 0%); \
border: null;
[style]PopupMenu.dropdownPopupMenu=\
background: fade(@background, 0%); \
borderInsets: 0,0,0,0;
#---- clearButton ----
# for clear/cancel button in text fields

9
designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java

@ -23,7 +23,6 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
@ -33,6 +32,9 @@ import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import static com.fine.theme.utils.FineUIStyle.POPUP_MENU_DROPDOWN;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/**
* 这个Pane用来显示常用边框和设置自定义边框
*
@ -127,11 +129,8 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH
setLightWeightPopupEnabled(JPopupMenu.getDefaultLightWeightPopupEnabled());
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setBorderPainted(true);
setBorder(UIManager.getBorder("PopupMenu.border"));
setOpaque(false);
setDoubleBuffered(true);
setFocusable(false);
setStyle(this, POPUP_MENU_DROPDOWN);
this.add(new NormalBorderPane(isSupportTransparent, UIToolbarBorderButton.this), BorderLayout.CENTER);
this.pack();

Loading…
Cancel
Save