Browse Source

Merge pull request #9548 in DESIGN/design from release/11.0 to bugfix/11.0

* commit '3675f7bb86dbb36a03ad4e401916d5773be1d92a':
  REPORT-76259 【迭代】【数据连接面板为空】概率出现编辑数据集一直加载中 根据评审意见修改下,不特地分出两个方法了
  REPORT-76259 【迭代】【数据连接面板为空】概率出现编辑数据集一直加载中 【问题原因】远程设计下,数据集面板的初始化中有两个耗时操作(下拉框取数据连接、TableViewList根据下拉框值取连接对应的所有表),对应两个SwingWorker,设为A和B;数据集面板本身的展示过程也对应一个SwingWorker(需要查询此连接是否有权限),设为C;当C执行完后,会在done方法里调用数据集面板的setVisible方法以让它展示,如果此时A和B才执行完doInbackground,准备执行done的时候(done的执行是invokeLater的),C的面板先显示了,会导致它们的done方法会被已经显示的模态dialog给阻塞住,从而无法完成面板数据更新 【改动思路】将setVisible方法用invokeLater包一层,让A和B的done方法不被阻塞 【review建议】无
  REPORT-75752 兼容下旧插件
  REPORT-75752 表格辅助线的功能从frm扩展到dashboard
  REPORT-76403 【迭代】更新日志-更新内容为空,报错Unparseable date: "null" 1、兼容下更新日志的缓存 2、昨天提交到feature的,没合的,提交到release
  REPORT-75575 design feat:fvs支持服务器全局参数
bugfix/11.0
superman 2 years ago
parent
commit
22e2ebbdf1
  1. 6
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  4. 23
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  5. 11
      designer-base/src/main/java/com/fr/design/utils/ColorUtils.java
  6. 29
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  7. 25
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java
  8. 16
      designer-realize/src/main/java/com/fr/grid/GridUI.java

6
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -487,7 +487,11 @@ public class TableDataTreePane extends BasicTableDataTreePane {
doPropertyChange(dg, tdNamePanel, oldName); doPropertyChange(dg, tdNamePanel, oldName);
} }
}); });
dg.setVisible(true); // 有些数据集(DBTableData)面板的初始化过程中是包含了SwingWorker处理(查询数据连接、查表等)的
// 如果这里直接setVisible,可能阻塞SwingWorker的done方法,导致面板渲染出现问题
SwingUtilities.invokeLater(() -> {
dg.setVisible(true);
});
} }
@Override @Override

6
designer-base/src/main/java/com/fr/design/mainframe/JDashboard.java

@ -1,5 +1,9 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.report.worksheet.FormElementCase;
import java.awt.Rectangle;
/** /**
* @author Starryi * @author Starryi
* @version 1.0 * @version 1.0
@ -7,4 +11,6 @@ package com.fr.design.mainframe;
*/ */
public interface JDashboard { public interface JDashboard {
void switchToDashBoardEditor(); void switchToDashBoardEditor();
Rectangle getElementCaseRectangle(FormElementCase elementCase);
} }

5
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -502,10 +502,7 @@ public abstract class ToolBarMenuDock {
addPluginManagerAction(menuDef); addPluginManagerAction(menuDef);
menuDef.addShortCut(new FunctionManagerAction()); menuDef.addShortCut(new FunctionManagerAction());
if (!DesignModeContext.isDuchampMode()) { menuDef.addShortCut(new GlobalParameterAction());
menuDef.addShortCut(new GlobalParameterAction());
}
} }

23
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -59,7 +59,6 @@ import java.util.*;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static com.fr.design.dialog.FineJOptionPane.OPTION_OK_CANCEL;
import static java.nio.charset.StandardCharsets.*; import static java.nio.charset.StandardCharsets.*;
import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.QUESTION_MESSAGE;
@ -475,19 +474,22 @@ public class UpdateMainDialog extends UIDialog {
String readStr, updateTimeStr; String readStr, updateTimeStr;
while ((readStr = br.readLine()) != null) { while ((readStr = br.readLine()) != null) {
String[] updateInfo = readStr.split("\\t"); String[] updateInfo = readStr.split("\\t");
if (updateInfo.length == 2) { if (updateInfo.length == 3) {
updateTimeStr = updateInfo[0]; updateTimeStr = updateInfo[UpdateInfoTable.UPDATE_DATE_INDEX];
Date updateTime = UPDATELOG_FORMAT.parse(updateTimeStr); Date updateTime = UPDATELOG_FORMAT.parse(updateTimeStr);
//形如 Build#release-2018.07.31.03.03.52.80 //形如 Build#release-2018.07.31.03.03.52.80
String currentNO = GeneralUtils.readBuildNO(); String currentNO = GeneralUtils.readBuildNO();
Date curJarDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1)); Date curJarDate = UPDATE_INFO_TABLE_FORMAT.parse(currentNO, new ParsePosition(currentNO.indexOf("-") + 1));
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) { if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) {
if (!containsKeyword(UPDATE_INFO_TABLE_FORMAT.format(updateTime), keyword) && !containsKeyword(updateInfo[1], keyword)) { keyword.replace('.','-');
if (!containsKeyword(UPDATELOG_FORMAT.format(updateTime), keyword) && !containsKeyword(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX], keyword)) {
continue; continue;
} }
} }
if (isValidLogInfo(updateInfo[1]) && curJarDate != null) { if (isValidLogInfo(updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX]) && curJarDate != null) {
updateInfoList.add(new Object[]{UPDATE_INFO_TABLE_FORMAT.format(updateTime), updateInfo[1], updateTime.after(curJarDate)}); updateInfoList.add(new Object[]{UPDATELOG_FORMAT.format(updateTime), updateInfo[UpdateInfoTable.UPDATE_VERSION_INDEX], updateInfo[UpdateInfoTable.UPDATE_TITLE_INDEX], updateTime.after(curJarDate)});
} }
} }
} }
@ -521,7 +523,7 @@ public class UpdateMainDialog extends UIDialog {
try (BufferedWriter bufferWriter = new BufferedWriter(writerStream)) { try (BufferedWriter bufferWriter = new BufferedWriter(writerStream)) {
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jo = (JSONObject) jsonArray.get(i); JSONObject jo = (JSONObject) jsonArray.get(i);
bufferWriter.write((String) jo.get("updateTime") + '\t' + jo.get("jiraId") + " " + jo.get("info")); bufferWriter.write((String) jo.get("updateTime") + '\t' + jo.get("version") + '\t' + jo.get("jiraId") + " " + jo.get("info"));
bufferWriter.newLine(); bufferWriter.newLine();
bufferWriter.flush(); bufferWriter.flush();
} }
@ -546,13 +548,14 @@ public class UpdateMainDialog extends UIDialog {
if (curJarDate == null) { if (curJarDate == null) {
curJarDate = updateTime; curJarDate = updateTime;
} }
if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY)) { if (!ComparatorUtils.equals(keyword, StringUtils.EMPTY) && keyword != null) {
if (!containsKeyword(UPDATE_INFO_TABLE_FORMAT.format(updateTime), keyword) && !containsKeyword(updateTitle, keyword)) { keyword.replace('.', '-');
if (!containsKeyword(UPDATELOG_FORMAT.format(updateTime), keyword) && !containsKeyword(updateTitle, keyword)) {
continue; continue;
} }
} }
if (isValidLogInfo(updateTitle)) { if (isValidLogInfo(updateTitle)) {
updateInfoList.add(new Object[]{UPDATE_INFO_TABLE_FORMAT.format(updateTime), updateVersionStr, updateTitle, updateTime.after(curJarDate)}); updateInfoList.add(new Object[]{updateTimeStr, updateVersionStr, updateTitle, updateTime.after(curJarDate)});
} }
} }
return new ArrayList<>(updateInfoList); return new ArrayList<>(updateInfoList);

11
designer-base/src/main/java/com/fr/design/utils/ColorUtils.java

@ -27,4 +27,15 @@ public class ColorUtils {
} }
} }
} }
public static boolean isDarkColor(Color color) {
if(color == null) {
return false;
}
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
int greyLevel = (int)(red * 0.299 + green * 0.587 + blue * 0.114);
return greyLevel < 192;
}
} }

29
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -41,6 +41,7 @@ import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fit.FormFitAttrAction; import com.fr.design.fit.FormFitAttrAction;
import com.fr.design.fit.common.FormDesignerUtil;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
@ -109,12 +110,7 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -1307,4 +1303,25 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public XLayoutContainer getRootComponent() { public XLayoutContainer getRootComponent() {
return this.formDesign.getRootComponent(); return this.formDesign.getRootComponent();
} }
@Override
public Rectangle getElementCaseRectangle(FormElementCase elementCase) {
final Rectangle rectangle = new Rectangle();
FormDesigner designer = this.getFormDesign();
if (designer == null) {
return rectangle;
}
XElementCase xElementCase = FormDesignerUtil.getXelementCase(designer.getRootComponent(), elementCase);
if (xElementCase != null) {
rectangle.setBounds(xElementCase.getBounds());
//减去内边距的宽和高
Insets insets = xElementCase.getInsets();
rectangle.width -= insets.left + insets.right;
rectangle.height -= insets.top + insets.bottom;
}
return rectangle;
}
} }

25
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCasePaneDelegate.java

@ -72,28 +72,17 @@ public class FormElementCasePaneDelegate extends ElementCasePane<FormElementCase
} }
private Rectangle getBoundsLineRect(TemplateElementCase elementCase) { private Rectangle getBoundsLineRect(TemplateElementCase elementCase) {
final Rectangle rectangle = new Rectangle();
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (!(template instanceof JForm)) { if (!(template instanceof JDashboard)) {
return rectangle; return new Rectangle();
} }
try {
FormDesigner designer = ((JForm) template).getFormDesign(); return ((JDashboard)template).getElementCaseRectangle((FormElementCase)elementCase);
if (designer == null) { } catch (Throwable e) {
return rectangle; // 兼容旧插件
return new Rectangle();
} }
XElementCase xElementCase = FormDesignerUtil.getXelementCase(designer.getRootComponent(), (FormElementCase) elementCase);
if (xElementCase != null) {
rectangle.setBounds(xElementCase.getBounds());
//减去内边距的宽和高
Insets insets = xElementCase.getInsets();
rectangle.width -= insets.left + insets.right;
rectangle.height -= insets.top + insets.bottom;
}
return rectangle;
} }

16
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -18,6 +18,7 @@ import com.fr.design.mainframe.DesignerUIModeConfig;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.ColorUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils; import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -1196,13 +1197,13 @@ public class GridUI extends ComponentUI {
} }
//绘制吸附辅助线 //绘制吸附辅助线
paintAdsorbLines(g2d, grid); paintAdsorbLines(g2d, grid, elementCase);
grid.ajustEditorComponentBounds(); // refresh size grid.ajustEditorComponentBounds(); // refresh size
} }
//绘制吸附辅助线 //绘制吸附辅助线
private void paintAdsorbLines(Graphics2D g2d, Grid grid) { private void paintAdsorbLines(Graphics2D g2d, Grid grid, TemplateElementCase elementcase) {
int verticalValue = grid.getVerticalValue(); int verticalValue = grid.getVerticalValue();
int horizontalValue = grid.getHorizontalValue(); int horizontalValue = grid.getHorizontalValue();
if (grid.getAdsorbWidth() <= 0 || grid.getAdsorbHeight() <= 0) { if (grid.getAdsorbWidth() <= 0 || grid.getAdsorbHeight() <= 0) {
@ -1212,13 +1213,18 @@ public class GridUI extends ComponentUI {
- columnWidthList.getRangeValue(0, horizontalValue).toPixI(resolution)); - columnWidthList.getRangeValue(0, horizontalValue).toPixI(resolution));
int height = (int) (grid.getAdsorbHeight() * (resolution * 1.0D / DesignerUIModeConfig.getInstance().getScreenResolution()) int height = (int) (grid.getAdsorbHeight() * (resolution * 1.0D / DesignerUIModeConfig.getInstance().getScreenResolution())
- rowHeightList.getRangeValue(0, verticalValue).toPixI(resolution)); - rowHeightList.getRangeValue(0, verticalValue).toPixI(resolution));
drawBoundsLine(g2d, width, height); drawBoundsLine(g2d, width, height, elementcase);
} }
private void drawBoundsLine(Graphics2D g2d, int width, int height) { private void drawBoundsLine(Graphics2D g2d, int width, int height, TemplateElementCase elementcase) {
Paint oldPaint = g2d.getPaint(); Paint oldPaint = g2d.getPaint();
Stroke oldStroke = g2d.getStroke(); Stroke oldStroke = g2d.getStroke();
g2d.setPaint(Color.black); Color backgroundColor = AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE);
if(ColorUtils.isDarkColor(backgroundColor)) {
g2d.setPaint(Color.white);
} else {
g2d.setPaint(Color.black);
}
g2d.setStroke(GraphDrawHelper.getStroke(Constants.LINE_DASH_DOT)); g2d.setStroke(GraphDrawHelper.getStroke(Constants.LINE_DASH_DOT));
g2d.drawLine(0, height, width, height); g2d.drawLine(0, height, width, height);
g2d.drawLine(width, 0, width, height); g2d.drawLine(width, 0, width, height);

Loading…
Cancel
Save