Browse Source

Merge pull request #16133 in DESIGN/design from fbp/release to fbp/merge

* commit '5be7a4b061137d98e325647ed60fcaed5205ce9f':
  KERNEL-20301 设计器部分UI不支持运动中点击导致UI使用体感重
fbp/merge
superman 3 weeks ago
parent
commit
190f5d27e5
  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.JPanel;
import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.ActionEvent;
import java.util.function.Consumer;
import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER;
@ -33,8 +32,8 @@ public class UICombinationButton extends JPanel {
protected UIButton rightButton;
private Consumer<MouseEvent> leftClickLister;
private Consumer<MouseEvent> rightClickLister;
private Consumer<ActionEvent> leftClickLister;
private Consumer<ActionEvent> rightClickLister;
protected void leftButtonClickEvent() {
// 左边按钮点击事件
@ -54,7 +53,7 @@ public class UICombinationButton extends JPanel {
*
* @param lister 监听
*/
public void addLeftClickLister(Consumer<MouseEvent> lister) {
public void addLeftActionListener(Consumer<ActionEvent> lister) {
this.leftClickLister = lister;
}
@ -63,7 +62,7 @@ public class UICombinationButton extends JPanel {
*
* @param lister 监听
*/
public void addRightClickLister(Consumer<MouseEvent> lister) {
public void addRightActionListener(Consumer<ActionEvent> lister) {
this.rightClickLister = lister;
}
@ -73,25 +72,18 @@ public class UICombinationButton extends JPanel {
leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT);
rightButton = right;
rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT);
leftButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (leftClickLister != null) {
leftClickLister.accept(e);
} else {
leftButtonClickEvent();
}
leftButton.addActionListener(e -> {
if (leftClickLister != null) {
leftClickLister.accept(e);
} else {
leftButtonClickEvent();
}
});
rightButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (rightClickLister != null) {
rightClickLister.accept(e);
} else {
rightButtonClickEvent();
}
rightButton.addActionListener(e -> {
if (rightClickLister != null) {
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.gui.ibutton.UIButton;
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.UIPopupMenu;
import com.fr.design.i18n.Toolkit;
@ -339,14 +338,14 @@ public class MainDesigner extends BaseDesigner {
private UICombinationButton createRunButton() {
run = new UICombinationButton(new UIButton(Toolkit.i18nText("Fine-Design_Basic_Preview"), new LazyIcon("run").white()),
new UIButton(new LazyIcon("triangle_down").white()));
run.addLeftClickLister(mouseEvent -> {
run.addLeftActionListener(event -> {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null || jt.isSaving()) {
return;
}
WebPreviewUtils.preview(jt);
});
run.addRightClickLister(mouseEvent -> {
run.addRightActionListener(event -> {
final JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) {
return;

Loading…
Cancel
Save