Browse Source

Pull request #13491: REPORT-107973 背景色透明按钮

Merge in DESIGN/design from ~LEO.QIN/design:newui to newui

* commit '69b41c1b82245ec11178d2f5066de00abf4edebe':
  REPORT-107973 背景色透明按钮
newui
Leo.Qin-覃宇攀 11 months ago
parent
commit
38f3a1d790
  1. 1
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  2. 15
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  5. 4
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  6. 4
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  7. 28
      designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java
  8. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

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

@ -16,6 +16,7 @@ public interface FineUIStyle {
String IN_TOOLBAR_GROUP = "inToolbarGroup"; String IN_TOOLBAR_GROUP = "inToolbarGroup";
String STYLE_PRIMARY = "primary"; String STYLE_PRIMARY = "primary";
String STYLE_SECONDARY = "secondary"; String STYLE_SECONDARY = "secondary";
String STYLE_TEXT = "text";
String STYLE_SIZE_MEDIUM = "mediumSize"; String STYLE_SIZE_MEDIUM = "mediumSize";
String STYLE_SIZE_SMALL = "smallSize"; String STYLE_SIZE_SMALL = "smallSize";
String MENU_BAR = "menuBar"; String MENU_BAR = "menuBar";

15
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.RectangleButtonUI;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatDarkLaf;
@ -14,7 +13,6 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
@ -70,6 +68,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.setStyle;
public class EastRegionContainerPane extends UIEastResizableContainer { public class EastRegionContainerPane extends UIEastResizableContainer {
private static volatile EastRegionContainerPane THIS; private static volatile EastRegionContainerPane THIS;
private Map<String, PropertyItem> propertyItemMap; private Map<String, PropertyItem> propertyItemMap;
@ -974,7 +975,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
public void resetButtonIcon() { public void resetButtonIcon() {
button.setBackground(null); button.setBackground(new Color(0, 0, 0, 0));
if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) {
iconSuffix = ICON_SUFFIX_NORMAL; iconSuffix = ICON_SUFFIX_NORMAL;
button.setIcon(new LazyIcon(getBtnIconId())); button.setIcon(new LazyIcon(getBtnIconId()));
@ -1003,7 +1004,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}; };
button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED)); button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED));
button.set4LargeToolbarButton(); button.set4LargeToolbarButton();
button.setUI(new RectangleButtonUI(false)); setStyle(button, STYLE_TEXT);
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -1279,11 +1280,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} else if (StringUtils.equals(type, DOWN_BUTTON)) { } else if (StringUtils.equals(type, DOWN_BUTTON)) {
popupButton = new UIButton(new LazyIcon("expand_popup")); popupButton = new UIButton(new LazyIcon("expand_popup"));
} }
popupButton.setUI(new UIButtonUI()); setStyle(popupButton, STYLE_TEXT);
popupButton.setBorderPainted(false);
popupButton.setBorder(null);
popupButton.setBackground(null);
popupButton.setExtraPainted(false);
popupButton.addActionListener(e -> { popupButton.addActionListener(e -> {
this.buttonType = type; this.buttonType = type;
onPop(); onPop();

3
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -106,6 +107,7 @@ public class JFormSliderPane extends JPanel {
}; };
downButton.setBorderPainted(false); downButton.setBorderPainted(false);
downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down")); downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down"));
setStyle(downButton, FineUIStyle.STYLE_TEXT);
upButton = new UIButton(new LazyIcon("zoomIn")) { upButton = new UIButton(new LazyIcon("zoomIn")) {
public Point getToolTipLocation(MouseEvent event) { public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
@ -117,6 +119,7 @@ public class JFormSliderPane extends JPanel {
upButton.setActionCommand("more"); upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener); downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener);
setStyle(upButton, FineUIStyle.STYLE_TEXT);
} }
private void initShowValField() { private void initShowValField() {

4
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -9,6 +10,8 @@ import java.awt.BorderLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* 日志消息 * 日志消息
* *
@ -40,6 +43,7 @@ public class LogMessageBar extends BasicPane {
logButton = new UIButton(new LazyIcon("logMsg")); logButton = new UIButton(new LazyIcon("logMsg"));
logButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_Log_Message")); logButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_Log_Message"));
logButton.set4ToolbarButton(); logButton.set4ToolbarButton();
setStyle(logButton, FineUIStyle.STYLE_TEXT);
add(logButton); add(logButton);
logButton.addMouseListener(new MouseAdapter() { logButton.addMouseListener(new MouseAdapter() {
@Override @Override

4
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java

@ -1,6 +1,7 @@
package com.fr.design.notification.ui; package com.fr.design.notification.ui;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -11,6 +12,8 @@ import java.awt.BorderLayout;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import static com.fine.theme.utils.FineUIStyle.setStyle;
public class NotificationCenterPane extends BasicPane { public class NotificationCenterPane extends BasicPane {
private static NotificationCenterPane notificationCenterPane = new NotificationCenterPane(); private static NotificationCenterPane notificationCenterPane = new NotificationCenterPane();
private static UIButton notificationCenterButton; private static UIButton notificationCenterButton;
@ -22,6 +25,7 @@ public class NotificationCenterPane extends BasicPane {
notificationCenterButton.setIcon(new LazyIcon("notification")); notificationCenterButton.setIcon(new LazyIcon("notification"));
notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification")); notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification"));
notificationCenterButton.set4ToolbarButton(); notificationCenterButton.set4ToolbarButton();
setStyle(notificationCenterButton, FineUIStyle.STYLE_TEXT);
this.add(notificationCenterButton); this.add(notificationCenterButton);
notificationCenterButton.addMouseListener(new MouseAdapter() { notificationCenterButton.addMouseListener(new MouseAdapter() {
@Override @Override

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

@ -1228,6 +1228,10 @@ CellOtherSetPane.height=$Component.defaultHeight
focusedBorderColor : $Button.focusedBorderColor; \ focusedBorderColor : $Button.focusedBorderColor; \
focusColor : $Component.focusColor; \ focusColor : $Component.focusColor; \
borderWidth : 1 borderWidth : 1
[style]Button.text=\
background : fade($Button.background,0%); \
borderWidth : 0; \
disabledBackground : fade($Button.background,0%);
[style]CombinationButton.primary = \ [style]CombinationButton.primary = \
background : @BrandColor; \ background : @BrandColor; \

28
designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java

@ -18,6 +18,7 @@ import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY; import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY;
import static com.fine.theme.utils.FineUIStyle.STYLE_SIZE_SMALL; import static com.fine.theme.utils.FineUIStyle.STYLE_SIZE_SMALL;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.joinStyle; import static com.fine.theme.utils.FineUIStyle.joinStyle;
import static com.fine.theme.utils.FineUIStyle.setStyle; import static com.fine.theme.utils.FineUIStyle.setStyle;
@ -131,6 +132,33 @@ public class ButtonStoryBoard extends StoryBoard {
) )
) )
), ),
column(16,
cell(new UILabel(STYLE_TEXT)).with(this::h2),
row(20,
cell(new UILabel("正常")),
cell(new UIButton("按钮"))
.with(it -> setStyle(it, STYLE_TEXT)),
cell(new UIButton("按钮", new LazyIcon("add")))
.with(it -> setStyle(it, STYLE_TEXT)),
cell(new UIButton(new LazyIcon("multi")))
.with(it -> setStyle(it, STYLE_TEXT))
),
row(20,
cell(new UILabel("禁用")),
cell(new UIButton("按钮")).with(it -> {
setStyle(it, STYLE_TEXT);
it.setEnabled(false);
}),
cell(new UIButton("保存", new LazyIcon("save").disabled())).with(it -> {
setStyle(it, STYLE_TEXT);
it.setEnabled(false);
}),
cell(new UIButton(new LazyIcon("add").disabled())).with(it -> {
setStyle(it, STYLE_TEXT);
it.setEnabled(false);
})
)
),
cell(new UILabel("JButton")).with(this::h2), cell(new UILabel("JButton")).with(this::h2),
row(20, row(20,
cell(new UILabel("medium")), cell(new UILabel("medium")),

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineContext;
import com.fr.design.actions.help.alphafine.AlphaFineListener; import com.fr.design.actions.help.alphafine.AlphaFineListener;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -13,6 +14,8 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* Created by XiaXiang on 2017/3/21. * Created by XiaXiang on 2017/3/21.
*/ */
@ -30,6 +33,7 @@ public class AlphaFinePane extends BasicPane {
refreshButton.setIcon(new LazyIcon(("search"))); refreshButton.setIcon(new LazyIcon(("search")));
refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About"));
refreshButton.set4ToolbarButton(); refreshButton.set4ToolbarButton();
setStyle(refreshButton, FineUIStyle.STYLE_TEXT);
this.add(refreshButton); this.add(refreshButton);
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@Override @Override

Loading…
Cancel
Save