Browse Source

Merge pull request #7367 in DESIGN/design from final/10.0 to persist/10.0

* commit '0e2c43581905982e9db1a7837396bc672c6030e5':
  REPORT-64738 设计器在线组件库中可见组件应去重且仅显示兼容当前设计器的组件
  REPORT-64811 保持设计器商城下载reu文件名中的版本信息
  REPORT-64741 【组件可更新提醒】组件复用-设计器端安装设计器版本高于当前设计器版本的组件的情况
  CHART-22211 甘特图用文件数据集日期显示异常
  CHART-21877 fix:fvs.cpt 批量设置单元格背景颜色后 单元格字体是黑色
  CHART-22076 fix:fvs.cpt 单元格设置超链删除超链 文本白色
  update
  CHART-22090 条件属性-颜色控件残留
  无jira任务 单元测试打包
  REPORT-63505 图表进入编辑状态后创建组件预览图不渲染图表
  CHART-22213 fix:新增警戒线 默认应该是9px12px 不是9px
  REPORT-63505 图表进入编辑状态后创建组件预览图不渲染图表
persist/10.0 10.0.19.2021.12.28
superman 3 years ago
parent
commit
a24f4fac4c
  1. 13
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  2. 16
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  3. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java
  4. 12
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataContentPane.java
  5. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  6. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  7. 41
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  8. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java
  9. 5
      designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java
  10. 3
      designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java
  11. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/AbstractCellAttrPane.java
  12. 12
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  13. 41
      designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

13
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -17,14 +17,19 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import javax.swing.*; import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -198,7 +203,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
public Style update(Style style) { public Style update(Style style) {
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
if (backgroundPane.currentPane.isBackgroundChange()) { if (backgroundPane.currentPane.isBackgroundChange()) {

16
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -17,6 +17,7 @@ public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43); private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110); private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
private static final Color CELL_ELEMENT_FONT_FOREGROUND = Color.WHITE;
private static Color currentStoryBack = null; private static Color currentStoryBack = null;
@ -31,13 +32,24 @@ public class AdjustWorkBookDefaultStyleUtils {
public static void adjustCellElement(CellElement cellElement) { public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) { if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE)); style = adjustCellElement(style);
cellElement.setStyle(style);
}
}
public static Style adjustCellElement(Style style) {
if (DesignModeContext.isDuchampMode()) {
style = style.deriveFRFont(style.getFRFont().applyForeground(CELL_ELEMENT_FONT_FOREGROUND));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER, style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER, 0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER, 0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER); 0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
} }
return style;
}
public static Color adjustCellElementFontForeground(Color color) {
return DesignModeContext.isDuchampMode() ? CELL_ELEMENT_FONT_FOREGROUND : color;
} }
public static void adjustFloatElement(FloatElement floatElement) { public static void adjustFloatElement(FloatElement floatElement) {

11
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartUIListControlPane.java

@ -25,6 +25,7 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Point; import java.awt.Point;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -210,6 +211,16 @@ public abstract class VanChartUIListControlPane extends UIListControlPane implem
public void doCancel() { public void doCancel() {
setVisible(false); setVisible(false);
} }
@Override
public void setVisible(boolean b) {
super.setVisible(b);
//把一些可能没隐藏的子弹框隐藏 比如 边框-颜色弹框
for (Window window : getOwnedWindows()) {
window.setVisible(false);
}
}
} }
} }

12
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/GanttTableDataContentPane.java

@ -93,13 +93,13 @@ public class GanttTableDataContentPane extends AbstractTableDataContentPane{
ganttDefinition.setEndTime(endTime == null ? StringUtils.EMPTY : String.valueOf(endTime)); ganttDefinition.setEndTime(endTime == null ? StringUtils.EMPTY : String.valueOf(endTime));
Object markTime = markerTimeComboBox.getSelectedItem(); Object markTime = markerTimeComboBox.getSelectedItem();
ganttDefinition.setMarkTime(isNoneObject(markTime) ? StringUtils.EMPTY : String.valueOf(markTime)); ganttDefinition.setMarkTime(isNoneObject(markTime) ? null : String.valueOf(markTime));
Object process = processComboBox.getSelectedItem(); Object process = processComboBox.getSelectedItem();
ganttDefinition.setProgress(isNoneObject(process) ? StringUtils.EMPTY : String.valueOf(process)); ganttDefinition.setProgress(isNoneObject(process) ? null : String.valueOf(process));
Object taskID = taskIDComboBox.getSelectedItem(); Object taskID = taskIDComboBox.getSelectedItem();
ganttDefinition.setLinkID(isNoneObject(taskID) ? StringUtils.EMPTY : String.valueOf(taskID)); ganttDefinition.setLinkID(isNoneObject(taskID) ? null : String.valueOf(taskID));
} }
private boolean isNoneObject(Object markTime) { private boolean isNoneObject(Object markTime) {
@ -117,9 +117,9 @@ public class GanttTableDataContentPane extends AbstractTableDataContentPane{
seriesComboBox.setSelectedItem(ganttDefinition.getSeriesName()); seriesComboBox.setSelectedItem(ganttDefinition.getSeriesName());
startTimeComboBox.setSelectedItem(ganttDefinition.getStartTime()); startTimeComboBox.setSelectedItem(ganttDefinition.getStartTime());
endTimeComboBox.setSelectedItem(ganttDefinition.getEndTime()); endTimeComboBox.setSelectedItem(ganttDefinition.getEndTime());
markerTimeComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getMarkTime()) ? NONE : ganttDefinition.getMarkTime()); markerTimeComboBox.setSelectedItem(ganttDefinition.getMarkTime() == null ? NONE : ganttDefinition.getMarkTime());
processComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getProgress()) ? NONE : ganttDefinition.getProgress()); processComboBox.setSelectedItem(ganttDefinition.getProgress() == null ? NONE : ganttDefinition.getProgress());
taskIDComboBox.setSelectedItem(StringUtils.isEmpty(ganttDefinition.getLinkID()) ? NONE : ganttDefinition.getLinkID()); taskIDComboBox.setSelectedItem(ganttDefinition.getLinkID() == null ? NONE : ganttDefinition.getLinkID());
} }
} }

15
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -10,7 +10,9 @@ import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TableDataDictionary;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -33,6 +35,7 @@ import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.DataControl; import com.fr.form.ui.DataControl;
import com.fr.form.ui.DictionaryContainer; import com.fr.form.ui.DictionaryContainer;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -56,6 +59,7 @@ import javax.swing.Action;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -253,6 +257,17 @@ public class CreateComponentAction extends UpdateAction {
BufferedImage im = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_ARGB); BufferedImage im = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_ARGB);
comp.paint(im.getGraphics()); comp.paint(im.getGraphics());
if (comp instanceof XWTitleLayout) {
XCreator body = ((XWTitleLayout) comp).getBodyCreator();
if (body instanceof XChartEditor) {
XChartEditor chartEditor = (XChartEditor) body;
Dimension size = chartEditor.getSize();
BufferedImage chartImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
PaddingMargin margin = chartEditor.toData().getMargin();
chartEditor.getDesignerEditor().paintEditor(chartImage.getGraphics(), size, margin);
im.getGraphics().drawImage(chartImage, 0, chartEditor.getY(), null);
}
}
return im; return im;
} }

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -150,6 +150,14 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
} }
} }
private String createLocalReuFilename() {
String filename = widget.getFileLoca();
if (StringUtils.isEmpty(filename) || !filename.endsWith(".reu")) {
filename = widget.getName() + "." + widget.getUuid() + ".reu";
}
return filename;
}
private void downLoadWidget() { private void downLoadWidget() {
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
ComponentCollector.getInstance().collectDownloadPktNum(); ComponentCollector.getInstance().collectDownloadPktNum();
@ -170,7 +178,8 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
protected Boolean doInBackground() { protected Boolean doInBackground() {
String filePath; String filePath;
try { try {
filePath = DownloadUtils.download(widget.getId(), widget.getName() + "." + widget.getUuid(), process); String filename = createLocalReuFilename();
filePath = DownloadUtils.download(widget.getId(), filename, process);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;
@ -179,7 +188,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
//安装 //安装
File file = new File(filePath); File file = new File(filePath);
try { try {
if (file.exists() && getDefaultGroup().installModule(file)) { if (file.exists() && getDefaultGroup().installUniqueIdModule(file)) {
ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis()); ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis());
ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid()); ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid());
} }

41
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -30,6 +30,9 @@ import java.nio.charset.StandardCharsets;
import java.security.KeyFactory; import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey; import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec; import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/** /**
* created by Harrison on 2020/05/27 * created by Harrison on 2020/05/27
@ -55,9 +58,9 @@ public class DownloadUtils {
@NotNull @NotNull
public static String download(String id, String fileName, com.fr.design.extra.Process<Double> process) throws Exception { public static String download(String id, String fileName, com.fr.design.extra.Process<Double> process) throws Exception {
CloseableHttpResponse fileRes = getHttpResponse(REUSES_URL, id); CloseableHttpResponse fileRes = postDownloadHttpResponse(REUSES_URL, id);
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue());
} }
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_SHARE); String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_SHARE);
@ -67,7 +70,7 @@ public class DownloadUtils {
long totalSize = entity.getContentLength(); long totalSize = entity.getContentLength();
InputStream content = entity.getContent(); InputStream content = entity.getContent();
filePath = StableUtils.pathJoin(realPath, fileName + ".reu"); filePath = StableUtils.pathJoin(realPath, fileName);
StableUtils.makesureFileExist(new File(filePath)); StableUtils.makesureFileExist(new File(filePath));
FileOutputStream writer = new FileOutputStream(filePath); FileOutputStream writer = new FileOutputStream(filePath);
byte[] data = new byte[PluginConstants.BYTES_NUM]; byte[] data = new byte[PluginConstants.BYTES_NUM];
@ -93,9 +96,11 @@ public class DownloadUtils {
public static String downloadPackage(String id, String fileName, CancelCheck cancelCheck) throws Exception { public static String downloadPackage(String id, String fileName, CancelCheck cancelCheck) throws Exception {
CloseableHttpResponse fileRes = getHttpResponse(PACKAGE_REUSES_URL, id); Map<String, String> params = new HashMap<>();
params.put("designerVersion", ProductConstants.RELEASE_VERSION);
CloseableHttpResponse fileRes = postDownloadHttpResponse(PACKAGE_REUSES_URL, id, params);
if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) { if (fileRes.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
fileRes = getHttpResponse(fileRes.getHeaders("Location")[0].getValue()); fileRes = getDownloadHttpResponse(fileRes.getHeaders("Location")[0].getValue());
} }
String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_PACKAGE_SHARE); String realPath = StableUtils.pathJoin(ProductConstants.getEnvHome(), ShareComponentConstants.PLUGIN_CACHE, ShareComponentConstants.DOWNLOAD_PACKAGE_SHARE);
String filePath; String filePath;
@ -130,21 +135,33 @@ public class DownloadUtils {
} }
} }
private static CloseableHttpResponse getHttpResponse(String url, String id) throws Exception { private static CloseableHttpResponse postDownloadHttpResponse(String url, String id) throws Exception {
return postDownloadHttpResponse(url, id, new HashMap<>());
}
private static CloseableHttpResponse postDownloadHttpResponse(String url, String id, Map<String, String> params) throws Exception {
//先登录一下。不然可能失败 //先登录一下。不然可能失败
CloseableHttpClient client = createClient(); CloseableHttpClient client = createClient();
FineLoggerFactory.getLogger().info("login fr-market"); FineLoggerFactory.getLogger().info("login fr-market");
FineLoggerFactory.getLogger().info("start download widget {}", id); FineLoggerFactory.getLogger().info("start download widget {}", id);
HttpUriRequest file = RequestBuilder.post() RequestBuilder builder = RequestBuilder.post()
.setHeader("User-Agent", "Mozilla/5.0") .setHeader("User-Agent", "Mozilla/5.0")
.setUri(url).addParameter("id", encrypt(id)).addParameter("userId", .setUri(url)
String.valueOf(DesignerEnvManager.getEnvManager().getDesignerLoginUid())) .addParameter("id", encrypt(id))
.build(); .addParameter("userId", String.valueOf(DesignerEnvManager.getEnvManager().getDesignerLoginUid()));
return client.execute(file);
if (params != null) {
Set<String> keys = params.keySet();
for (String key: keys) {
builder.addParameter(key, params.get(key));
}
}
return client.execute(builder.build());
} }
private static CloseableHttpResponse getHttpResponse(String url) throws Exception { private static CloseableHttpResponse getDownloadHttpResponse(String url) throws Exception {
//先登录一下。不然可能失败 //先登录一下。不然可能失败
CloseableHttpClient client = createClient(); CloseableHttpClient client = createClient();
HttpUriRequest file = RequestBuilder.get() HttpUriRequest file = RequestBuilder.get()

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java

@ -112,7 +112,7 @@ public class InstallUtils {
private static boolean installReuFile(Group group, File chosenFile, long installTime) { private static boolean installReuFile(Group group, File chosenFile, long installTime) {
try { try {
if (!group.installModule(chosenFile)) { if (!group.installUniqueIdModule(chosenFile)) {
return false; return false;
} }
ShareUtils.recordInstallTime(chosenFile.getName(), installTime); ShareUtils.recordInstallTime(chosenFile.getName(), installTime);

5
designer-realize/src/main/java/com/fr/design/actions/utils/ReportActionUtils.java

@ -4,6 +4,7 @@ import com.fr.base.Style;
import com.fr.design.actions.cell.style.StyleActionInterface; import com.fr.design.actions.cell.style.StyleActionInterface;
import com.fr.design.mainframe.DesignOperationEvent; import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -15,7 +16,7 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import java.awt.*; import java.awt.Rectangle;
public class ReportActionUtils { public class ReportActionUtils {
private ReportActionUtils() { private ReportActionUtils() {
@ -113,7 +114,7 @@ public class ReportActionUtils {
CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow()); CellElement editCellElement = report.getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow());
if (editCellElement == null) { if (editCellElement == null) {
return Style.DEFAULT_STYLE; return AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
//peter:直接返回当前编辑元素的Style //peter:直接返回当前编辑元素的Style

3
designer-realize/src/main/java/com/fr/design/mainframe/HyperlinkGroupPaneActionImpl.java

@ -6,6 +6,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
@ -82,7 +83,7 @@ public class HyperlinkGroupPaneActionImpl implements HyperlinkGroupPaneActionPro
frFont = frFont.applyForeground(Color.blue); frFont = frFont.applyForeground(Color.blue);
frFont = frFont.applyUnderline(Constants.LINE_THIN); frFont = frFont.applyUnderline(Constants.LINE_THIN);
} else { } else {
frFont = frFont.applyForeground(Color.black); frFont = frFont.applyForeground(AdjustWorkBookDefaultStyleUtils.adjustCellElementFontForeground(Color.black));
frFont = frFont.applyUnderline(Constants.LINE_NONE); frFont = frFont.applyUnderline(Constants.LINE_NONE);
} }
editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); editCellElement.setStyle(elementStyle.deriveFRFont(frFont));

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/AbstractCellAttrPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane;
import com.fr.design.mainframe.AbstractAttrPane; import com.fr.design.mainframe.AbstractAttrPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
@ -53,6 +54,7 @@ public abstract class AbstractCellAttrPane extends AbstractAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow()); TemplateCellElement cellElement = elementCase.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); cellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
} }
this.cellElement = cellElement; this.cellElement = cellElement;
elementCase.addCellElement(this.cellElement); elementCase.addCellElement(this.cellElement);

12
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -5,16 +5,18 @@ import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.cell.settingpane.style.StylePane; import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.style.BorderUtils; import com.fr.design.style.BorderUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*; import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Rectangle;
/** /**
* @author zhou * @author zhou
@ -101,12 +103,12 @@ public class CellStylePane extends AbstractCellAttrPane {
TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row); TemplateCellElement cellElement = elementCase.getTemplateCellElement(column, row);
if (cellElement == null) { if (cellElement == null) {
cellElement = new DefaultTemplateCellElement(column, row); cellElement = new DefaultTemplateCellElement(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
elementCase.addCellElement(cellElement); elementCase.addCellElement(cellElement);
} }
Style style = cellElement.getStyle(); Style style = cellElement.getStyle();
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = AdjustWorkBookDefaultStyleUtils.adjustCellElement(Style.DEFAULT_STYLE);
} }
style = stylePane.updateStyle(style); style = stylePane.updateStyle(style);
cellElement.setStyle(style); cellElement.setStyle(style);

41
designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

@ -3,15 +3,11 @@ package com.fr.design.mainframe.app;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter; import com.fr.plugin.context.PluginMarkerAdapter;
import com.fr.plugin.engine.remote.PluginRemoteSync;
import com.fr.stable.TemplateIOErrorContextHolder; import com.fr.stable.TemplateIOErrorContextHolder;
import com.fr.third.guava.collect.Multimap; import com.fr.third.guava.collect.Multimap;
import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.modules.junit4.PowerMockRunner;
import java.util.Collection; import java.util.Collection;
@ -24,13 +20,12 @@ import java.util.HashSet;
* Created by vito on 2021/5/31 * Created by vito on 2021/5/31
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({PluginRemoteSync.class})
public class DesignerAppUtilsTest { public class DesignerAppUtilsTest {
@Test @Test
public void testDealWithErrorDetailMultiLineAndCache() { public void testDealWithErrorDetailMultiLineAndCache() {
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{ TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{
put("2", "好用的插件"); put("2", "好用的插件");
}},new HashSet<>()); }}, new HashSet<>());
TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件")); TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0")); TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0")); TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0"));
@ -47,7 +42,7 @@ public class DesignerAppUtilsTest {
public void testInvalidatePlugins() { public void testInvalidatePlugins() {
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{ TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{
put("2", "好用的插件"); put("2", "好用的插件");
}},new HashSet<>()); }}, new HashSet<>());
TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件")); TemplateIOErrorContextHolder.addNeedEnablePlugin(PluginMarkerAdapter.create("1", "1.0", "1插件"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0")); TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("2", "1.0"));
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0")); TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("3", "1.0"));
@ -60,19 +55,19 @@ public class DesignerAppUtilsTest {
} }
@Test @Test
public void testRearrange(){ public void testRearrange() {
// 远程插件模拟注册 // 远程插件模拟注册
PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class); // PluginRemoteSync pluginRemoteSync = EasyMock.createMock(PluginRemoteSync.class);
EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap<String, PluginRemoteSync.PluginStatus>(){{ // EasyMock.expect(pluginRemoteSync.getPluginRemoteStatusByIdIndex()).andReturn(new HashMap<String, PluginRemoteSync.PluginStatus>(){{
put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get()); // put("com.fr.plugin1", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin1","1",true).get());
put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get()); // put("com.fr.plugin2", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin2","1",true).get());
put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get()); // put("com.fr.plugin3", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin3","1",false).get());
put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get()); // put("com.fr.plugin4", Reflect.on(PluginRemoteSync.PluginStatus.class).call("create","com.fr.plugin4","1",false).get());
}}).anyTimes(); // }}).anyTimes();
EasyMock.replay(pluginRemoteSync); // EasyMock.replay(pluginRemoteSync);
PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance"); // PowerMock.mockStaticPartial(PluginRemoteSync.class, "getInstance");
EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes(); // EasyMock.expect(PluginRemoteSync.getInstance()).andReturn(pluginRemoteSync).anyTimes();
PowerMock.replay(PluginRemoteSync.class); // PowerMock.replay(PluginRemoteSync.class);
// 本地插件模拟检查 // 本地插件模拟检查
TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{ TemplateIOErrorContextHolder.registerPluginNameMap(new HashMap<String, String>() {{
@ -81,7 +76,7 @@ public class DesignerAppUtilsTest {
put("com.fr.plugin3", "好用的插件3"); put("com.fr.plugin3", "好用的插件3");
put("com.fr.plugin4", "好用的插件4"); put("com.fr.plugin4", "好用的插件4");
put("com.fr.plugin5", "好用的插件5"); put("com.fr.plugin5", "好用的插件5");
}},new HashSet<>()); }}, new HashSet<>());
// unknown // unknown
TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin7", "1")); TemplateIOErrorContextHolder.addNeedInstallPlugin(PluginMarker.create("com.fr.plugin7", "1"));
// disable // disable
@ -93,14 +88,14 @@ public class DesignerAppUtilsTest {
Multimap<String, PluginMarkerAdapter> pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin(); Multimap<String, PluginMarkerAdapter> pendingPlugins = TemplateIOErrorContextHolder.getPendingPlugin();
Reflect.on(DesignerAppUtils.class).call("rearrange",pendingPlugins).get(); Reflect.on(DesignerAppUtils.class).call("rearrange", pendingPlugins).get();
Assert.assertEquals(1,pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN).size()); Assert.assertEquals(1, pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN).size());
Collection<PluginMarkerAdapter> pluginMarkerAdapters = pendingPlugins.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN); Collection<PluginMarkerAdapter> pluginMarkerAdapters = pendingPlugins.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN);
Assert.assertEquals(2, pluginMarkerAdapters.size()); Assert.assertEquals(2, pluginMarkerAdapters.size());
pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin3", "1")); pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin3", "1"));
pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin4", "1")); pluginMarkerAdapters.contains(PluginMarker.create("com.fr.plugin4", "1"));
Collection<PluginMarkerAdapter> pluginMarkerAdapters1 = pendingPlugins.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN); Collection<PluginMarkerAdapter> pluginMarkerAdapters1 = pendingPlugins.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN);
Assert.assertEquals(1, pluginMarkerAdapters1.size()); Assert.assertEquals(1, pluginMarkerAdapters1.size());
pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1")); pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5", "1"));
} }
} }
Loading…
Cancel
Save