Browse Source

REPORT-60942 视觉优化--高亮区域加个5像素的边框

bugfix/11.0
kuangshuai 3 years ago
parent
commit
7c88137c5b
  1. 20
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  2. 43
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

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

@ -9,6 +9,7 @@ import com.fr.design.mainframe.guide.tip.BubbleTip;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -21,6 +22,7 @@ import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@ -33,6 +35,7 @@ import java.util.List;
public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private static final int DEFAULT_ARROW_HEIGHT = 12;
private static final int DEFAULT_ARROW_WIDTH = 18;
public static final Insets DEFAULT_HIGHLIGHT_INSETS = new Insets(5, 5, 5, 5);
private GuideScene nextScene;
private SceneFilter sceneFilter;
@ -169,9 +172,22 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) {
ImageIcon ic = new ImageIcon(image);
UILabel label = new UILabel(ic);
UILabel label = new UILabel(ic){
@Override
public Insets getInsets() {
return DEFAULT_HIGHLIGHT_INSETS;
}
};
label.setBorder(BorderFactory.createMatteBorder(DEFAULT_HIGHLIGHT_INSETS.top, DEFAULT_HIGHLIGHT_INSETS.left, DEFAULT_HIGHLIGHT_INSETS.bottom, DEFAULT_HIGHLIGHT_INSETS.right, Color.WHITE));
label.setOpaque(true);
label.setBounds(rectangle);
label.setBounds(new Rectangle(
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
));
return label;
}

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

@ -14,6 +14,7 @@ import com.fr.design.mainframe.FormCreatorDropTarget;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.scene.AbstractGuideScene;
import com.fr.design.mainframe.guide.utils.ScreenImage;
import com.fr.design.utils.ComponentUtils;
import com.fr.file.FileNodeFILE;
@ -24,6 +25,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
@ -32,8 +34,10 @@ import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@ -153,11 +157,50 @@ public class GuideCreateUtils {
return new UILabel(ic);
}
public static UILabel createTarget(JComponent component, boolean isModal, boolean withBorder) {
ImageIcon ic;
if (isModal) {
ic = new ImageIcon(ScreenImage.createImageWithModal(component));
} else {
ic = new ImageIcon(ScreenImage.createImage(component));
}
return createImageTarget(ic, withBorder);
}
private static UILabel createImageTarget(ImageIcon ic, boolean withBorder) {
if (withBorder) {
Insets insets = AbstractGuideScene.DEFAULT_HIGHLIGHT_INSETS;
UILabel label = new UILabel(ic){
@Override
public Insets getInsets() {
return insets;
}
};
label.setBorder(BorderFactory.createMatteBorder(insets.top, insets.left, insets.bottom, insets.right, Color.WHITE));
label.setOpaque(true);
return label;
} else {
return new UILabel(ic);
}
}
public static Rectangle getRelativeBounds(Component component, Component parent, int x, int y) {
Point point = SwingUtilities.convertPoint(parent,0,0, GuideManager.getInstance().getCurrentGuide().getGuideView().getRootPane());
return new Rectangle(point.x + x, point.y + y, component.getWidth(), component.getHeight());
}
public static Rectangle getRelativeBoundsWithBorder(Component component, Component parent, int x, int y) {
Rectangle rectangle = getRelativeBounds(component, parent, x, y);
Insets insets = AbstractGuideScene.DEFAULT_HIGHLIGHT_INSETS;
return new Rectangle(
rectangle.x - insets.left,
rectangle.y - insets.top,
rectangle.width + insets.left + insets.right,
rectangle.height + insets.top + insets.bottom
);
}
public static String openGuideFile(String sourcePath, String fileName, String suffix) {
String fileWorkPath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, FILE_PREFIX + UUID.randomUUID().toString() + suffix);
InputStream inputStream = GuideCreateUtils.class.getResourceAsStream(StableUtils.pathJoin(sourcePath, fileName + suffix));

Loading…
Cancel
Save