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