Browse Source

Pull request #16113: KERNEL-20301 设计器部分UI不支持运动中点击导致UI使用体感重

Merge in DESIGN/design from ~VITO/c-design:fbp/release to fbp/release

* commit 'f88fdb950e913c3652579533976f61722b3b5d6a':
  KERNEL-20301 设计器部分UI不支持运动中点击导致UI使用体感重
fbp/release
vito-刘恒霖 3 weeks ago
parent
commit
5be7a4b061
  1. 38
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java
  2. 5
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

38
designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java

@ -3,8 +3,7 @@ package com.fr.design.gui.ibutton;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.MouseAdapter; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.util.function.Consumer; import java.util.function.Consumer;
import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER; import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER;
@ -33,8 +32,8 @@ public class UICombinationButton extends JPanel {
protected UIButton rightButton; protected UIButton rightButton;
private Consumer<MouseEvent> leftClickLister; private Consumer<ActionEvent> leftClickLister;
private Consumer<MouseEvent> rightClickLister; private Consumer<ActionEvent> rightClickLister;
protected void leftButtonClickEvent() { protected void leftButtonClickEvent() {
// 左边按钮点击事件 // 左边按钮点击事件
@ -54,7 +53,7 @@ public class UICombinationButton extends JPanel {
* *
* @param lister 监听 * @param lister 监听
*/ */
public void addLeftClickLister(Consumer<MouseEvent> lister) { public void addLeftActionListener(Consumer<ActionEvent> lister) {
this.leftClickLister = lister; this.leftClickLister = lister;
} }
@ -63,7 +62,7 @@ public class UICombinationButton extends JPanel {
* *
* @param lister 监听 * @param lister 监听
*/ */
public void addRightClickLister(Consumer<MouseEvent> lister) { public void addRightActionListener(Consumer<ActionEvent> lister) {
this.rightClickLister = lister; this.rightClickLister = lister;
} }
@ -73,25 +72,18 @@ public class UICombinationButton extends JPanel {
leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT); leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT);
rightButton = right; rightButton = right;
rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT); rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT);
leftButton.addMouseListener(new MouseAdapter() { leftButton.addActionListener(e -> {
@Override if (leftClickLister != null) {
public void mouseClicked(MouseEvent e) { leftClickLister.accept(e);
if (leftClickLister != null) { } else {
leftClickLister.accept(e); leftButtonClickEvent();
} else {
leftButtonClickEvent();
}
} }
}); });
rightButton.addMouseListener(new MouseAdapter() { rightButton.addActionListener(e -> {
if (rightClickLister != null) {
@Override rightClickLister.accept(e);
public void mouseClicked(MouseEvent e) { } else {
if (rightClickLister != null) { rightButtonClickEvent();
rightClickLister.accept(e);
} else {
rightButtonClickEvent();
}
} }
}); });

5
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -22,7 +22,6 @@ import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor; import com.fr.design.fun.OemProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UICombinationButton; import com.fr.design.gui.ibutton.UICombinationButton;
import com.fr.design.gui.ibutton.UISaveForbiddenButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -339,14 +338,14 @@ public class MainDesigner extends BaseDesigner {
private UICombinationButton createRunButton() { private UICombinationButton createRunButton() {
run = new UICombinationButton(new UIButton(Toolkit.i18nText("Fine-Design_Basic_Preview"), new LazyIcon("run").white()), run = new UICombinationButton(new UIButton(Toolkit.i18nText("Fine-Design_Basic_Preview"), new LazyIcon("run").white()),
new UIButton(new LazyIcon("triangle_down").white())); new UIButton(new LazyIcon("triangle_down").white()));
run.addLeftClickLister(mouseEvent -> { run.addLeftActionListener(event -> {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null || jt.isSaving()) { if (jt == null || jt.isSaving()) {
return; return;
} }
WebPreviewUtils.preview(jt); WebPreviewUtils.preview(jt);
}); });
run.addRightClickLister(mouseEvent -> { run.addRightActionListener(event -> {
final JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); final JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) { if (jt == null) {
return; return;

Loading…
Cancel
Save