Browse Source

REPORT-60431 【主题获取】组件右键时,下载按钮依旧存在

【问题原因】
主题获取交互优化

【改动思路】
同上
research/11.0
Starryi 3 years ago
parent
commit
234c29f4a7
  1. 35
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

35
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -35,8 +35,11 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -60,9 +63,10 @@ import java.util.concurrent.ExecutionException;
* Created by kerry on 2020-10-19 * Created by kerry on 2020-10-19
* 商城组件块 * 商城组件块
*/ */
public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock implements PopupMenuListener {
private boolean isMouseEnter = false; private boolean isMouseEnter = false;
private boolean downloading = false; private boolean downloading = false;
private boolean popupMenuVisible = false;
private static final Color COVER_COLOR = Color.decode("#333334"); private static final Color COVER_COLOR = Color.decode("#333334");
protected MouseEvent lastPressEvent; protected MouseEvent lastPressEvent;
private double process = 0D; private double process = 0D;
@ -89,6 +93,13 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
return southPane; return southPane;
} }
@Override
public JPopupMenu createRightClickPopupMenu() {
JPopupMenu popupMenu = super.createRightClickPopupMenu();
popupMenu.addPopupMenuListener(this);
return popupMenu;
}
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
super.mouseEntered(e); super.mouseEntered(e);
@ -113,7 +124,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
super.mouseClicked(e); super.mouseClicked(e);
boolean isLeftClickDownloadIcon = e.getButton() != MouseEvent.BUTTON3 && getDownloadIconRec().contains(e.getX(), e.getY()); boolean isLeftClickDownloadIcon = e.getButton() != MouseEvent.BUTTON3 && getDownloadIconRec().contains(e.getX(), e.getY());
if (isLeftClickDownloadIcon && !checkWidgetInstalled()) { if (!popupMenuVisible && isLeftClickDownloadIcon && !checkWidgetInstalled()) {
downLoadWidget(); downLoadWidget();
} }
} }
@ -270,7 +281,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
return; return;
} }
//如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层
if (isMouseEnter || downloading) { if (!popupMenuVisible && (isMouseEnter || downloading)) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
//画白色的编辑层 //画白色的编辑层
@ -299,6 +310,24 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
} }
} }
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
this.popupMenuVisible = true;
repaint();
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
this.popupMenuVisible = false;
repaint();
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
this.popupMenuVisible = false;
repaint();
}
class WidgetDownloadProcess implements com.fr.design.extra.Process<Double> { class WidgetDownloadProcess implements com.fr.design.extra.Process<Double> {

Loading…
Cancel
Save