Browse Source

REPORT-60493 主题下载引导场景

research/11.0
kuangshuai 3 years ago
parent
commit
4aaf16c00c
  1. 1
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  2. 19
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java
  3. 1
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  4. 54
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
  6. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  7. 49
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java
  8. 73
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  9. 3
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  10. 267
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

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

@ -1005,6 +1005,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.addActionListener(actionListener);
}
button.setToolTipText(title);
button.setName(name);
}
public void processSnapChat() {

19
designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java

@ -108,6 +108,7 @@ public class Guide {
if (GuideManager.getInstance().getCurrentGuide() != null) {
return;
}
GuideManager.getInstance().setCurrentGuide(this);
try {
if (lifecycle != null && !lifecycle.prepared()) {
return;
@ -129,7 +130,6 @@ public class Guide {
if (scene != null) {
guideView.setScene(scene);
guideView.showGuide();
GuideManager.getInstance().setCurrentGuide(this);
if (lifecycle != null) {
lifecycle.onStart();
}
@ -159,11 +159,18 @@ public class Guide {
public void end() {
guideView.dismissGuide();
if (lifecycle != null) {
lifecycle.onEnd();
}
GuideManager.getInstance().setCurrentGuide(null);
GuideManageDialog.getInstance().showDialog();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (lifecycle != null) {
lifecycle.onEnd();
}
GuideManager.getInstance().setCurrentGuide(null);
GuideManageDialog.getInstance().showDialog();
}
});
}
public void registerLifecycle(GuideLifecycle lifecycle) {

1
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java

@ -115,6 +115,7 @@ public class GuideView extends JDialog {
revalidate();
repaint();
setVisible(false);
dispose();
}
@Override

54
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -283,39 +283,40 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (lifecycle != null && !lifecycle.prepared()) {
return;
}
showScene();
}
@Override
public void showScene() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (container != null) {
container.setContentPane(AbstractGuideScene.this);
setBounds(0, 0 , getSceneWidth(), getSceneWidth());
// show target
for (int index = highlightList.size() - 1; index >= 0; index--) {
add(highlightList.get(index));
}
// show next button
if (nextButton != null) {
nextButton.setBounds((getSceneWidth() - 60) / 2, getSceneHeight() - 100, 60, 30);
add(nextButton);
}
container.revalidate();
container.repaint();
}
showContainer();
if (lifecycle != null) {
lifecycle.onShow();
}
showScene();
}
});
}
@Override
public void showScene() {
if (container != null) {
container.setContentPane(AbstractGuideScene.this);
setBounds(0, 0 , getSceneWidth(), getSceneWidth());
// show target
for (int index = highlightList.size() - 1; index >= 0; index--) {
add(highlightList.get(index));
}
// show next button
if (nextButton != null) {
nextButton.setBounds((getSceneWidth() - 60) / 2, getSceneHeight() - 100, 60, 30);
add(nextButton);
}
container.revalidate();
container.repaint();
}
showContainer();
if (lifecycle != null) {
lifecycle.onShow();
}
}
@Override
public void complete() {
container.getLayeredPane().remove(this);
@ -339,9 +340,6 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
} else {
GuideManager.getInstance().getCurrentGuide().complete();
}
}
@Override

2
designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java

@ -36,7 +36,7 @@ public class BubbleTip implements GuideTip {
int returnVal = FineJOptionPane.showConfirmDialog(
currentGuide.getGuideView(),
"确认退出当前教学引导?",
Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Terminal"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);

7
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -37,6 +37,8 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public AbstractOnlineWidgetBlock(OnlineShareWidget widget, OnlineWidgetSelectPane parentPane) {
super(widget);
this.parentPane = parentPane;
JPopupMenu popupMenu = createRightClickPopupMenu();
this.setComponentPopupMenu(popupMenu);
}
protected UILabel initCoverLabel(Image image) {
@ -104,10 +106,7 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
super.mouseClicked(e);
if (e.getButton() == MouseEvent.BUTTON3) {
this.parentPane.hidePreviewPane();
JPopupMenu popupMenu = createRightClickPopupMenu();
GUICoreUtils.showPopupMenu(popupMenu, this, e.getX(), e.getY());
GUICoreUtils.showPopupMenu(getComponentPopupMenu(), this, e.getX(), e.getY());
}
}

49
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java

@ -24,7 +24,6 @@ import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
@ -34,13 +33,29 @@ import java.util.concurrent.ExecutionException;
*/
public class OnlineWidgetRepoPane extends BasicPane {
private static final String MARKET_URL = "https://market.fanruan.com/reuse";
private static List<OnlineShareWidget>[] sharableWidgets;
private OnlineWidgetTabPane componentTabPane;
private JPanel centerPane;
private boolean isShowPackagePanel = false;
private CardLayout cardLayout;
private Status currentStatus;
enum Status {LOADING, DISCONNECTED, NORMAL}
public static boolean loadWidgets() {
if (sharableWidgets != null){
return true;
}
try{
sharableWidgets = ShareUtils.getAllSharableWidgetsFromShop();
return true;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
public static OnlineWidgetRepoPane getInstance() {
return OnlineWidgetRepoPane.HOLDER.singleton;
}
@ -77,7 +92,16 @@ public class OnlineWidgetRepoPane extends BasicPane {
this.add(createInternetErrorPane(), Status.DISCONNECTED.name());
switchPane(Status.LOADING);
synchronizedLoadingContent();
setContent();
}
private void setContent() {
if (sharableWidgets != null) {
initContentPane();
addCenterPane();
} else {
synchronizedLoadingContent();
}
}
private void addCenterPane() {
@ -91,6 +115,7 @@ public class OnlineWidgetRepoPane extends BasicPane {
}
private void switchPane(Status status) {
this.currentStatus = status;
cardLayout.show(this, status.name());
}
@ -100,7 +125,6 @@ public class OnlineWidgetRepoPane extends BasicPane {
protected Boolean doInBackground() throws Exception {
return initContentPane();
}
@Override
protected void done() {
try {
@ -118,24 +142,19 @@ public class OnlineWidgetRepoPane extends BasicPane {
}
private boolean initContentPane() {
List<OnlineShareWidget> sharableWidgets = new ArrayList<>();
List<OnlineShareWidget> sharableWidgetPackage = new ArrayList<>();
try {
ShareUtils.getAllSharableWidgetsFromShop(sharableWidgets, sharableWidgetPackage);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
boolean loadWidgetsSuccess = loadWidgets();
if (loadWidgetsSuccess) {
this.componentTabPane = new OnlineWidgetTabPane(sharableWidgets[0].toArray(new OnlineShareWidget[sharableWidgets[0].size()]),
sharableWidgets[1].toArray(new OnlineShareWidget[sharableWidgets[1].size()]));
} else {
switchPane(Status.DISCONNECTED);
return false;
}
this.componentTabPane = new OnlineWidgetTabPane(sharableWidgets.toArray(new OnlineShareWidget[sharableWidgets.size()]),
sharableWidgetPackage.toArray(new OnlineShareWidget[sharableWidgetPackage.size()]));
return true;
return loadWidgetsSuccess;
}
private void reload() {
this.removeAll();
sharableWidgets = null;
initPane();
this.validate();
this.repaint();

73
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

@ -3,13 +3,19 @@ package com.fr.design.mainframe.guide.creator;
import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormCreatorDropTarget;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.utils.ScreenImage;
import com.fr.design.utils.ComponentUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.io.utils.ResourceIOUtils;
@ -21,11 +27,20 @@ import com.fr.workspace.WorkContext;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.InputStream;
import java.util.List;
import java.util.Timer;
import java.util.UUID;
@ -138,7 +153,7 @@ public class GuideCreateUtils {
return new UILabel(ic);
}
public static Rectangle getRelativeBounds(JComponent component, Component parent, int x, int y) {
public static Rectangle getRelativeBounds(Component component, Component parent, int x, int y) {
Point point = SwingUtilities.convertPoint(parent,0,0, GuideManager.getInstance().getCurrentGuide().getGuideView().getRootPane());
return new Rectangle(point.x + x, point.y + y, component.getWidth(), component.getHeight());
}
@ -159,8 +174,64 @@ public class GuideCreateUtils {
public static void showDialogWithoutModal(JDialog dialog) {
dialog.setModal(false);
dialog.setVisible(true);
dialog.toFront();
dialog.requestFocus();
}
public static void showUnLoginAlert() {
int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Guide_Option_Confirm_Not_Login"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.NORMAL);
}
}
public static void showNoNetworkAlert() {
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Need_Network"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.WARNING_MESSAGE);
}
public static JDialog showConfirmDialog(Window parent, Object message,
String title, int optionType) {
JOptionPane pane = new JOptionPane(message, JOptionPane.QUESTION_MESSAGE, optionType, null, FineJOptionPane.OPTION_OK_CANCEL, FineJOptionPane.OPTION_OK_CANCEL[0]);
int style = JRootPane.QUESTION_DIALOG;
JDialog dialog = new JDialog(parent, title);
dialog.setComponentOrientation(pane.getComponentOrientation());
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(pane, BorderLayout.CENTER);
dialog.setResizable(false);
if (JDialog.isDefaultLookAndFeelDecorated()) {
boolean supportsWindowDecorations =
UIManager.getLookAndFeel().getSupportsWindowDecorations();
if (supportsWindowDecorations) {
dialog.setUndecorated(true);
pane.getRootPane().setWindowDecorationStyle(style);
}
}
dialog.pack();
dialog.setLocationRelativeTo(parent);
List<Component> buttons = ComponentUtils.findComponentsByClass(pane, UIButton.class);
for (int i = 0; i < buttons.size(); i++) {
UIButton button = (UIButton) buttons.get(i);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
}
GuideCreateUtils.showDialogWithoutModal(dialog);
return dialog;
}
}

3
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -128,7 +128,6 @@ public class UseLayoutAndComponentGuide {
GuideCreateUtils.TIMER.purge();
}
}, 300);
scene.addTarget(newFormPane.getWindow());
return false;
}
});
@ -161,7 +160,7 @@ public class UseLayoutAndComponentGuide {
Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON);
if (component != null) {
scene.addClickTarget(component, ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_Click_Confirm"), GuideTip.Direction.TOP);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.TOP);
}
return super.prepared();
}

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

@ -1,22 +1,287 @@
package com.fr.design.mainframe.guide.creator.theme;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UITabGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.guide.GuideIds;
import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideBuilder;
import com.fr.design.mainframe.guide.base.GuideLifecycleAdaptor;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.creator.GuideCreateUtils;
import com.fr.design.mainframe.guide.creator.GuideSceneHelper;
import com.fr.design.mainframe.guide.scene.ClickScene;
import com.fr.design.mainframe.guide.scene.DisplayScene;
import com.fr.design.mainframe.guide.scene.GuideScene;
import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.mainframe.share.ui.block.OnlineWidgetPackageBlock;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetTabPane;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.share.utils.ShareUtils;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.Point;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent;
import java.util.TimerTask;
import java.util.UUID;
public class DownloadComponentPackageGuide {
private static String filePath;
private static OnlineWidgetPackageBlock onlineWidgetPackageBlock;
private static String downloadThemeName;
private static JDialog themeConfirmDialog;
public static Guide createGuide() {
GuideScene scene = createScene();
scene.nextScene(createScene2())
.nextScene(createScene3())
.nextScene(createScene4())
.nextScene(createScene5())
.nextScene(createScene6())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene());
Guide guide = GuideBuilder.newInstance()
.setID(GuideIds.Guide.F002002)
.setName(Toolkit.i18nText("Fine-Design_Guide_Scene_F002002_Name"))
.setDescription(Toolkit.i18nText("Fine-Design_Guide_Scene_F002002_Description"))
.setCompleteMessage(Toolkit.i18nText("Fine-Design_Guide_Scene_F002002_Complete_Message"))
.addScene(scene)
.registerLifecycle(new GuideLifecycleAdaptor() {
@Override
public boolean prepared() {
String userName = DesignerEnvManager.getEnvManager().getDesignerLoginUsername();
if (!WorkContext.getCurrent().isRoot()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Message"),
Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme_No_Authority_Tip_Title"),
JOptionPane.WARNING_MESSAGE);
return false;
} else if (StringUtils.isEmpty(userName)) {
GuideCreateUtils.showUnLoginAlert();
GuideManager.getInstance().getCurrentGuide().end();
return false;
} else if (!ShareUtils.testConnection()) {
GuideCreateUtils.showNoNetworkAlert();
GuideManager.getInstance().getCurrentGuide().end();
return false;
}
boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets();
if (loadWidgetSuccess) {
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "layout_recommend", ".frm");
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance();
OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class);
UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class);
JPanel centerPane = (JPanel) tabPane.getComponent(1);
if (centerPane.getComponentCount() > 0) {
GuideManager.getInstance().getCurrentGuide().start();
} else {
centerPane.addContainerListener(new ContainerAdapter() {
@Override
public void componentAdded(ContainerEvent e) {
GuideManager.getInstance().getCurrentGuide().start();
}
});
}
tabGroup.setSelectedIndex(1);
tabGroup.tabChanged(1);
} else {
GuideCreateUtils.showNoNetworkAlert();
GuideManager.getInstance().getCurrentGuide().end();
return false;
}
return false;
}
@Override
public void onEnd() {
closeConfirmDialog();
GuideCreateUtils.deleteGuideFile(filePath);
FormThemeConfig.getInstance().removeTheme(downloadThemeName);
filePath = null;
onlineWidgetPackageBlock = null;
downloadThemeName = null;
themeConfirmDialog = null;
}
})
.getGuide();
return guide;
}
private static void downLoadTheme() {
String themePath = onlineWidgetPackageBlock.getWidget().getThemePath();
FormTheme theme = DownloadUtils.downloadThemeFile(themePath);
if (theme == null) {
GuideCreateUtils.showNoNetworkAlert();
GuideManager.getInstance().getCurrentGuide().terminate();
}
downloadThemeName = theme.getName() + UUID.randomUUID().toString();
theme.setName(downloadThemeName);
FormThemeConfig.getInstance().addTheme(theme, true);
}
private static GuideScene createScene() {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
Component button = ComponentUtils.findComponentByName(EastRegionContainerPane.getInstance().getLeftPane(), EastRegionContainerPane.KEY_WIDGET_LIB);
if (button instanceof UIButton) {
scene.addClickTarget(button, ClickScene.ClickType.LEFT, true);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F002002_Tip_Click_Widget_Lib"), GuideTip.Direction.BOTTOM);
}
return true;
}
@Override
public void onComplete() {
FormWidgetDetailPane.getInstance().swich2Online();
}
});
return scene;
}
private static GuideScene createScene2() {
ClickScene scene = new ClickScene();
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);
}
return true;
}
});
return scene;
}
private static GuideScene createScene3() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addTarget(onlineWidgetPackageBlock);
JPopupMenu popupMenu = onlineWidgetPackageBlock.getComponentPopupMenu();
Point location = getPopupMenuLocation();
scene.addCustomTarget(
GuideCreateUtils.createTarget(popupMenu),
GuideCreateUtils.getRelativeBounds(popupMenu, onlineWidgetPackageBlock, location.x, location.y)
);
return true;
}
});
return scene;
}
private static GuideScene createScene4() {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
JPopupMenu popupMenu = onlineWidgetPackageBlock.getComponentPopupMenu();
Point location = getPopupMenuLocation();
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(popupMenu),
GuideCreateUtils.getRelativeBounds(popupMenu, onlineWidgetPackageBlock, location.x, location.y)
);
scene.addCustomClickTarget(
GuideCreateUtils.createTarget((JComponent)popupMenu.getComponent(0)),
GuideCreateUtils.getRelativeBounds(popupMenu.getComponent(0), onlineWidgetPackageBlock, location.x, location.y),
ClickScene.ClickType.LEFT
);
scene.addClickTarget(popupMenu.getComponent(0), ClickScene.ClickType.LEFT, true);
popupMenu.setVisible(false);
return true;
}
@Override
public void onComplete() {
downLoadTheme();
GuideCreateUtils.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Apply_Suitable_Theme_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
FineJOptionPane.OK_CANCEL_OPTION);
}
});
return scene;
}
private static GuideScene createScene5() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
GuideCreateUtils.TIMER.schedule(new TimerTask() {
@Override
public void run() {
scene.addTarget(themeConfirmDialog);
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
}, 300);
return false;
}
});
return scene;
}
private static GuideScene createScene6() {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
Component target = ComponentUtils.findComponentByClass(themeConfirmDialog.getContentPane(), UIButton.class);
scene.addClickTarget(target, ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Click_Confirm"), GuideTip.Direction.BOTTOM);
return super.prepared();
}
@Override
public void onComplete() {
closeConfirmDialog();
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateThemeConfig<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
TemplateTheme theme = config.cachedFetch(downloadThemeName);
template.setTemplateTheme(theme);
}
});
return scene;
}
private static Point getPopupMenuLocation() {
JPopupMenu popupMenu = onlineWidgetPackageBlock.getComponentPopupMenu();
return new Point((onlineWidgetPackageBlock.getWidth() - popupMenu.getWidth()) / 2, (onlineWidgetPackageBlock.getHeight()- popupMenu.getHeight()) / 2);
}
private static void closeConfirmDialog() {
if (themeConfirmDialog != null) {
themeConfirmDialog.dispose();
}
}
}

Loading…
Cancel
Save