Browse Source

REPORT-61125 交互优化更新

bugfix/11.0
kuangshuai 3 years ago
parent
commit
f93ff0961c
  1. 21
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  2. 24
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  3. 37
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  4. 42
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  5. 10
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

21
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

@ -31,6 +31,7 @@ import javax.swing.JComponent;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -231,7 +232,7 @@ public class GuideCreateUtils {
int returnVal = FineJOptionPane.showConfirmDialog( int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Guide_Option_Confirm_Not_Login"), Toolkit.i18nText("Fine-Design_Guide_Option_Confirm_Not_Login"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) { if (returnVal == JOptionPane.YES_OPTION) {
@ -243,16 +244,16 @@ public class GuideCreateUtils {
FineJOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Need_Network"), Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Need_Network"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.WARNING_MESSAGE); JOptionPane.WARNING_MESSAGE);
} }
public static void showNoFileAuthAlert() { public static void showNoFileAuthAlert() {
FineJOptionPane.showMessageDialog( FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), Toolkit.i18nText("Fine-Design_Guide_Option_Warning_No_Directory_Auth"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.INFORMATION_MESSAGE JOptionPane.WARNING_MESSAGE
); );
} }
@ -292,4 +293,14 @@ public class GuideCreateUtils {
return dialog; return dialog;
} }
public static JScrollPane getParentScrollPane(Component component) {
if (component.getParent() == null) {
return null;
}
if (component.getParent() instanceof JScrollPane) {
return (JScrollPane) component.getParent();
}
return getParentScrollPane(component.getParent());
}
} }

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

@ -35,10 +35,9 @@ public class ChangeLayoutComponentGuide {
public static Guide createGuide() { public static Guide createGuide() {
GuideScene scene = createScene(); GuideScene scene = createScene();
scene.nextScene(createScene2()) scene.nextScene(createScene2())
.nextScene(createScene3())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(createScene4()) .nextScene(createScene3())
.nextScene(createScene5()); .nextScene(createScene4());
Guide guide = GuideBuilder.newInstance() Guide guide = GuideBuilder.newInstance()
.setID(GuideIds.Guide.F001002) .setID(GuideIds.Guide.F001002)
@ -83,21 +82,6 @@ public class ChangeLayoutComponentGuide {
} }
private static GuideScene createScene2() { private static GuideScene createScene2() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addCustomTarget(
GuideCreateUtils.createTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
);
return true;
}
});
return scene;
}
private static GuideScene createScene3() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -117,7 +101,7 @@ public class ChangeLayoutComponentGuide {
return scene; return scene;
} }
private static GuideScene createScene4() { private static GuideScene createScene3() {
DragScene scene = new DragScene(); DragScene scene = new DragScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -158,7 +142,7 @@ public class ChangeLayoutComponentGuide {
return scene; return scene;
} }
private static GuideScene createScene5() { private static GuideScene createScene4() {
DisplayScene scene = new DisplayScene(); DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override

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

@ -1,18 +1,24 @@
package com.fr.design.mainframe.guide.creator.layout; package com.fr.design.mainframe.guide.creator.layout;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.FormThemeConfig;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XOccupiedLayout; import com.fr.design.designer.creator.XOccupiedLayout;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.imenu.UIHeadMenu; import com.fr.design.gui.imenu.UIHeadMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormWidgetDetailPane; import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.NorthRegionContainerPane; import com.fr.design.mainframe.NorthRegionContainerPane;
import com.fr.design.mainframe.guide.GuideIds; 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;
@ -24,6 +30,7 @@ import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock; import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.util.InstallComponentHelper; import com.fr.design.mainframe.share.util.InstallComponentHelper;
import com.fr.design.mainframe.theme.AsyncThemeFetcher;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.widget.ui.designer.NewFormPane; import com.fr.design.widget.ui.designer.NewFormPane;
import com.fr.design.widget.ui.designer.PredefinedLayoutPane; import com.fr.design.widget.ui.designer.PredefinedLayoutPane;
@ -47,6 +54,7 @@ public class UseLayoutAndComponentGuide {
private static final String RESOURCE_PATH = "/com/fr/report/guide/component"; 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 String defaultThemeName;
public static Guide createGuide() { public static Guide createGuide() {
GuideScene scene = createScene(); GuideScene scene = createScene();
@ -71,9 +79,23 @@ public class UseLayoutAndComponentGuide {
@Override @Override
public boolean prepared() { public boolean prepared() {
preloadShareComponent(); preloadShareComponent();
Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File")); List<String> themeNames = FormThemeConfig.getInstance().getThemeNames();
fileHeadMenu = ((UIHeadMenu) component); if (themeNames.size() > 0) {
return true; defaultThemeName = themeNames.get(Math.max(themeNames.size() - 2, 0));
AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(1, FormThemeConfig.getInstance());
asyncThemeFetcher.submit(defaultThemeName, new AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter<FormTheme>(){
@Override
public void afterCachedFetch(FormTheme theme) {
Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"));
fileHeadMenu = ((UIHeadMenu) component);
asyncThemeFetcher.shutdown();
GuideManager.getInstance().getCurrentGuide().start();
}
});
} else {
GuideManager.getInstance().getCurrentGuide().terminate();
}
return false;
} }
@Override @Override
@ -176,6 +198,15 @@ public class UseLayoutAndComponentGuide {
public boolean onComplete() { public boolean onComplete() {
newFormPane.createLayoutForm(); newFormPane.createLayoutForm();
newFormPane.getWindow().dispose(); newFormPane.getWindow().dispose();
FormTheme defaultTheme = FormThemeConfig.getInstance().cachedFetch(defaultThemeName);
if (defaultTheme != null) {
JTemplate newTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (newTemplate instanceof JForm) {
JForm jForm = (JForm) newTemplate;
jForm.setTemplateTheme(defaultTheme);
}
}
return true; return true;
} }
}); });

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

@ -43,6 +43,7 @@ import javax.swing.JPopupMenu;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
import java.awt.event.ContainerAdapter; import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent; import java.awt.event.ContainerEvent;
@ -62,7 +63,6 @@ public class DownloadComponentPackageGuide {
.nextScene(createScene3()) .nextScene(createScene3())
.nextScene(createScene4()) .nextScene(createScene4())
.nextScene(createScene5()) .nextScene(createScene5())
.nextScene(createScene6())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()); .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene());
Guide guide = GuideBuilder.newInstance() Guide guide = GuideBuilder.newInstance()
@ -93,7 +93,7 @@ public class DownloadComponentPackageGuide {
} }
boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets(); boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets();
if (loadWidgetSuccess) { if (loadWidgetSuccess) {
filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "layout_recommend", ".frm"); filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "download_theme", ".frm");
if (filePath == null) { if (filePath == null) {
GuideCreateUtils.showNoFileAuthAlert(); GuideCreateUtils.showNoFileAuthAlert();
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
@ -189,7 +189,7 @@ public class DownloadComponentPackageGuide {
if (onlineWidgetPackageBlock == null) { if (onlineWidgetPackageBlock == null) {
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
} else { } else {
JScrollPane scrollPane = getParentScrollPane(onlineWidgetPackageBlock); JScrollPane scrollPane = GuideCreateUtils.getParentScrollPane(onlineWidgetPackageBlock);
scrollPane.getVerticalScrollBar().setValue(onlineWidgetPackageBlock.getY()); scrollPane.getVerticalScrollBar().setValue(onlineWidgetPackageBlock.getY());
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
@ -207,24 +207,6 @@ public class DownloadComponentPackageGuide {
} }
private static GuideScene createScene3() { private static GuideScene createScene3() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addTarget(onlineWidgetPackageBlock);
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
Point location = getPopupMenuLocation();
scene.addCustomTarget(
GuideCreateUtils.createTarget(popupMenu),
GuideCreateUtils.getRelativeBounds(popupMenu, onlineWidgetPackageBlock, location.x, location.y)
);
return true;
}
});
return scene;
}
private static GuideScene createScene4() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -260,7 +242,7 @@ public class DownloadComponentPackageGuide {
return scene; return scene;
} }
private static GuideScene createScene5() { private static GuideScene createScene4() {
DisplayScene scene = new DisplayScene(); DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -279,7 +261,7 @@ public class DownloadComponentPackageGuide {
return scene; return scene;
} }
private static GuideScene createScene6() { private static GuideScene createScene5() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
@ -305,7 +287,8 @@ public class DownloadComponentPackageGuide {
private static Point getPopupMenuLocation() { private static Point getPopupMenuLocation() {
JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu(); JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu();
return new Point((onlineWidgetPackageBlock.getWidth() - popupMenu.getWidth()) / 2, (onlineWidgetPackageBlock.getHeight()- popupMenu.getHeight()) / 2); Dimension preferredSize = popupMenu.getPreferredSize();
return new Point((onlineWidgetPackageBlock.getWidth() - preferredSize.width) / 2, (onlineWidgetPackageBlock.getHeight()- preferredSize.height) / 2);
} }
private static void closeConfirmDialog() { private static void closeConfirmDialog() {
@ -313,15 +296,4 @@ public class DownloadComponentPackageGuide {
themeConfirmDialog.dispose(); themeConfirmDialog.dispose();
} }
} }
private static JScrollPane getParentScrollPane(Component component) {
if (component.getParent() == null) {
return null;
}
if (component.getParent() instanceof JScrollPane) {
return (JScrollPane) component.getParent();
}
return getParentScrollPane(component.getParent());
}
} }

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

@ -28,6 +28,7 @@ import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
import java.util.List; import java.util.List;
@ -35,7 +36,6 @@ import java.util.TimerTask;
public class ThemeToggleGuide { public class ThemeToggleGuide {
private static final int PAGE_THEME_COUNT = 9; 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;
@ -64,11 +64,11 @@ public class ThemeToggleGuide {
@Override @Override
public boolean prepared() { public boolean prepared() {
List<String> themeNames = FormThemeConfig.getInstance().getThemeNames(); List<String> themeNames = FormThemeConfig.getInstance().getThemeNames();
themeLoadCount = Math.min(themeNames.size(), PAGE_THEME_COUNT); themeLoadCount = themeNames.size();
if (themeLoadCount == 0) { if (themeLoadCount == 0) {
GuideManager.getInstance().getCurrentGuide().terminate(); GuideManager.getInstance().getCurrentGuide().terminate();
} }
selectedThemeIndex = Math.min(themeLoadCount - 1, DEFAULT_THEME_INDEX); selectedThemeIndex = Math.max(themeLoadCount - 5, 0);
int lazyCount = themeLoadCount; int lazyCount = themeLoadCount;
AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(PAGE_THEME_COUNT, FormThemeConfig.getInstance()); AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(PAGE_THEME_COUNT, FormThemeConfig.getInstance());
for (int index = 0; index < lazyCount; index++) { for (int index = 0; index < lazyCount; index++) {
@ -230,7 +230,11 @@ public class ThemeToggleGuide {
if (themeDialog == null) { if (themeDialog == null) {
themeDialog = new TemplateThemeUsingDialog(); themeDialog = new TemplateThemeUsingDialog();
} }
String name = FormThemeConfig.getInstance().getThemeNames().get(selectedThemeIndex);
Component component = ComponentUtils.findComponentByName(themeDialog.getContentPane(), name);
JScrollPane scrollPane = GuideCreateUtils.getParentScrollPane(component);
GuideCreateUtils.showDialogWithoutModal(themeDialog); GuideCreateUtils.showDialogWithoutModal(themeDialog);
scrollPane.getVerticalScrollBar().setValue(component.getY());
} }
private static void closeTemplateThemeUsingDialog() { private static void closeTemplateThemeUsingDialog() {

Loading…
Cancel
Save