Browse Source

Merge pull request #1183 in DESIGN/design from bugfix/10.0 to release/10.0

* commit '1da444f15068d4130d7da4e50cf8bda8c31293ce':
  update
  REPORT-21486 设计器 取色器 双屏情况下 在交换屏幕位置后 仍有一些二问题 && REPORT-22214 禁止修改控件js事件名
  REPORT-22410 10.0删除tab时弹窗写的Finereport8.0
  REPORT-21556 导入excel不显示数据
  hashCode 和 equals 单元测试
  修改 toString 方法展示完整信息
  REPORT-22114 远程设计配置界面优先以直接 url 地址填写的为准并尽可能保证联动
  REPORT-21486 设计器 双屏情况,取色器经过双屏连接处会卡死
  REPORT-21202 tab块修改为菜单样式之后改不回默认了
feature/big-screen
neil 5 years ago
parent
commit
17fdae5969
  1. 2
      designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java
  2. 79
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  3. 14
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  4. 1
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  5. 37
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  6. 48
      designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java
  7. 21
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  8. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  9. 1
      designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java
  10. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

2
designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java

@ -149,6 +149,8 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
commit2dbJavaScript.setCallBack(this.javaScriptActionPane.getCall());
this.javaScriptActionPane.setCall(null);
return commit2dbJavaScript;
}

79
designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java

@ -4,7 +4,8 @@ package com.fr.design.style.color;
* Created by plough on 2016/12/22.
*/
import com.fr.base.BaseUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
@ -19,8 +20,7 @@ import java.awt.image.BufferedImage;
/**
* 取色框
*/
public class ColorPicker extends JDialog implements ActionListener
{
public class ColorPicker extends JDialog implements ActionListener {
private Container container = getContentPane(); // 主容器
private int setCoordinateX; // 取色框x坐标
private int setCoordinateY; // 取色框y坐标
@ -42,8 +42,7 @@ public class ColorPicker extends JDialog implements ActionListener
/**
* 构造函数创建一个取色框窗体
*/
public ColorPicker(ColorSelectable colorSelectable, Boolean setColorRealTime)
{
public ColorPicker(ColorSelectable colorSelectable, Boolean setColorRealTime) {
setUndecorated(true); // 去掉窗体边缘
setResizable(false);
Shape shape = new Ellipse2D.Double(0, 0, colorPickerSize, colorPickerSize);
@ -78,7 +77,6 @@ public class ColorPicker extends JDialog implements ActionListener
}
colorPickerPanel.captureScreen();
}
// System.out.println(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow());
}
/**
@ -95,11 +93,33 @@ public class ColorPicker extends JDialog implements ActionListener
public void updateLocation() {
mousePos = MouseInfo.getPointerInfo().getLocation();
setCoordinateX = mousePos.x - getSize().width/2;
setCoordinateY = mousePos.y- getSize().height/2;
updateCoordinate();
setLocation(setCoordinateX, setCoordinateY);
updateMousePos();
updateCoordinate();
colorPickerPanel.setMagnifierLocation(setCoordinateX,
setCoordinateY);
setLocation(setCoordinateX, setCoordinateY);
}
private void updateCoordinate() {
setCoordinateX = mousePos.x - getSize().width / 2;
setCoordinateY = mousePos.y - getSize().height / 2;
}
/**
* 兼容多屏下鼠标位置的计算
*/
private void updateMousePos() {
Rectangle bounds = GUICoreUtils.getRectScreen();
mousePos.x -= bounds.x;
mousePos.y -= bounds.y;
if (mousePos.x < 0) {
mousePos.x *= -1;
}
if (mousePos.y < 0) {
mousePos.y *= -1;
}
}
/**
@ -107,8 +127,7 @@ public class ColorPicker extends JDialog implements ActionListener
*
* @param colorPickerSize 取色框尺寸
*/
public void updateSize(int colorPickerSize)
{
public void updateSize(int colorPickerSize) {
colorPickerPanel.setColorPickerSize(colorPickerSize);
setSize(colorPickerSize, colorPickerSize);
validate(); // 更新所有子控件
@ -129,16 +148,15 @@ public class ColorPicker extends JDialog implements ActionListener
setCursor(cu);
}
private class MouseFunctions extends MouseAdapter
{
private class MouseFunctions extends MouseAdapter {
@Override
public void mousePressed(MouseEvent e) {
pickComplete(e.getButton() == e.BUTTON1); // 左键确定
pickComplete(e.getButton() == MouseEvent.BUTTON1); // 左键确定
}
}
}
class ColorPickerPanel extends JPanel
{
class ColorPickerPanel extends JPanel {
private BufferedImage screenImage;
private Image colorPickerFrame; // 取色框的边框图案
private int colorPickerSize; // 取色框尺寸
@ -155,11 +173,11 @@ class ColorPickerPanel extends JPanel
/**
* 带参数的构造函数
*
* @param scaleFactor 放大倍数
*/
public ColorPickerPanel(int scaleFactor)
{
colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
public ColorPickerPanel(int scaleFactor) {
colorPickerFrame = IOUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
this.scaleFactor = scaleFactor;
captureScreen();
}
@ -168,26 +186,22 @@ class ColorPickerPanel extends JPanel
* 截屏
*/
public void captureScreen() {
try
{
try {
robot = new Robot();
}
catch (AWTException e)
{
} catch (AWTException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
// 截屏幕
screenImage = robot.createScreenCapture(new Rectangle(0, 0, Toolkit
.getDefaultToolkit().getScreenSize().width, Toolkit
.getDefaultToolkit().getScreenSize().height));
screenImage = robot.createScreenCapture(GUICoreUtils.getRectScreen());
}
/**
* 设置取色框的位置
*
* @param locationX x坐标
* @param locationY y坐标
*/
public void setMagnifierLocation(int locationX, int locationY)
{
public void setMagnifierLocation(int locationX, int locationY) {
this.locationX = locationX;
this.locationY = locationY;
repaint(); // 注意重画控件
@ -201,13 +215,12 @@ class ColorPickerPanel extends JPanel
return new Color(R, G, B);
}
public void setColorPickerSize(int colorPickerSize)
{
public void setColorPickerSize(int colorPickerSize) {
this.colorPickerSize = colorPickerSize;
}
public void paintComponent(Graphics g)
{
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

14
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -79,6 +79,8 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -967,4 +969,16 @@ public final class GUICoreUtils {
}
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
}
/**
* 获取当前所有显示器设备的总长总宽
* @return
*/
public static Rectangle getRectScreen() {
Rectangle rectangle = new Rectangle(0, 0, 0, 0);
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
rectangle = rectangle.union(gd.getDefaultConfiguration().getBounds());
}
return rectangle;
}
}

1
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -644,6 +644,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
remoteWorkspaceURL.setPort(port);
remoteWorkspaceURL.setWeb(web);
remoteWorkspaceURL.setServlet(servlet);
remoteWorkspaceURL.resetUrl();
}

37
designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -1,10 +1,9 @@
package com.fr.env;
import com.fr.stable.AssistUtils;
import com.fr.stable.FCloneable;
import com.fr.stable.StringUtils;
import java.util.Objects;
/**
* @author yaohwu
*/
@ -42,6 +41,7 @@ public class RemoteWorkspaceURL implements FCloneable {
private String port;
private String web;
private String servlet;
private String url;
/**
@ -51,7 +51,7 @@ public class RemoteWorkspaceURL implements FCloneable {
* @param url x:x/x/x/x
*/
public RemoteWorkspaceURL(String url) {
this.url = url;
// 没有写协议名称 默认 使用 http 协议
if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) {
url = HTTP + url;
@ -116,11 +116,15 @@ public class RemoteWorkspaceURL implements FCloneable {
}
public String getURL() {
if (this.url != null) {
return url;
}
String prefix = isHttps ? HTTPS : HTTP;
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY;
String webAppNameSlash = StringUtils.isNotEmpty(web) ? "/" : StringUtils.EMPTY;
String servletNameSlash = StringUtils.isNotEmpty(servlet) ? "/" : StringUtils.EMPTY;
return prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet;
this.url = prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet;
return this.url;
}
@ -164,26 +168,24 @@ public class RemoteWorkspaceURL implements FCloneable {
return servlet;
}
public void resetUrl() {
this.url = null;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RemoteWorkspaceURL that = (RemoteWorkspaceURL) o;
return isHttps == that.isHttps &&
Objects.equals(host, that.host) &&
Objects.equals(port, that.port) &&
Objects.equals(web, that.web) &&
Objects.equals(servlet, that.servlet);
return o instanceof RemoteWorkspaceURL && AssistUtils.equals(isHttps, ((RemoteWorkspaceURL) o).isHttps)
&& AssistUtils.equals(host, ((RemoteWorkspaceURL) o).host)
&& AssistUtils.equals(port, ((RemoteWorkspaceURL) o).port)
&& AssistUtils.equals(web, ((RemoteWorkspaceURL) o).web)
&& AssistUtils.equals(servlet, ((RemoteWorkspaceURL) o).servlet)
&& AssistUtils.equals(url, ((RemoteWorkspaceURL) o).url);
}
@Override
public int hashCode() {
return Objects.hash(isHttps, host, port, web, servlet);
return AssistUtils.hashCode(isHttps, host, port, web, servlet, url);
}
@Override
@ -194,6 +196,7 @@ public class RemoteWorkspaceURL implements FCloneable {
", port='" + port + '\'' +
", web='" + web + '\'' +
", servlet='" + servlet + '\'' +
", url='" + url + '\'' +
'}';
}

48
designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java → designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java vendored

@ -4,11 +4,57 @@ import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
/**
* @author yaohwu
*/
public class RemoteEnvURLTest {
public class RemoteWorkspaceURLTest {
@Test
public void testEqualAndHashCode() {
String a = "https://yaohwu:8080/webroot/app/c/d";
RemoteWorkspaceURL workspaceURL1 = new RemoteWorkspaceURL(a);
RemoteWorkspaceURL workspaceURL2 = new RemoteWorkspaceURL(a);
assertEquals(workspaceURL1.hashCode(), workspaceURL2.hashCode());
assertEquals(workspaceURL1, workspaceURL2);
workspaceURL2.resetUrl();
assertNotEquals(workspaceURL1.hashCode(), workspaceURL2.hashCode());
assertNotEquals(workspaceURL1, workspaceURL2);
}
@Test
public void testUrlReset() {
String a = "https://yaohwu:8080/webroot/app/c/d";
RemoteWorkspaceURL workspaceURL = new RemoteWorkspaceURL(a);
Assert.assertEquals(a, workspaceURL.getURL());
Assert.assertEquals("app", workspaceURL.getServlet());
Assert.assertEquals("webroot", workspaceURL.getWeb());
Assert.assertEquals("yaohwu", workspaceURL.getHost());
Assert.assertEquals("8080", workspaceURL.getPort());
Assert.assertTrue(workspaceURL.getHttps());
workspaceURL.setHttps(false);
workspaceURL.setHost("finereport");
Assert.assertEquals(a, workspaceURL.getURL());
Assert.assertEquals("app", workspaceURL.getServlet());
Assert.assertEquals("webroot", workspaceURL.getWeb());
Assert.assertEquals("finereport", workspaceURL.getHost());
Assert.assertEquals("8080", workspaceURL.getPort());
Assert.assertFalse(workspaceURL.getHttps());
workspaceURL.resetUrl();
Assert.assertEquals("http://finereport:8080/webroot/app", workspaceURL.getURL());
Assert.assertEquals("app", workspaceURL.getServlet());
Assert.assertEquals("webroot", workspaceURL.getWeb());
Assert.assertEquals("finereport", workspaceURL.getHost());
Assert.assertEquals("8080", workspaceURL.getPort());
Assert.assertFalse(workspaceURL.getHttps());
}
@Test
public void testURLParser() {

21
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -18,7 +18,9 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.stable.ArrayUtils;
import java.awt.*;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
@ -175,22 +177,6 @@ public class SelectionModel {
}
private void pasteXWFitLayout() {
if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) {
XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator();
//tab布局编辑器内部左上角第一个坐标点
int leftUpX = container.toData().getMargin().getLeft() + 1;
int leftUpY = container.toData().getMargin().getTop() + 1;
//选中第一个坐标点坐在的组件
selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY));
Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, container, clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
} else {
//自适应布局编辑器内部左上角第一个坐标点
int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1;
int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1;
@ -206,7 +192,6 @@ public class SelectionModel {
rectangle.y + DELTA_X_Y);
}
}
}
/**
* 粘贴时选择组件

5
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -31,6 +31,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.act.TitlePacker;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.ProductConstants;
import com.fr.stable.unit.PT;
import javax.swing.*;
@ -210,7 +211,7 @@ public class XCardSwitchButton extends XButton {
private void deleteCard(XCardSwitchButton button, int index){
String titleName = button.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Confirm_Dialog_Content") + "“" + titleName + "”",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_ConfirmDialog_Title"), JOptionPane.YES_NO_OPTION);
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
@ -352,7 +353,7 @@ public class XCardSwitchButton extends XButton {
private void deleteTabLayout(SelectionModel selectionModel, FormDesigner designer){
String titleName = this.getContentLabel().getText();
int value = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Confirm_Dialog_Content") + "“" + titleName + "”",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}

1
designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java

@ -28,6 +28,7 @@ public class EventPropertyTable extends UIListControlPane {
public EventPropertyTable(FormDesigner designer) {
super();
this.setNameListEditable(false);
this.designer = designer;
}

4
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -11,6 +11,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
@ -317,6 +318,9 @@ public class FormSelection {
clipBoard.reset();
for (XCreator root : selection) {
if(root.acceptType(XWTabFitLayout.class)){
continue;
}
try {
XCreator creator = XCreatorUtils.createXCreator((Widget) root.toData().clone());
creator.setBounds(root.getBounds());

Loading…
Cancel
Save