Browse Source

REPORT-60798 在线获取主题右击组件包后异常

research/11.0
kuangshuai 3 years ago
parent
commit
4b744ae469
  1. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  2. 46
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java

@ -58,7 +58,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
return null;
}
protected JPopupMenu getRightClickPopupMenu() {
public JPopupMenu getRightClickPopupMenu() {
return rightClickPopupMenu;
}

46
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

@ -40,10 +40,13 @@ import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Point;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent;
import java.util.List;
import java.util.TimerTask;
import java.util.UUID;
@ -170,12 +173,29 @@ public class DownloadComponentPackageGuide {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
onlineWidgetPackageBlock = (OnlineWidgetPackageBlock) ComponentUtils.findComponentByClass(EastRegionContainerPane.getInstance(), OnlineWidgetPackageBlock.class);
if (onlineWidgetPackageBlock != null) {
scene.addClickTarget(onlineWidgetPackageBlock, ClickScene.ClickType.RIGHT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F002002_Tip_Right_Click_Package"), GuideTip.Direction.LEFT);
List<Component> components = ComponentUtils.findComponentsByClass(EastRegionContainerPane.getInstance(), OnlineWidgetPackageBlock.class);
for (int index = 0; index < components.size(); index++) {
OnlineWidgetPackageBlock block = (OnlineWidgetPackageBlock) components.get(index);
if (StringUtils.isNotEmpty(block.getWidget().getThemePath())) {
onlineWidgetPackageBlock = block;
break;
}
}
return true;
if (onlineWidgetPackageBlock == null) {
GuideManager.getInstance().getCurrentGuide().terminate();
} else {
JScrollPane scrollPane = getParentScrollPane(onlineWidgetPackageBlock);
scrollPane.getVerticalScrollBar().setValue(onlineWidgetPackageBlock.getY());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scene.addClickTarget(onlineWidgetPackageBlock, ClickScene.ClickType.RIGHT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F002002_Tip_Right_Click_Package"), GuideTip.Direction.LEFT);
scene.showScene();
}
});
}
return false;
}
});
return scene;
@ -187,7 +207,7 @@ public class DownloadComponentPackageGuide {
@Override
public boolean prepared() {
scene.addTarget(onlineWidgetPackageBlock);
JPopupMenu popupMenu = onlineWidgetPackageBlock.getComponentPopupMenu();
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
Point location = getPopupMenuLocation();
scene.addCustomTarget(
GuideCreateUtils.createTarget(popupMenu),
@ -204,7 +224,7 @@ public class DownloadComponentPackageGuide {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
JPopupMenu popupMenu = onlineWidgetPackageBlock.getComponentPopupMenu();
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
Point location = getPopupMenuLocation();
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(popupMenu),
@ -279,7 +299,7 @@ public class DownloadComponentPackageGuide {
}
private static Point getPopupMenuLocation() {
JPopupMenu popupMenu = onlineWidgetPackageBlock.getComponentPopupMenu();
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
return new Point((onlineWidgetPackageBlock.getWidth() - popupMenu.getWidth()) / 2, (onlineWidgetPackageBlock.getHeight()- popupMenu.getHeight()) / 2);
}
@ -289,4 +309,14 @@ public class DownloadComponentPackageGuide {
}
}
private static JScrollPane getParentScrollPane(Component component) {
if (component.getParent() == null) {
return null;
}
if (component.getParent() instanceof JScrollPane) {
return (JScrollPane) component.getParent();
}
return getParentScrollPane(component.getParent());
}
}

Loading…
Cancel
Save