Browse Source

REPORT-57813 部分门槛问题

research/11.0
kuangshuai 3 years ago
parent
commit
9d32667138
  1. 11
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  2. 13
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  3. 26
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java
  4. 31
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

11
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -72,13 +72,9 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (component instanceof JComponent) { if (component instanceof JComponent) {
JComponent jComponent = (JComponent) component; JComponent jComponent = (JComponent) component;
image = ScreenImage.createImage(jComponent); image = ScreenImage.createImage(jComponent);
} else if (component instanceof Window){ } else (component instanceof Window){
Window window = (Window) component;
window.toFront();
image = ScreenImage.createImage(component);
showContainer();
} else {
image = captureImage(component); image = captureImage(component);
showContainer();
} }
targetList.add(component); targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle)); highlightList.add(getTargetComponentWithImage(image, rectangle));
@ -98,7 +94,6 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
public boolean addTarget(Rectangle rectangle) { public boolean addTarget(Rectangle rectangle) {
try { try {
targetList.add(null); targetList.add(null);
container.setVisible(false);
BufferedImage image = captureImage(rectangle); BufferedImage image = captureImage(rectangle);
highlightList.add(getTargetComponentWithImage(image, rectangle)); highlightList.add(getTargetComponentWithImage(image, rectangle));
return true; return true;
@ -121,6 +116,8 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return false; return false;
} }
Point point = SwingUtilities.convertPoint(component,0,0, container.getRootPane()); Point point = SwingUtilities.convertPoint(component,0,0, container.getRootPane());
origin = origin.intersection(new Rectangle(0,0,component.getWidth(), component.getHeight()));
Rectangle rectangle = new Rectangle(point.x + origin.x, point.y + origin.y, origin.width, origin.height); Rectangle rectangle = new Rectangle(point.x + origin.x, point.y + origin.y, origin.width, origin.height);
BufferedImage image; BufferedImage image;

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

@ -3,7 +3,6 @@ package com.fr.design.mainframe.guide.creator;
import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormCreatorDropTarget; import com.fr.design.mainframe.FormCreatorDropTarget;
@ -18,17 +17,15 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import sun.java2d.xr.XcbRequestCounter;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.InputStream; import java.io.InputStream;
import java.util.UUID; import java.util.UUID;
@ -42,7 +39,7 @@ public class GuideCreateUtils {
public static Rectangle getXCreatorBoundsRelative2FormDesigner(XCreator xCreator) { public static Rectangle getXCreatorBoundsRelative2FormDesigner(XCreator xCreator) {
FormDesigner designer = getFormDesigner(); FormDesigner designer = getFormDesigner();
Point point = SwingUtilities.convertPoint(xCreator, 0, 0, designer.getRootComponent()); Point point = SwingUtilities.convertPoint(xCreator, 0, 0, designer.getRootComponent());
return new Rectangle(point.x + designer.getPaintX(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight()); return new Rectangle(point.x + designer.getPaintX() - designer.getHorizontalScaleValue(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight());
} }
public static XCreator getXCreatorFormDesigner(String name) { public static XCreator getXCreatorFormDesigner(String name) {
@ -115,4 +112,10 @@ public class GuideCreateUtils {
public static void deleteGuideFile(String filePath) { public static void deleteGuideFile(String filePath) {
WorkContext.getWorkResource().delete(filePath); WorkContext.getWorkResource().delete(filePath);
} }
public static void openDialogWithoutModal(JDialog dialog) {
dialog.setModal(false);
dialog.setVisible(true);
}
} }

26
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.guide.creator; package com.fr.design.mainframe.guide.creator;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ibutton.UIPreviewButton; import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CenterRegionContainerPane; import com.fr.design.mainframe.CenterRegionContainerPane;
@ -11,6 +12,7 @@ import com.fr.design.mainframe.guide.scene.ClickScene;
import com.fr.design.mainframe.guide.scene.DisplayScene; import com.fr.design.mainframe.guide.scene.DisplayScene;
import com.fr.design.mainframe.guide.scene.GuideScene; 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.GuideTip; import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
@ -60,4 +62,28 @@ public class GuideSceneHelper {
}); });
return scene; return scene;
} }
public static GuideScene createSelectXCretorClickScene(String widgetName) {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Select_Widget"), BubbleTip.Direction.BOTTOM);
return super.prepared();
}
@Override
public void onComplete() {
super.onComplete();
FormDesigner designer = GuideCreateUtils.getFormDesigner();
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
designer.getSelectionModel().reset();
designer.getSelectionModel().selectACreator(xCreator);
}
});
return scene;
}
} }

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

@ -54,8 +54,8 @@ public class ThemeToggleGuide {
.nextScene(createScene3()) .nextScene(createScene3())
.nextScene(createScene4()) .nextScene(createScene4())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createSelectXCretorClickScene("chart00"))
.nextScene(createScene5()) .nextScene(createScene5())
.nextScene(createScene6())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createPreviewClickScene()); .nextScene(GuideSceneHelper.createPreviewClickScene());
@ -161,29 +161,6 @@ public class ThemeToggleGuide {
} }
private static GuideScene createScene5() { private static GuideScene createScene5() {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner("chart00");
scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT);
scene.addBubbleTip("选择此模板", BubbleTip.Direction.BOTTOM);
return super.prepared();
}
@Override
public void onComplete() {
super.onComplete();
FormDesigner designer = GuideCreateUtils.getFormDesigner();
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner("chart00");
designer.getSelectionModel().reset();
designer.getSelectionModel().selectACreator(xCreator);
}
});
return scene;
}
private static GuideScene createScene6() {
ClickScene scene = new ClickScene(); ClickScene scene = new ClickScene();
final UIButtonGroup[] uiButtonGroup = new UIButtonGroup[1]; final UIButtonGroup[] uiButtonGroup = new UIButtonGroup[1];
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@ -226,10 +203,8 @@ public class ThemeToggleGuide {
if (themeDialog == null) { if (themeDialog == null) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
themeDialog = new TemplateThemeUsingDialog<>(designerFrame, DesignerContext.getDesignerFrame().getSelectedJTemplate(), FormThemeConfig.getInstance()); themeDialog = new TemplateThemeUsingDialog<>(designerFrame, DesignerContext.getDesignerFrame().getSelectedJTemplate(), FormThemeConfig.getInstance());
themeDialog.setModal(false);
}
if (!themeDialog.isVisible()) {
themeDialog.setVisible(true);
} }
themeDialog.setModal(false);
themeDialog.setVisible(true);
} }
} }

Loading…
Cancel
Save