|
|
|
@ -20,24 +20,32 @@ 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.utils.ComponentUtils; |
|
|
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import java.awt.Point; |
|
|
|
|
import java.awt.Rectangle; |
|
|
|
|
|
|
|
|
|
public class ChangeLayoutComponentGuide { |
|
|
|
|
private static final String TARGET_FROM_NAME = "chart0"; |
|
|
|
|
private static final String TARGET_TO_NAME = "chart1"; |
|
|
|
|
private static UIButton switchButton; |
|
|
|
|
|
|
|
|
|
private static String filePath; |
|
|
|
|
|
|
|
|
|
public static Guide createGuide() { |
|
|
|
|
GuideScene scene = createScene(); |
|
|
|
|
scene.nextScene(createScene2()) |
|
|
|
|
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) |
|
|
|
|
.nextScene(createScene3()) |
|
|
|
|
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) |
|
|
|
|
.nextScene(createScene4()) |
|
|
|
|
.nextScene(createScene5()) |
|
|
|
|
.nextScene(GuideSceneHelper.createPreviewClickScene()); |
|
|
|
|
|
|
|
|
|
Guide guide = GuideBuilder.newInstance() |
|
|
|
|
.setID(GuideIds.Guide.F001002) |
|
|
|
|
.setName(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Name")) |
|
|
|
|
.setDescription(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Description")) |
|
|
|
|
.setCompleteMessage(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002Gui_Complete_Message")) |
|
|
|
|
.addScene(scene) |
|
|
|
|
.registerLifecycle(new GuideLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
@ -71,17 +79,14 @@ public class ChangeLayoutComponentGuide {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static GuideScene createScene2() { |
|
|
|
|
ClickScene scene = new ClickScene(); |
|
|
|
|
DisplayScene scene = new DisplayScene(); |
|
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
|
public boolean prepared() { |
|
|
|
|
scene.addCustomTarget( |
|
|
|
|
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()), |
|
|
|
|
GuideCreateUtils.getPopupMenuBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight()) |
|
|
|
|
GuideCreateUtils.createTarget(switchButton.getComponentPopupMenu()), |
|
|
|
|
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight()) |
|
|
|
|
); |
|
|
|
|
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f); |
|
|
|
|
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true); |
|
|
|
|
switchButton.getComponentPopupMenu().setVisible(false); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
@ -89,13 +94,50 @@ public class ChangeLayoutComponentGuide {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static GuideScene createScene3() { |
|
|
|
|
ClickScene scene = new ClickScene(); |
|
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
|
public boolean prepared() { |
|
|
|
|
switchButton.getComponentPopupMenu().setVisible(true); |
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
scene.addCustomTarget( |
|
|
|
|
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()), |
|
|
|
|
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight()) |
|
|
|
|
); |
|
|
|
|
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true); |
|
|
|
|
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f); |
|
|
|
|
switchButton.getComponentPopupMenu().setVisible(false); |
|
|
|
|
scene.showScene(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return scene; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static GuideScene createScene4() { |
|
|
|
|
DragScene scene = new DragScene(); |
|
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
|
public boolean prepared() { |
|
|
|
|
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getXCreatorFormDesigner("absolute0")), DragScene.DragType.FROM); |
|
|
|
|
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getXCreatorFormDesigner("absolute1")), DragScene.DragType.TO); |
|
|
|
|
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Drag"), GuideTip.Direction.TOP); |
|
|
|
|
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_FROM_NAME), DragScene.DragType.FROM); |
|
|
|
|
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_TO_NAME), DragScene.DragType.TO); |
|
|
|
|
|
|
|
|
|
Rectangle fromBounds = GuideCreateUtils.getXCreatorBoundsRelative2GuideView(TARGET_FROM_NAME); |
|
|
|
|
Rectangle toBounds = GuideCreateUtils.getXCreatorBoundsRelative2GuideView(TARGET_TO_NAME); |
|
|
|
|
|
|
|
|
|
Point lineArrowPoint1 = new Point(fromBounds.x + fromBounds.width / 2, fromBounds.y - 5); |
|
|
|
|
Point lineArrowPoint2 = new Point(fromBounds.x + fromBounds.width / 2, fromBounds.y - 25); |
|
|
|
|
Point lineArrowPoint3 = new Point(toBounds.x + toBounds.width / 2, toBounds.y - 25); |
|
|
|
|
Point lineArrowPoint4 = new Point(toBounds.x + toBounds.width / 2, toBounds.y - 5); |
|
|
|
|
|
|
|
|
|
scene.addLineArrow(lineArrowPoint1, lineArrowPoint2, lineArrowPoint3, lineArrowPoint4); |
|
|
|
|
|
|
|
|
|
Point bubbleAnchor = new Point((lineArrowPoint2.x + lineArrowPoint3.x) / 2, lineArrowPoint2.y); |
|
|
|
|
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Drag"), null, GuideTip.Direction.TOP, bubbleAnchor, 0.5f); |
|
|
|
|
return super.prepared(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -103,8 +145,8 @@ public class ChangeLayoutComponentGuide {
|
|
|
|
|
public void onComplete() { |
|
|
|
|
FormDesigner formDesigner = GuideCreateUtils.getFormDesigner(); |
|
|
|
|
|
|
|
|
|
XCreator from = GuideCreateUtils.getXCreatorFormDesigner("absolute0"); |
|
|
|
|
XLayoutContainer to = (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner("absolute1"); |
|
|
|
|
XCreator from = GuideCreateUtils.getXCreatorFormDesigner(TARGET_FROM_NAME); |
|
|
|
|
XLayoutContainer to = (XLayoutContainer) GuideCreateUtils.getXCreatorFormDesigner(TARGET_TO_NAME); |
|
|
|
|
|
|
|
|
|
formDesigner.getSelectionModel().removeCreator(from, from.getWidth(), from.getHeight()); |
|
|
|
|
formDesigner.getSelectionModel().removeCreator(to, to.getWidth(),to.getHeight()); |
|
|
|
@ -116,15 +158,13 @@ public class ChangeLayoutComponentGuide {
|
|
|
|
|
return scene; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static GuideScene createScene4() { |
|
|
|
|
private static GuideScene createScene5() { |
|
|
|
|
DisplayScene scene = new DisplayScene(); |
|
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
|
public boolean prepared() { |
|
|
|
|
Rectangle rootBounds = GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getFormDesigner().getRootComponent()); |
|
|
|
|
Rectangle bound3 = GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(GuideCreateUtils.getXCreatorFormDesigner("absolute2")); |
|
|
|
|
Rectangle targetBounds = new Rectangle(rootBounds.x, rootBounds.y, rootBounds.width, bound3.y - rootBounds.y); |
|
|
|
|
scene.addTarget(GuideCreateUtils.getFormDesigner(), targetBounds); |
|
|
|
|
scene.addTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_FROM_NAME)); |
|
|
|
|
scene.addTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(TARGET_TO_NAME)); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|