Browse Source

Pull request #6689: REPORT-62647 & REPORT-62652 & REPORT-62576 & REPORT-62677 & REPORT-62677

Merge in DESIGN/design from ~STARRYI/design:feature/x to feature/x

* commit '1b42276edf338ca8c89b4b66b77c97e54dc1b519':
  REPORT-62653 【组件可更新提醒】组件复用-组件上“版本不兼容”提示文字不明显
  REPORT-62677 组件复用-在线组件页面数据加载失败
  REPORT-62576 【组件可更新提醒】组件复用-更新过程中取消更新失败
  REPORT-62652 【组件可更新提醒】组件复用-不兼容弹窗图标应该是红色标识
  REPORT-62647 组件更新成功后可更新标志应该消失
feature/x
starryi 3 years ago
parent
commit
ee3c85ab22
  1. 17
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  2. 36
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetUpdater.java
  3. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/OnlineShopUtils.java

17
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.share.ui.block; package com.fr.design.mainframe.share.ui.block;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.iofile.attr.SharableAttrMark; import com.fr.base.iofile.attr.SharableAttrMark;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
@ -38,8 +39,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.UIManager;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
@ -57,6 +60,7 @@ import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.font.FontRenderContext; import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.UUID; import java.util.UUID;
@ -224,7 +228,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
} }
if (!widget.isCompatibleWithCurrentEnv()) { if (!widget.isCompatibleWithCurrentEnv()) {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip") Toolkit.i18nText("Fine-Design_Share_Drag_And_Make_Incompatible_Component_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
); );
return; return;
} }
@ -293,17 +300,17 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
double canvasH = coverDim.getHeight(); double canvasH = coverDim.getHeight();
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F)); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.4F));
GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH - 16); GraphHelper.fillRect(g2d, canvasX, canvasY, canvasW, canvasH);
g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F)); g2d.setColor(new Color(0.0F, 0.0F, 0.0F, 0.5F));
GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16); GraphHelper.fillRect(g2d, canvasX, canvasH - 16, canvasW, 16);
String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip"); String tipText = Toolkit.i18nText("Fine-Design_Share_Incompatible_Version_Tip");
Font tipFont = FRFont.getInstance().deriveFont(8F); Font tipFont = FRContext.getDefaultValues().getFRFont().deriveFont(8.0F);
FontRenderContext frc = g2d.getFontRenderContext(); FontRenderContext frc = g2d.getFontRenderContext();
double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc); double tipTextWidth = GraphHelper.stringWidth(tipText, tipFont, frc);
Dimension2D dim = GraphHelper.stringDimensionWithRotation(tipText, tipFont, 0, frc); LineMetrics metrics = tipFont.getLineMetrics(tipText, frc);
double tipTextHeight = dim.getHeight(); double tipTextHeight = metrics.getHeight();
g2d.setColor(Color.WHITE); g2d.setColor(Color.WHITE);
g2d.setFont(tipFont); g2d.setFont(tipFont);
GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F); GraphHelper.drawString(g2d, tipText, canvasX + (canvasW - tipTextWidth) / 2.0F, canvasY + canvasH - (16 - tipTextHeight) / 2.0F);

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

@ -11,6 +11,9 @@ import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.form.share.DefaultSharableWidget; 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.SharableWidgetProvider;
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;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -20,7 +23,6 @@ import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException;
/** /**
* @author Starryi * @author Starryi
@ -103,9 +105,12 @@ public class LocalWidgetUpdater implements Process<Double> {
boolean success = false; boolean success = false;
try { try {
success = get(); success = get();
} catch (InterruptedException | ExecutionException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (success) {
resetWidgetOfBlock();
}
if (updateListener != null) { if (updateListener != null) {
updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId()); updateListener.onUpdated(success, getGroup().getGroupName(), widget.getId());
} }
@ -115,19 +120,38 @@ public class LocalWidgetUpdater implements Process<Double> {
worker.execute(); worker.execute();
} }
private void resetWidgetOfBlock() {
GroupManege groupManege = DefaultShareGroupManager.getInstance();
Group group = groupManege.getGroup(getGroup().getGroupName());
if (group != null) {
String id = widgetBlock.getWidgetUuid();
if (StringUtils.isNotEmpty(id)) {
SharableWidgetProvider localLatestWidget = group.getElCaseBindInfoById(widgetBlock.getWidgetUuid());
if (localLatestWidget instanceof DefaultSharableWidget) {
widgetBlock.widget = (DefaultSharableWidget) localLatestWidget;
repaintBlockAndOverlay();
}
}
}
}
public void cancelUpdate() { public void cancelUpdate() {
if (worker.isDone() || worker.isCancelled()) { if (worker != null && !worker.isDone()) {
return; worker.cancel(true);
worker = null;
} }
worker.cancel(true);
process(-1.0); process(-1.0);
} }
@Override @Override
public void process(Double processValue) { public void process(Double processValue) {
this.processValue = processValue; this.processValue = processValue;
repaintBlockAndOverlay();
}
UIUtil.invokeAndWaitIfNeeded(new Runnable() { private void repaintBlockAndOverlay() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override @Override
public void run() { public void run() {
Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock); Container absoluteLayoutParent = getAbsoluteLayoutAncestor(widgetBlock);

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

@ -46,7 +46,7 @@ public class OnlineShopUtils {
} }
private static String getWidgetReusePath() { private static String getWidgetReusePath() {
return getReuInfoPath(); return StableUtils.pathJoin(getReuInfoPath(), "all/detail/");
} }
private static String getPackageChildrenPath() { private static String getPackageChildrenPath() {

Loading…
Cancel
Save