|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.fr.design.mainframe.guide.creator.theme; |
|
|
|
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.FormThemeConfig; |
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.base.theme.TemplateTheme; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
@ -12,6 +13,7 @@ import com.fr.design.mainframe.guide.GuideIds; |
|
|
|
import com.fr.design.mainframe.guide.base.Guide; |
|
|
|
import com.fr.design.mainframe.guide.base.Guide; |
|
|
|
import com.fr.design.mainframe.guide.base.GuideBuilder; |
|
|
|
import com.fr.design.mainframe.guide.base.GuideBuilder; |
|
|
|
import com.fr.design.mainframe.guide.base.GuideLifecycleAdaptor; |
|
|
|
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.GuideCreateUtils; |
|
|
|
import com.fr.design.mainframe.guide.creator.GuideSceneHelper; |
|
|
|
import com.fr.design.mainframe.guide.creator.GuideSceneHelper; |
|
|
|
import com.fr.design.mainframe.guide.scene.ClickScene; |
|
|
|
import com.fr.design.mainframe.guide.scene.ClickScene; |
|
|
@ -20,6 +22,7 @@ import com.fr.design.mainframe.guide.scene.GuideScene; |
|
|
|
import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor; |
|
|
|
import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor; |
|
|
|
import com.fr.design.mainframe.guide.tip.BubbleTip; |
|
|
|
import com.fr.design.mainframe.guide.tip.BubbleTip; |
|
|
|
import com.fr.design.mainframe.guide.tip.GuideTip; |
|
|
|
import com.fr.design.mainframe.guide.tip.GuideTip; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.theme.AsyncThemeFetcher; |
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeBlock; |
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeBlock; |
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; |
|
|
|
import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; |
|
|
|
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; |
|
|
|
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; |
|
|
@ -27,12 +30,17 @@ import com.fr.design.utils.ComponentUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.TimerTask; |
|
|
|
import java.util.TimerTask; |
|
|
|
|
|
|
|
|
|
|
|
public class ThemeToggleGuide { |
|
|
|
public class ThemeToggleGuide { |
|
|
|
|
|
|
|
private static final int PAGE_THEME_COUNT = 9; |
|
|
|
|
|
|
|
private static final int DEFAULT_THEME_INDEX = 4; |
|
|
|
private static TemplateThemeUsingDialog themeDialog; |
|
|
|
private static TemplateThemeUsingDialog themeDialog; |
|
|
|
private static String TARGET_XCREATOR_NAME = "chart00"; |
|
|
|
private static String TARGET_XCREATOR_NAME = "chart00"; |
|
|
|
private static String filePath; |
|
|
|
private static String filePath; |
|
|
|
|
|
|
|
private static int themeLoadCount; |
|
|
|
|
|
|
|
private static int selectedThemeIndex; |
|
|
|
|
|
|
|
|
|
|
|
public static Guide createGuide() { |
|
|
|
public static Guide createGuide() { |
|
|
|
GuideScene scene1 = createScene1(); |
|
|
|
GuideScene scene1 = createScene1(); |
|
|
@ -55,15 +63,38 @@ public class ThemeToggleGuide { |
|
|
|
.registerLifecycle(new GuideLifecycleAdaptor() { |
|
|
|
.registerLifecycle(new GuideLifecycleAdaptor() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean prepared() { |
|
|
|
public boolean prepared() { |
|
|
|
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "toggle_theme", ".frm"); |
|
|
|
List<String> themeNames = FormThemeConfig.getInstance().getThemeNames(); |
|
|
|
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); |
|
|
|
themeLoadCount = Math.min(themeNames.size(), PAGE_THEME_COUNT); |
|
|
|
return true; |
|
|
|
if (themeLoadCount == 0) { |
|
|
|
|
|
|
|
GuideManager.getInstance().getCurrentGuide().terminate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
selectedThemeIndex = Math.min(themeLoadCount - 1, DEFAULT_THEME_INDEX); |
|
|
|
|
|
|
|
int lazyCount = themeLoadCount; |
|
|
|
|
|
|
|
AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(PAGE_THEME_COUNT, FormThemeConfig.getInstance()); |
|
|
|
|
|
|
|
for (int index = 0; index < lazyCount; index++) { |
|
|
|
|
|
|
|
asyncThemeFetcher.submit(themeNames.get(index), new AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter<FormTheme>(){ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void afterCachedFetch(FormTheme theme) { |
|
|
|
|
|
|
|
themeLoadCount--; |
|
|
|
|
|
|
|
if (themeLoadCount == 0) { |
|
|
|
|
|
|
|
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "toggle_theme", ".frm"); |
|
|
|
|
|
|
|
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); |
|
|
|
|
|
|
|
asyncThemeFetcher.shutdown(); |
|
|
|
|
|
|
|
GuideManager.getInstance().getCurrentGuide().start(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onEnd() { |
|
|
|
public void onEnd() { |
|
|
|
closeTemplateThemeUsingDialog(); |
|
|
|
closeTemplateThemeUsingDialog(); |
|
|
|
GuideCreateUtils.deleteGuideFile(filePath); |
|
|
|
GuideCreateUtils.deleteGuideFile(filePath); |
|
|
|
|
|
|
|
filePath = null; |
|
|
|
|
|
|
|
themeLoadCount = 0; |
|
|
|
|
|
|
|
selectedThemeIndex = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.getGuide(); |
|
|
|
.getGuide(); |
|
|
@ -105,7 +136,7 @@ public class ThemeToggleGuide { |
|
|
|
scene.showScene(); |
|
|
|
scene.showScene(); |
|
|
|
GuideCreateUtils.TIMER.purge(); |
|
|
|
GuideCreateUtils.TIMER.purge(); |
|
|
|
} |
|
|
|
} |
|
|
|
},300); |
|
|
|
},100); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -118,7 +149,7 @@ public class ThemeToggleGuide { |
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean prepared() { |
|
|
|
public boolean prepared() { |
|
|
|
String name = FormThemeConfig.getInstance().getThemeNames().get(4); |
|
|
|
String name = FormThemeConfig.getInstance().getThemeNames().get(selectedThemeIndex); |
|
|
|
Component component = ComponentUtils.findComponentByName(themeDialog.getContentPane(), name); |
|
|
|
Component component = ComponentUtils.findComponentByName(themeDialog.getContentPane(), name); |
|
|
|
if (component instanceof TemplateThemeBlock) { |
|
|
|
if (component instanceof TemplateThemeBlock) { |
|
|
|
scene.addClickTarget(component, ClickScene.ClickType.LEFT, true); |
|
|
|
scene.addClickTarget(component, ClickScene.ClickType.LEFT, true); |
|
|
@ -163,7 +194,7 @@ public class ThemeToggleGuide { |
|
|
|
if (target2 != null) { |
|
|
|
if (target2 != null) { |
|
|
|
uiButtonGroup[0] = (UIButtonGroup) target2; |
|
|
|
uiButtonGroup[0] = (UIButtonGroup) target2; |
|
|
|
target2 = ((UIButtonGroup) target2).getButton(0); |
|
|
|
target2 = ((UIButtonGroup) target2).getButton(0); |
|
|
|
scene.addClickTarget(target2, ClickScene.ClickType.LEFT, true); |
|
|
|
scene.addClickTarget(target2, ClickScene.ClickType.LEFT,true); |
|
|
|
scene.addBubbleTip( |
|
|
|
scene.addBubbleTip( |
|
|
|
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme"), |
|
|
|
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme"), |
|
|
|
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme_Description"), |
|
|
|
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme_Description"), |
|
|
@ -183,6 +214,7 @@ public class ThemeToggleGuide { |
|
|
|
if (uiButtonGroup[0] != null) { |
|
|
|
if (uiButtonGroup[0] != null) { |
|
|
|
uiButtonGroup[0].setSelectedIndex(0); |
|
|
|
uiButtonGroup[0].setSelectedIndex(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
GuideCreateUtils.getFormDesigner().repaint(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|