|
|
|
@ -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)); |
|
|
|
|