Browse Source

Merge pull request #7384 in DESIGN/design from release/11.0 to feature/x

* commit '0fbe86093e3fcf88b656928a8a54e830c32f890b':
  REPORT-65087 共享数据集兼容性问题
  REPORT-65090:修复埋点格式错误bug
  REPORT-62611 远程设计websocket断开提示优化-toast弹窗在设计器界面居左后显示异常
  REPORT-65072 【主题边框】单元格样式的预览小图中,内部边框线看着比较粗
  REPORT-65060 【视觉验收】模板主题管理
  REPORT-64738 设计器在线组件库中可见组件应去重且仅显示兼容当前设计器的组件
  REPORT-65050 远程模板锁定优化-fvs模板被超管在某设备上强制解锁后,编辑者点击保存时不会触发另存为弹窗,而是保存成功
  REPORT-65059 设计器-给多个单元格设置边框,预览时只有一个
  REPORT-65049 【主题边框】悬浮元素的跟随主题单元格样式显示,出现两种样式重叠的效果
  REPORT-64738 设计器在线组件库中可见组件应去重且仅显示兼容当前设计器的组件
  REPORT-64811 保持设计器商城下载reu文件名中的版本信息
  CHART-22503 标题、图例、轴标题、数据表等字符颜色控件-多余增加了自动
feature/x
superman 3 years ago
parent
commit
aa8cd525f6
  1. 2
      designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java
  2. 60
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  3. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 1
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java
  5. 13
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  6. 17
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java
  7. BIN
      designer-base/src/main/resources/com/fr/design/images/transparent_background.png
  8. 6
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java
  9. 10
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java
  10. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java
  11. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java
  12. 43
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  13. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java
  14. 12
      designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java
  15. 10
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  16. 3
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

2
designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java

@ -46,7 +46,7 @@ public class CellRectangleStylePreviewPane extends JPanel {
for (int r = 0; r < ROW_COUNT; r++) { for (int r = 0; r < ROW_COUNT; r++) {
for (int c = 0; c < COLUMN_COUNT; c++) { for (int c = 0; c < COLUMN_COUNT; c++) {
CellStylePreviewPane pane = new CellStylePreviewPane(); CellStylePreviewPane pane = new CellStylePreviewPane(false, false);
TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r);
int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE; int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE;
if (supportInnerBorder) { if (supportInnerBorder) {

60
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -30,10 +30,20 @@ import java.util.List;
public class CellStylePreviewPane extends JPanel { public class CellStylePreviewPane extends JPanel {
public static final int MINIMUM_HEIGHT = 40; public static final int MINIMUM_HEIGHT = 40;
private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png");
private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight;
private String paintText = "Report"; private String paintText = "Report";
private Style style = Style.DEFAULT_STYLE; private Style style = Style.DEFAULT_STYLE;
public CellStylePreviewPane() { private final boolean autoClearCanvas;
private final boolean paintingMosaic;
public CellStylePreviewPane(boolean autoClearCanvas, boolean paintingMosaic) {
this.autoClearCanvas = autoClearCanvas;
this.paintingMosaic = paintingMosaic;
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
setPreferredSize(new Dimension(0, 0)); setPreferredSize(new Dimension(0, 0));
} }
@ -55,15 +65,58 @@ public class CellStylePreviewPane extends JPanel {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
if (autoClearCanvas) {
g2d.clearRect(0, 0, getWidth(), getHeight());
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
if (paintingMosaic) {
paintTransparentBackground(g2d, style);
}
paintCellStyle(g2d, style); paintCellStyle(g2d, style);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
} }
private void paintTransparentBackground(Graphics2D g2d, Style style) {
float alpha = computeTransparentBackgroundAlpha(style);
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth;
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight;
float maxScale = Math.max(scaleWidth, scaleHeight);
if (maxScale <= 1) {
scaleWidth = scaleHeight = 1;
} else {
scaleHeight = scaleWidth = maxScale;
}
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null);
g2d.setComposite(oldComposite);
}
private float computeTextColorBrightness(Style style) {
Color fontColor = style.getFRFont().getForeground();
return fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F + fontColor.getBlue() * 0.114F;
}
private float computeTransparentBackgroundAlpha(Style style) {
float textBrightness = computeTextColorBrightness(style);
float alpha = 1.0F;
if (textBrightness < 50) {
alpha = 0.2F;
} else if (textBrightness < 160){
alpha = 0.5F;
}
return alpha;
}
private void paintCellStyle(Graphics2D g2d, Style style) { private void paintCellStyle(Graphics2D g2d, Style style) {
int resolution = ScreenResolution.getScreenResolution(); int resolution = ScreenResolution.getScreenResolution();
@ -80,9 +133,8 @@ public class CellStylePreviewPane extends JPanel {
Style.paintContent(g2d, paintText, style, width, height, resolution); Style.paintContent(g2d, paintText, style, width, height, resolution);
Style.paintBorder(g2d, style, g2d.setClip(null);
width - GraphHelper.getLineStyleSize(style.getBorderRight()) / 2F, Style.paintBorder(g2d, style, width, height);
height - GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2F);
} }
@Override @Override

7
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -967,6 +967,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false; return false;
} }
try { try {
checkBeforeSave();
export(); export();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -985,7 +986,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return isNewCreateTpl; return isNewCreateTpl;
} }
protected boolean export() throws Exception { protected void checkBeforeSave() throws Exception {
// 保存前校验下未解锁 // 保存前校验下未解锁
if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) { if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) {
throw new UnLockedException(); throw new UnLockedException();
@ -994,6 +995,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) { if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) {
throw new InconsistentLockException(); throw new InconsistentLockException();
} }
}
protected boolean export() throws Exception {
return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE()));
} }
@ -1634,6 +1638,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (editingFILE == null || editingFILE instanceof MemFILE) { if (editingFILE == null || editingFILE instanceof MemFILE) {
return false; return false;
} }
checkBeforeSave();
export(); export();
this.editingFILE = editingFILE; this.editingFILE = editingFILE;
return true; return true;

1
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java

@ -40,6 +40,7 @@ public abstract class AbstractPreviewCell extends JComponent {
if (style.getBorderBottom() == Constants.LINE_SLIM || style.getBorderTop() == Constants.LINE_SLIM) { if (style.getBorderBottom() == Constants.LINE_SLIM || style.getBorderTop() == Constants.LINE_SLIM) {
height -= BORDER_INSET; height -= BORDER_INSET;
} }
g2d.setClip(null);
Style.paintBorder(g2d, style, width, height); Style.paintBorder(g2d, style, width, height);
} }

13
designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.toast;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.module.ModuleContext; import com.fr.module.ModuleContext;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -51,12 +52,16 @@ public class ToastMsgDialog extends UIDialog {
hide_height = dimension.height; hide_height = dimension.height;
setSize(new Dimension(dimension.width, 0)); setSize(new Dimension(dimension.width, 0));
contentPane.setSize(dimension); contentPane.setSize(dimension);
setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame()); setRelativeLocation(dimension);
int positionY = DesignerContext.getDesignerFrame().getContentFrame().getLocationOnScreen().y + 10;
setLocation((DesignerContext.getDesignerFrame().getWidth() - dimension.width) / 2, positionY);
addMouseEvent(contentPane); addMouseEvent(contentPane);
} }
private void setRelativeLocation(Dimension dimension) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
int positionX = designerFrame.getLocationOnScreen().x + (designerFrame.getWidth() - dimension.width) / 2;
int positionY = designerFrame.getContentFrame().getLocationOnScreen().y + 10;
this.setLocation(positionX, positionY);
}
private Dimension calculatePreferSize() { private Dimension calculatePreferSize() {
Dimension contentDimension = contentPane.getPreferredSize(); Dimension contentDimension = contentPane.getPreferredSize();
@ -106,7 +111,7 @@ public class ToastMsgDialog extends UIDialog {
Dimension dimension = ToastMsgDialog.this.getSize(); Dimension dimension = ToastMsgDialog.this.getSize();
ToastMsgDialog.this.setSize(new Dimension(dimension.width, dimension.height - 5)); ToastMsgDialog.this.setSize(new Dimension(dimension.width, dimension.height - 5));
} }
}, 0,50, TimeUnit.MILLISECONDS); }, 0, 50, TimeUnit.MILLISECONDS);
} }
}, 5000, TimeUnit.MILLISECONDS); }, 5000, TimeUnit.MILLISECONDS);

17
designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

@ -6,6 +6,7 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
@ -31,11 +32,19 @@ public class SaveFailureHandler implements ThrowableHandler {
@Override @Override
public boolean process(Throwable e) { public boolean process(Throwable e) {
for (Handler handler : Handler.values()) { UIUtil.invokeLaterIfNeeded(new Runnable() {
if (handler.process(e)) { @Override
break; public void run() {
for (Handler handler : Handler.values()) {
try {
if (handler.process(e)) {
break;
}
} catch (Exception ignored) {
}
}
} }
} });
return true; return true;
} }

BIN
designer-base/src/main/resources/com/fr/design/images/transparent_background.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 26 KiB

6
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithThemeStyle.java

@ -2,7 +2,6 @@ package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -75,11 +74,6 @@ public class ChartTextAttrPaneWithThemeStyle extends ChartTextAttrPane {
textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM); textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM);
} }
@Override
protected void initFontColorState() {
setFontColor(new UIColorButtonWithAuto());
}
protected double[] getRowSize() { protected double[] getRowSize() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
return new double[]{p, p}; return new double[]{p, p};

10
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPane.java

@ -1,5 +1,6 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.design.gui.ibutton.UIColorButtonWithAuto;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle;
@ -33,7 +34,7 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
if (isInCondition() || !ChartEditContext.supportTheme()) { if (isInCondition() || !ChartEditContext.supportTheme()) {
return super.createCommonStylePane(); return super.createCommonStylePane();
} }
setTextAttrPane(new ChartTextAttrPaneWithThemeStyle()); setTextAttrPane(new LabelAttrPaneWithThemeStyle());
JPanel stylePanel = new JPanel(new BorderLayout()); JPanel stylePanel = new JPanel(new BorderLayout());
stylePanel.add(getTextAttrPane(), BorderLayout.CENTER); stylePanel.add(getTextAttrPane(), BorderLayout.CENTER);
@ -66,4 +67,11 @@ public class VanChartLabelContentPane extends VanChartTooltipContentPane {
} }
} }
} }
class LabelAttrPaneWithThemeStyle extends ChartTextAttrPaneWithThemeStyle {
@Override
protected void initFontColorState() {
setFontColor(new UIColorButtonWithAuto());
}
}
} }

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java

@ -13,6 +13,7 @@ import com.fr.form.share.DefaultSharableWidget;
import com.fr.form.share.Group; import com.fr.form.share.Group;
import com.fr.form.share.GroupManege; import com.fr.form.share.GroupManege;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -54,7 +55,7 @@ public class LocalWidgetUpdater implements Process<Double> {
return 0 <= processValue && processValue <= 1; return 0 <= processValue && processValue <= 1;
} }
public void updateWidget(String remoteLatestWidgetId, UpdateListener updateListener) { public void updateWidget(OnlineShareWidget remoteLatestWidget, UpdateListener updateListener) {
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
ComponentCollector.getInstance().collectDownloadPktNum(); ComponentCollector.getInstance().collectDownloadPktNum();
} }
@ -77,7 +78,7 @@ public class LocalWidgetUpdater implements Process<Double> {
} }
String filePath; String filePath;
try { try {
filePath = DownloadUtils.download(remoteLatestWidgetId, widget.getName() + "." + widget.getId(), LocalWidgetUpdater.this); filePath = DownloadUtils.download(remoteLatestWidget.getId(), remoteLatestWidget.getFileLoca(), LocalWidgetUpdater.this);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetRepoPane.java

@ -438,7 +438,7 @@ public class LocalWidgetRepoPane extends BasicPane {
LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance(); LocalWidgetRepoUpdater updater = LocalWidgetRepoUpdater.getInstance();
for (LocalWidgetBlock block: blockList) { for (LocalWidgetBlock block: blockList) {
OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(block.getWidget()); OnlineShareWidget remoteLatestWidget = updater.findLatestRemoteWidget(block.getWidget());
block.getUpdater().updateWidget(remoteLatestWidget.getId(), new LocalWidgetUpdater.UpdateListener() { block.getUpdater().updateWidget(remoteLatestWidget, new LocalWidgetUpdater.UpdateListener() {
@Override @Override
public void onUpdated(boolean success, String group, String id) { public void onUpdated(boolean success, String group, String id) {
updateGuard -= 1; updateGuard -= 1;

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

@ -37,6 +37,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
@ -68,9 +71,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(getReusesUrl(), id); CloseableHttpResponse fileRes = postDownloadHttpResponse(getReusesUrl(), 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);
@ -106,9 +109,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(getPackageReusesUrl(), id); Map<String, String> params = new HashMap<>();
params.put("designerVersion", ProductConstants.RELEASE_VERSION);
CloseableHttpResponse fileRes = postDownloadHttpResponse(getPackageReusesUrl(), 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;
@ -145,9 +150,9 @@ public class DownloadUtils {
public static FormTheme downloadThemeFile(String themePath) { public static FormTheme downloadThemeFile(String themePath) {
try { try {
CloseableHttpResponse fileRes = getHttpResponse(themePath); CloseableHttpResponse fileRes = getDownloadHttpResponse(themePath);
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) {
HttpEntity entity = fileRes.getEntity(); HttpEntity entity = fileRes.getEntity();
@ -177,21 +182,33 @@ public class DownloadUtils {
return null; return null;
} }
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()

5
designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

@ -14,6 +14,7 @@ import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -251,7 +252,7 @@ public class OnlineShopUtils {
} }
public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) { public static OnlineShareWidget[] getPackageWidgets(OnlineShareWidget widgetPackage) {
String plistUrl = getPackageChildrenPath() + widgetPackage.getId(); String plistUrl = getPackageChildrenPath() + widgetPackage.getId() + "?designerVersion="+ ProductConstants.RELEASE_VERSION;
OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl); OnlineShareWidget[] widgets = getOnlineShareWidgets(plistUrl);
for (OnlineShareWidget widget : widgets) { for (OnlineShareWidget widget : widgets) {
widget.setParentPackage(widgetPackage); widget.setParentPackage(widgetPackage);
@ -287,7 +288,7 @@ public class OnlineShopUtils {
onlineShareWidgets.add(widget); onlineShareWidgets.add(widget);
} }
} }
return onlineShareWidgets.toArray(new OnlineShareWidget[onlineShareWidgets.size()]); return onlineShareWidgets.toArray(new OnlineShareWidget[0]);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

12
designer-realize/src/main/java/com/fr/design/actions/cell/BorderAction.java

@ -110,13 +110,17 @@ public class BorderAction extends ElementCaseAction implements ChangeListener {
public boolean update(ElementCasePane<?> elementCasePane) { public boolean update(ElementCasePane<?> elementCasePane) {
resetSelectedElementsStyleToCustom(elementCasePane); boolean success;
if (oldCellBorderStyle.isNoneBorderStyle()) { if (oldCellBorderStyle.isNoneBorderStyle()) {
//无边框格式 //无边框格式
return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); success = BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle);
} else {
success = BorderUtils.update(elementCasePane, oldCellBorderStyle);
}
if (success) {
resetSelectedElementsStyleToCustom(elementCasePane);
} }
return BorderUtils.update(elementCasePane, oldCellBorderStyle); return success;
} }
@Override @Override

10
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -206,11 +206,8 @@ public class DesignerSocketIO {
UIUtil.invokeLaterIfNeeded(new Runnable() { UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
if (dialog == null) { if (dialog == null || !dialog.isShow()) {
dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent()); dialog = DesignerToastMsgUtil.createPromptDialog(createDialogContent());
}
if (!dialog.isShow()) {
dialog.setVisible(true); dialog.setVisible(true);
} }
} }
@ -284,7 +281,7 @@ public class DesignerSocketIO {
private static void printLog(Object[] objects, PrintEventLog printEventLog, String prefix) { private static void printLog(Object[] objects, PrintEventLog printEventLog, String prefix) {
for (Object object : objects) { for (Object object : objects) {
if (object instanceof Throwable) { if (object instanceof Throwable) {
Throwable throwable = (Throwable) object; Throwable throwable = (Throwable) object;
printEventLog.printThrowable(throwable); printEventLog.printThrowable(throwable);
} else { } else {
printEventLog.print(prefix, object); printEventLog.print(prefix, object);
@ -294,7 +291,8 @@ public class DesignerSocketIO {
interface PrintEventLog { interface PrintEventLog {
void printThrowable(Throwable throwable); void printThrowable(Throwable throwable);
void print(String s, Object ...object);
void print(String s, Object... object);
} }
enum PrintEventLogImpl implements PrintEventLog { enum PrintEventLogImpl implements PrintEventLog {

3
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -53,6 +53,7 @@ import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -78,7 +79,7 @@ public class ReportStylePane extends BasicPane {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
previewArea = new CellStylePreviewPane(); previewArea = new CellStylePreviewPane(true, true);
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false); followingThemeButtonGroup.setAutoFireStateChanged(false);
customStylePane = new CustomFloatStyleSettingPane(); customStylePane = new CustomFloatStyleSettingPane();

Loading…
Cancel
Save