|
|
|
@ -30,15 +30,22 @@ import com.fr.design.widget.ui.designer.PredefinedLayoutPane;
|
|
|
|
|
import com.fr.form.share.Group; |
|
|
|
|
import com.fr.form.share.group.DefaultShareGroup; |
|
|
|
|
import com.fr.form.share.group.DefaultShareGroupManager; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.TimerTask; |
|
|
|
|
|
|
|
|
|
public class UseLayoutAndComponentGuide { |
|
|
|
|
private static final String[] PRE_INSTALL_COMPONENTS = { |
|
|
|
|
"大屏标题-酷炫蓝.25fcd194-d4db-406f-8a08-210f3c262870.reu", |
|
|
|
|
"散点闪烁地图-酷炫蓝.5e17c2eb-5b18-4b6c-854a-5ffff7f6337a.reu", |
|
|
|
|
"排名明细表.b4dab4f2-7b1a-4540-a2d4-65c3e080334e.reu" |
|
|
|
|
}; |
|
|
|
|
private static final String RESOURCE_PATH = "/com/fr/report/guide/component"; |
|
|
|
|
private static UIHeadMenu fileHeadMenu; |
|
|
|
|
private static NewFormPane newFormPane; |
|
|
|
|
private static int autoInstallComponentCount; |
|
|
|
|
private static String[] autoInstallComponentNames; |
|
|
|
|
|
|
|
|
|
public static Guide createGuide() { |
|
|
|
|
GuideScene scene = createScene(); |
|
|
|
@ -46,9 +53,9 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
.nextScene(createScene3()) |
|
|
|
|
.nextScene(createScene4()) |
|
|
|
|
.nextScene(createScene5()) |
|
|
|
|
.nextScene(createScene6("box0",0)) |
|
|
|
|
.nextScene(createScene6("box1",1)) |
|
|
|
|
.nextScene(createScene6("box2",2)) |
|
|
|
|
.nextScene(createScene6("box0","25fcd194-d4db-406f-8a08-210f3c262870")) |
|
|
|
|
.nextScene(createScene6("box1","5e17c2eb-5b18-4b6c-854a-5ffff7f6337a")) |
|
|
|
|
.nextScene(createScene6("box2","b4dab4f2-7b1a-4540-a2d4-65c3e080334e")) |
|
|
|
|
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) |
|
|
|
|
.nextScene(GuideSceneHelper.createPreviewClickScene()); |
|
|
|
|
|
|
|
|
@ -57,6 +64,7 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
.setID(GuideIds.Guide.F001001) |
|
|
|
|
.setName(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Name")) |
|
|
|
|
.setDescription(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Description")) |
|
|
|
|
.setCompleteMessage(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Complete_Message")) |
|
|
|
|
.addScene(scene) |
|
|
|
|
.registerLifecycle(new GuideLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
@ -101,8 +109,7 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
fileHeadMenu.getPopupMenu().setVisible(false); |
|
|
|
|
|
|
|
|
|
newFormPane = new NewFormPane(); |
|
|
|
|
newFormPane.getWindow().setModal(false); |
|
|
|
|
newFormPane.showWindow(); |
|
|
|
|
GuideCreateUtils.showDialogWithoutModal(newFormPane.getWindow()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return scene; |
|
|
|
@ -113,8 +120,16 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
|
public boolean prepared() { |
|
|
|
|
GuideCreateUtils.TIMER.schedule(new TimerTask() { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
scene.addTarget(newFormPane.getWindow()); |
|
|
|
|
return true; |
|
|
|
|
scene.showScene(); |
|
|
|
|
GuideCreateUtils.TIMER.purge(); |
|
|
|
|
} |
|
|
|
|
}, 300); |
|
|
|
|
scene.addTarget(newFormPane.getWindow()); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return scene; |
|
|
|
@ -175,20 +190,20 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
return scene; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static GuideScene createScene6(String name, int blockIndex) { |
|
|
|
|
public static GuideScene createScene6(String name, String shareID) { |
|
|
|
|
DragScene scene = new DragScene(); |
|
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
|
@Override |
|
|
|
|
public boolean prepared() { |
|
|
|
|
scene.addDragTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(getXOccupiedLayout(name)), DragScene.DragType.TO); |
|
|
|
|
scene.addDragTarget(getLocalWidgetBlock(blockIndex), DragScene.DragType.FROM); |
|
|
|
|
scene.addDragTarget(getLocalWidgetBlock(shareID), DragScene.DragType.FROM); |
|
|
|
|
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_Drag"), GuideTip.Direction.LEFT); |
|
|
|
|
return super.prepared(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onComplete() { |
|
|
|
|
LocalWidgetBlock block = getLocalWidgetBlock(blockIndex); |
|
|
|
|
LocalWidgetBlock block = getLocalWidgetBlock(shareID); |
|
|
|
|
XCreator xCreator = block.transformXCreator(block); |
|
|
|
|
XOccupiedLayout xOccupiedLayout = getXOccupiedLayout(name); |
|
|
|
|
GuideCreateUtils.addXCreatorToXLayoutContainer(xCreator, xOccupiedLayout, false); |
|
|
|
@ -201,25 +216,22 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
return (XOccupiedLayout) GuideCreateUtils.getXCreatorFormDesigner(name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static LocalWidgetBlock getLocalWidgetBlock(int index) { |
|
|
|
|
return (LocalWidgetBlock) ComponentUtils.findComponentsByClass(LocalWidgetRepoPane.getInstance(), LocalWidgetBlock.class).get(index); |
|
|
|
|
private static LocalWidgetBlock getLocalWidgetBlock(String id) { |
|
|
|
|
List<Component> widgetBlockList = ComponentUtils.findComponentsByClass(LocalWidgetRepoPane.getInstance(), LocalWidgetBlock.class); |
|
|
|
|
for (Component component : widgetBlockList) { |
|
|
|
|
LocalWidgetBlock localWidgetBlock = (LocalWidgetBlock) component; |
|
|
|
|
if (StringUtils.equals(localWidgetBlock.getBindInfo().getId(), id)) { |
|
|
|
|
return localWidgetBlock; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void preloadShareComponent() { |
|
|
|
|
autoInstallComponentCount = 3; |
|
|
|
|
try { |
|
|
|
|
DefaultShareGroupManager.getInstance().refresh(); |
|
|
|
|
Group shareGroup = DefaultShareGroupManager.getInstance().getGroup(DefaultShareGroup.GROUP_NAME); |
|
|
|
|
if (shareGroup != null) { |
|
|
|
|
DefaultShareGroup defaultShareGroup = (DefaultShareGroup) shareGroup; |
|
|
|
|
int currentWidgetCount = defaultShareGroup.getAllBindInfoList().length; |
|
|
|
|
autoInstallComponentCount = autoInstallComponentCount - (Math.min(autoInstallComponentCount, currentWidgetCount)); |
|
|
|
|
} |
|
|
|
|
if (autoInstallComponentCount > 0) { |
|
|
|
|
autoInstallComponentNames = InstallComponentHelper.installPreComponent(autoInstallComponentCount); |
|
|
|
|
InstallComponentHelper.installShareComponents(RESOURCE_PATH, PRE_INSTALL_COMPONENTS); |
|
|
|
|
DefaultShareGroupManager.getInstance().refresh(); |
|
|
|
|
LocalWidgetRepoPane.getInstance().refreshAllGroupPane(); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
@ -227,15 +239,13 @@ public class UseLayoutAndComponentGuide {
|
|
|
|
|
|
|
|
|
|
static private void removeAutoInstalledComponent() { |
|
|
|
|
Group shareGroup = DefaultShareGroupManager.getInstance().getGroup(DefaultShareGroup.GROUP_NAME); |
|
|
|
|
if (shareGroup != null && autoInstallComponentNames != null) { |
|
|
|
|
if (shareGroup != null) { |
|
|
|
|
DefaultShareGroup defaultShareGroup = (DefaultShareGroup) shareGroup; |
|
|
|
|
List<String> installedList = new ArrayList<>(); |
|
|
|
|
for (String componentName : autoInstallComponentNames) { |
|
|
|
|
if (componentName != null) { |
|
|
|
|
for (String componentName : PRE_INSTALL_COMPONENTS) { |
|
|
|
|
String uuid = componentName.split("\\.")[1]; |
|
|
|
|
installedList.add(uuid); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
defaultShareGroup.unInstallSelect(installedList); |
|
|
|
|
LocalWidgetRepoPane.getInstance().refreshAllGroupPane(); |
|
|
|
|
} |
|
|
|
|