Browse Source

REPORT-60485 解决引导页中模板保存点取消也显示完成弹窗

research/11.0
kuangshuai 3 years ago
parent
commit
fc3ff14763
  1. 13
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  3. 7
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycle.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycleAdaptor.java
  5. 31
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java
  6. 3
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  7. 9
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  8. 9
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  9. 9
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

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

@ -10,14 +10,10 @@ import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
public class Guide {
public enum GuideState {
NONE, DONE
}
private String id;
private String name;
private String description;
private String completeMessage;
private GuideState state;
private GuideView guideView;
private GuideLifecycle lifecycle;
private boolean isComplete;
@ -31,7 +27,6 @@ public class Guide {
this.id = id;
this.name = name;
this.description = description;
this.state = GuideState.NONE;
}
public String getId() {
@ -69,14 +64,6 @@ public class Guide {
this.completeMessage = completeMessage;
}
public GuideState getState() {
return state;
}
public void setState(GuideState state) {
this.state = state;
}
public void setGuideView(GuideView guideView) {
this.guideView = guideView;
}

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

@ -321,8 +321,9 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
public void complete() {
container.getLayeredPane().remove(this);
container.repaint();
if (lifecycle != null) {
lifecycle.onComplete();
if (lifecycle != null && !lifecycle.onComplete()) {
return;
}
if (sceneFilter != null) {
nextScene = sceneFilter.getFilterScene();

7
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycle.java

@ -4,7 +4,7 @@ public interface GuideSceneLifecycle {
/**
* 引导场景准备工作
* scene 添加 target 应该在这个阶段处理
* @return
* @return 返回true自动执行scene, 返回false需要手动触发
*/
boolean prepared();
@ -14,7 +14,8 @@ public interface GuideSceneLifecycle {
void onShow();
/**
* scene 完成后
* scene 交互完成后处理
* @return 返回true自动进入下一个scene返回false需要手动触发
*/
void onComplete();
boolean onComplete();
}

4
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/GuideSceneLifecycleAdaptor.java

@ -12,7 +12,7 @@ public abstract class GuideSceneLifecycleAdaptor implements GuideSceneLifecycle
}
@Override
public void onComplete() {
public boolean onComplete() {
return true;
}
}

31
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java

@ -7,6 +7,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CenterRegionContainerPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.scene.ClickScene;
import com.fr.design.mainframe.guide.scene.DisplayScene;
@ -15,6 +16,8 @@ import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor;
import com.fr.design.mainframe.guide.tip.BubbleTip;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import java.awt.Window;
@ -43,9 +46,28 @@ public class GuideSceneHelper {
}
@Override
public void onComplete() {
public boolean onComplete() {
GuideManager.getInstance().getCurrentGuide().getGuideView().dismissGuide();
WebPreviewUtils.preview(DesignerContext.getDesignerFrame().getSelectedJTemplate());
JTemplate jt = DesignerContext.getDesignerFrame().getSelectedJTemplate();
jt.stopEditing();
if (!jt.isSaved()) {
CallbackSaveWorker worker = jt.save2Env();
if (worker instanceof EmptyCallBackSaveWorker) {
GuideManager.getInstance().getCurrentGuide().terminate();
} else {
worker.addSuccessCallback(new Runnable() {
@Override
public void run() {
WebPreviewUtils.preview(jt);
GuideManager.getInstance().getCurrentGuide().complete();
}
});
}
worker.start(jt.getRuntimeId());
return false;
}
WebPreviewUtils.preview(jt);
return true;
}
});
return scene;
@ -56,7 +78,6 @@ public class GuideSceneHelper {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Select_Widget"), BubbleTip.Direction.BOTTOM);
@ -64,12 +85,12 @@ public class GuideSceneHelper {
}
@Override
public void onComplete() {
super.onComplete();
public boolean onComplete() {
FormDesigner designer = GuideCreateUtils.getFormDesigner();
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
designer.getSelectionModel().reset();
designer.getSelectionModel().selectACreator(xCreator);
return true;
}
});
return scene;

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

@ -141,7 +141,7 @@ public class ChangeLayoutComponentGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
FormDesigner formDesigner = GuideCreateUtils.getFormDesigner();
XCreator from = GuideCreateUtils.getXCreatorFormDesigner(TARGET_FROM_NAME);
@ -152,6 +152,7 @@ public class ChangeLayoutComponentGuide {
GuideCreateUtils.addXCreatorToXLayoutContainer(from, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box1"), true);
GuideCreateUtils.addXCreatorToXLayoutContainer(to, (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("box0"), true);
return true;
}
});
return scene;

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

@ -115,9 +115,10 @@ public class UseLayoutAndComponentGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
newFormPane = new NewFormPane();
GuideCreateUtils.showDialogWithoutModal(newFormPane.getWindow());
return true;
}
});
return scene;
@ -174,9 +175,10 @@ public class UseLayoutAndComponentGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
newFormPane.createLayoutForm();
newFormPane.getWindow().dispose();
return true;
}
});
return scene;
@ -209,11 +211,12 @@ public class UseLayoutAndComponentGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
LocalWidgetBlock block = getLocalWidgetBlock(shareID);
XCreator xCreator = block.transformXCreator(block);
XOccupiedLayout xOccupiedLayout = getXOccupiedLayout(name);
GuideCreateUtils.addXCreatorToXLayoutContainer(xCreator, xOccupiedLayout, false);
return true;
}
});
return scene;

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

@ -157,8 +157,9 @@ public class DownloadComponentPackageGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
FormWidgetDetailPane.getInstance().swich2Online();
return true;
}
});
return scene;
@ -221,13 +222,14 @@ public class DownloadComponentPackageGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
downLoadTheme();
themeConfirmDialog = GuideCreateUtils.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Apply_Suitable_Theme_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
FineJOptionPane.OK_CANCEL_OPTION);
return true;
}
});
return scene;
@ -264,12 +266,13 @@ public class DownloadComponentPackageGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
closeConfirmDialog();
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateThemeConfig<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
TemplateTheme theme = config.cachedFetch(downloadThemeName);
template.setTemplateTheme(theme);
return true;
}
});
return scene;

9
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

@ -86,8 +86,9 @@ public class ThemeToggleGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
showTemplateThemeUsingDialog();
return true;
}
});
@ -142,8 +143,9 @@ public class ThemeToggleGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
GuideCreateUtils.selectXCreatorByWidgetName(TARGET_XCREATOR_NAME);
return true;
}
});
return scene;
@ -179,10 +181,11 @@ public class ThemeToggleGuide {
}
@Override
public void onComplete() {
public boolean onComplete() {
if (uiButtonGroup[0] != null) {
uiButtonGroup[0].setSelectedIndex(0);
}
return true;
}
});
return scene;

Loading…
Cancel
Save