Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

feature/10.0
pengda 3 years ago
parent
commit
3cd82a1ec0
  1. 30
      designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 28
      designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java
  5. 7
      designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java
  6. 5
      designer-base/src/main/java/com/fr/design/mod/ContentReplacer.java
  7. 4
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/JavaScriptContentReplacer.java
  8. 5
      designer-base/src/main/java/com/fr/design/mod/impl/repalce/VanChartHtmlLabelContentReplacer.java
  9. 15
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  10. 14
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  11. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java
  12. 10
      designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java
  13. 4
      designer-realize/src/main/java/com/fr/design/share/ui/generate/EffectContent.java
  14. 28
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java
  15. 13
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

30
designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java

@ -6,6 +6,7 @@ import com.fr.base.ParameterMapNameSpace;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EscapeSqlHelper; import com.fr.data.impl.EscapeSqlHelper;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.decision.config.PreventSqlInjConfig;
import com.fr.decision.webservice.v10.config.ConfigService; import com.fr.decision.webservice.v10.config.ConfigService;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.link.MessageWithLink; import com.fr.design.dialog.link.MessageWithLink;
@ -18,6 +19,7 @@ import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -46,6 +48,8 @@ import java.awt.Frame;
import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -144,6 +148,12 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
this.add(centerPanel, BorderLayout.CENTER); this.add(centerPanel, BorderLayout.CENTER);
this.add(bottomPanel, BorderLayout.SOUTH); this.add(bottomPanel, BorderLayout.SOUTH);
this.setSize(600, 400); this.setSize(600, 400);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
close();
}
});
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
} }
@ -167,27 +177,24 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
parameterMap.put(parameter.getName(), parameter.getValue()); parameterMap.put(parameter.getName(), parameter.getValue());
} }
} }
boolean showOriginSql = true;
for (ParameterProvider parameter : DataOperator.getInstance().getTableDataParameters(tableData)) { for (ParameterProvider parameter : DataOperator.getInstance().getTableDataParameters(tableData)) {
if (parameterMap.containsKey(parameter.getName())) { if (parameterMap.containsKey(parameter.getName())) {
Object value = parameterMap.get(parameter.getName()); parameter.setValue(parameterMap.get(parameter.getName()));
if (value != null && !StringUtils.EMPTY.equals(value)) {
showOriginSql = false;
}
parameter.setValue(value);
} }
} }
String sql; String sql;
// 计算高亮文本位置 // 计算高亮文本位置
List<int[]> specialCharParamIndex = null; List<int[]> specialCharParamIndex = null;
boolean highlight = true; boolean highlight = true;
if (showOriginSql) {
sql = tableData.getQuery();
} else {
NameSpace ns = ParameterMapNameSpace.create(parameterMap); NameSpace ns = ParameterMapNameSpace.create(parameterMap);
calculator.pushNameSpace(ns); calculator.pushNameSpace(ns);
Parameter[] paras = processParameters(tableData, calculator); Parameter[] paras = processParameters(tableData, calculator);
// 所有被转义参数的集合 // 所有被转义参数的集合
// 远程时如何获取服务器上的转义字符?这里比较恶心
// 方法1是新增rpc接口,交由服务器去获取转义字符。但是要考虑兼容问题:
// 新设计器jar远程老服务器jar,需要提供Compatible实现,但是这个实现能做什么呢?目前没有老的接口可以去获取服务器的转义字符,仍然啥也做不了;
// 现在采用方法2,通过反射调用PreventSqlInjConfig的刷新方法(因为它是decision模块的private方法,直接改成public仍然有兼容问题)
Reflect.on(PreventSqlInjConfig.class).call("refreshPreventSqlInjConfig");
Set<String> specialCharParam = EscapeSqlHelper.getInstance().getSpecialCharParam(paras); Set<String> specialCharParam = EscapeSqlHelper.getInstance().getSpecialCharParam(paras);
// 将参数转义等 // 将参数转义等
Set<TableDataProvider> tableDataProviders = getTableDataProviders(); Set<TableDataProvider> tableDataProviders = getTableDataProviders();
@ -203,7 +210,6 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
if (!StringUtils.equals(oldSql, sql)) { if (!StringUtils.equals(oldSql, sql)) {
highlight = false; highlight = false;
} }
}
// sql内容复制到剪切板 // sql内容复制到剪切板
StringSelection selection = new StringSelection(sql); StringSelection selection = new StringSelection(sql);
java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
@ -274,4 +280,8 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
this.dispose(); this.dispose();
} }
private void close() {
this.dispose();
}
} }

4
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -482,7 +482,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements L
UILabel label = new UILabel(labelText + getWrapperLabelText()) { UILabel label = new UILabel(labelText + getWrapperLabelText()) {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f)); ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
super.paint(g); super.paint(g);
} }
}; };
@ -490,7 +490,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements L
label.setOpaque(true); label.setOpaque(true);
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setForeground(Color.decode("#333334")); label.setForeground(Color.decode("#333334"));
label.setFont(label.getFont().deriveFont(10F)); label.setFont(label.getFont().deriveFont(11F));
label.setPreferredSize(new Dimension(224, 26)); label.setPreferredSize(new Dimension(224, 26));
this.nameEdList = nameEdList; this.nameEdList = nameEdList;
this.add(label, BorderLayout.NORTH); this.add(label, BorderLayout.NORTH);

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

@ -52,6 +52,7 @@ import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -863,7 +864,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
JTemplate<?, ?> editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
StringBuilder defaultTitleSB = new StringBuilder(); StringBuilder defaultTitleSB = new StringBuilder();
defaultTitleSB.append(ProductConstants.PRODUCT_NAME); defaultTitleSB.append(ProductConstants.APP_NAME);
defaultTitleSB.append(" ");
defaultTitleSB.append(GeneralUtils.getVersion());
defaultTitleSB.append(" "); defaultTitleSB.append(" ");
defaultTitleSB.append(ProductConstants.BRANCH); defaultTitleSB.append(ProductConstants.BRANCH);
defaultTitleSB.append(" "); defaultTitleSB.append(" ");

28
designer-base/src/main/java/com/fr/design/mod/ContentObjectManager.java

@ -9,6 +9,8 @@ import com.fr.data.SimpleDSColumn;
import com.fr.data.condition.FormulaCondition; import com.fr.data.condition.FormulaCondition;
import com.fr.data.impl.FormulaDictionary; import com.fr.data.impl.FormulaDictionary;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.mod.impl.repalce.JavaScriptContentReplacer;
import com.fr.design.mod.impl.repalce.VanChartHtmlLabelContentReplacer;
import com.fr.form.main.FormHyperlink; import com.fr.form.main.FormHyperlink;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetTitle;
@ -22,6 +24,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FunctionGrouper; import com.fr.report.cell.cellattr.core.group.FunctionGrouper;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -49,6 +52,8 @@ public class ContentObjectManager {
private final Set<String> set = new HashSet<>(); private final Set<String> set = new HashSet<>();
private final Map<String, ContentReplacer> map = new HashMap<>();
private ContentObjectManager() { private ContentObjectManager() {
set.add(Formula.class.getName()); set.add(Formula.class.getName());
set.add(JavaScriptImpl.class.getName()); set.add(JavaScriptImpl.class.getName());
@ -70,6 +75,8 @@ public class ContentObjectManager {
set.add(SelectCount.class.getName()); set.add(SelectCount.class.getName());
set.add(WidgetTitle.class.getName()); set.add(WidgetTitle.class.getName());
set.add(FunctionGrouper.class.getName()); set.add(FunctionGrouper.class.getName());
map.put(JavaScriptImpl.class.getName(), new JavaScriptContentReplacer());
map.put(VanChartHtmlLabel.class.getName(), new VanChartHtmlLabelContentReplacer());
} }
public void searchObject(Object ob) { public void searchObject(Object ob) {
@ -84,6 +91,9 @@ public class ContentObjectManager {
objectMap = ClassHelper.searchObject(ob, set, filter); objectMap = ClassHelper.searchObject(ob, set, filter);
} }
public void clearObject() { public void clearObject() {
if (objectMap != null) {
objectMap.clear();
}
objectMap = null; objectMap = null;
} }
@ -92,4 +102,22 @@ public class ContentObjectManager {
return objectMap; return objectMap;
} }
public boolean needContentTip(Object ob, Set<String> nameSet) {
long start = System.currentTimeMillis();
objectMap = ClassHelper.searchObject(ob, set, ModClassFilter.getInstance());
for (Map.Entry<String, Set<Object>> entry : objectMap.entrySet()) {
for (Object o : entry.getValue()) {
for (String name : nameSet) {
ContentReplacer contentReplacer = map.get(entry.getKey());
if (contentReplacer!= null && contentReplacer.contain(o, name)) {
clearObject();
return true;
}
}
}
}
clearObject();
return false;
}
} }

7
designer-base/src/main/java/com/fr/design/mod/ContentReplaceUtil.java

@ -168,5 +168,12 @@ public class ContentReplaceUtil {
return content; return content;
} }
public static boolean containsName(String content, String name) {
if (StringUtils.isNotEmpty(content)) {
return content.contains(name);
}
return false;
}
} }

5
designer-base/src/main/java/com/fr/design/mod/ContentReplacer.java

@ -10,4 +10,9 @@ public interface ContentReplacer<T> {
void replace(T t, String oldName, String newName); void replace(T t, String oldName, String newName);
default boolean contain(T t, String name) {
return false;
}
} }

4
designer-base/src/main/java/com/fr/design/mod/impl/repalce/JavaScriptContentReplacer.java

@ -19,4 +19,8 @@ public class JavaScriptContentReplacer implements ContentReplacer<JavaScriptImpl
} }
} }
@Override
public boolean contain(JavaScriptImpl javaScript, String name) {
return ContentReplaceUtil.containsName(javaScript.getContent(), name);
}
} }

5
designer-base/src/main/java/com/fr/design/mod/impl/repalce/VanChartHtmlLabelContentReplacer.java

@ -19,4 +19,9 @@ public class VanChartHtmlLabelContentReplacer implements ContentReplacer<VanChar
ContentReplaceUtil.replaceContent(vanChartHtmlLabel.getCustomText(), oldName, newName)); ContentReplaceUtil.replaceContent(vanChartHtmlLabel.getCustomText(), oldName, newName));
} }
} }
@Override
public boolean contain(VanChartHtmlLabel vanChartHtmlLabel, String name) {
return ContentReplaceUtil.containsName(vanChartHtmlLabel.getCustomText(), name);
}
} }

15
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -112,6 +112,21 @@ public class XWTitleLayout extends DedicateLayoutContainer {
return null; return null;
} }
/**
* 返回body组件
* @return body组件
*/
public XCreator getBodyCreator() {
for (int i=0; i < getXCreatorCount(); i++) {
XCreator creator = getXCreator(i);
if (creator.hasTitleStyle()) {
return creator;
}
}
return null;
}
/** /**
* 编辑状态的时候需要重新绘制下边框 * 编辑状态的时候需要重新绘制下边框
* *

14
designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java

@ -1,13 +1,11 @@
package com.fr.design.designer.treeview; package com.fr.design.designer.treeview;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -38,7 +36,7 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
} }
if (icon != null) { if (icon != null) {
setIcon(icon); setIcon(icon);
this.needAddShareIcon = isShareWidget((XCreator) value); this.needAddShareIcon = ShareComponentUtils.isShareWidgetWithChild((XCreator) value);
} }
} }
@ -47,14 +45,6 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
return this; return this;
} }
private boolean isShareWidget(XCreator xCreator) {
if (!xCreator.toData().acceptType(AbstractBorderStyleWidget.class)) {
return false;
}
ExtendSharableAttrMark attrMark = ((AbstractBorderStyleWidget) xCreator.toData()).getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
return attrMark != null && StringUtils.isNotEmpty(attrMark.getShareId());
}
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);

14
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -5,6 +5,7 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
@ -91,6 +92,19 @@ public class ShareComponentUtils {
return false; return false;
} }
public static boolean isShareWidgetWithChild(XCreator xCreator) {
boolean result = isShareWidget(xCreator);
if (result) {
return true;
}
//做下兼容处理,老的组件结构的共享信息存储在子组件上
if (xCreator instanceof XWTitleLayout) {
XCreator child = ((XWTitleLayout) xCreator).getBodyCreator();
return isShareWidget(child);
}
return false;
}
public static List<XCreator> getHelpConfigXCreatorList(XCreator root) { public static List<XCreator> getHelpConfigXCreatorList(XCreator root) {
List<XCreator> helpConfigXCreatorList = new ArrayList<>(); List<XCreator> helpConfigXCreatorList = new ArrayList<>();

10
designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java

@ -111,8 +111,11 @@ public class EffectItemGroup {
ChartCollection chartCollection = (ChartCollection) value; ChartCollection chartCollection = (ChartCollection) value;
for (int index = 0; index < chartCollection.getChartCount(); index++) { for (int index = 0; index < chartCollection.getChartCount(); index++) {
Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class);
SourceNode chartSourceNode = SourceNodeUtils.createSourceNode(chart.getPlot(), chartCollection.getChartName(index), cellSourceNode);
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if (plot == null) {
continue;
}
SourceNode chartSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), cellSourceNode);
initChartPlot(plot, chartSourceNode, false); initChartPlot(plot, chartSourceNode, false);
} }
@ -126,8 +129,11 @@ public class EffectItemGroup {
ChartCollection chartCollection = (ChartCollection) editor.getChartCollection(); ChartCollection chartCollection = (ChartCollection) editor.getChartCollection();
for (int index = 0; index < chartCollection.getChartCount(); index++) { for (int index = 0; index < chartCollection.getChartCount(); index++) {
Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class); Chart chart= (Chart) chartCollection.getChart(index, ChartProvider.class);
SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(chart.getPlot(), chartCollection.getChartName(index), null);
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if (plot == null) {
continue;
}
SourceNode plotSourceNode = SourceNodeUtils.createSourceNode(plot, chartCollection.getChartName(index), null);
initChartPlot(plot, plotSourceNode, false); initChartPlot(plot, plotSourceNode, false);
} }

4
designer-realize/src/main/java/com/fr/design/share/ui/generate/EffectContent.java

@ -56,8 +56,8 @@ public class EffectContent extends JPanel {
Object[] columnNames = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_From"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Rename")}; Object[] columnNames = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_From"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Share_Rename")};
JTable table = new JTable(new EffectTableModel(effectItemGroup, columnNames)); JTable table = new JTable(new EffectTableModel(effectItemGroup, columnNames));
table.setRowHeight(25); table.setRowHeight(25);
table.getColumnModel().getColumn(0).setPreferredWidth(235); table.getColumnModel().getColumn(0).setPreferredWidth(230);
table.getColumnModel().getColumn(1).setPreferredWidth(325); table.getColumnModel().getColumn(1).setPreferredWidth(320);
table.setDefaultEditor(EffectTableModel.class, new EffectItemEditor(table)); table.setDefaultEditor(EffectTableModel.class, new EffectItemEditor(table));

28
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareGeneratePane.java

@ -1,5 +1,6 @@
package com.fr.design.share.ui.generate; package com.fr.design.share.ui.generate;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -11,11 +12,14 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.share.Bean.ComponentGenerateInfo; import com.fr.design.mainframe.share.Bean.ComponentGenerateInfo;
import com.fr.design.mainframe.share.action.ShareUIAspect; import com.fr.design.mainframe.share.action.ShareUIAspect;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.exception.LackOfValueException; import com.fr.design.mainframe.share.exception.LackOfValueException;
import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter; import com.fr.design.mainframe.share.generate.ComponentGeneratorCenter;
import com.fr.design.mainframe.share.select.ComponentTransformerFactory;
import com.fr.design.mod.ContentObjectManager;
import com.fr.form.share.exception.NetWorkFailedException; import com.fr.form.share.exception.NetWorkFailedException;
import com.fr.form.share.group.DefaultShareGroup; import com.fr.form.share.group.DefaultShareGroup;
import com.fr.design.mainframe.share.util.ShareUIUtils; import com.fr.design.mainframe.share.util.ShareUIUtils;
@ -31,6 +35,8 @@ import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
@ -56,7 +62,7 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
**/ **/
public class ShareGeneratePane extends BasicPane { public class ShareGeneratePane extends BasicPane {
private static final Dimension DIALOG_SIZE = new Dimension(670, 740); private static final Dimension DIALOG_SIZE = new Dimension(670, 760);
private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610); private static final Dimension DIALOG_NORMAL_SIZE = new Dimension(670, 610);
private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6); private static final Border DIALOG_BORDER = BorderFactory.createEmptyBorder(0, 6, 4, 6);
@ -100,8 +106,9 @@ public class ShareGeneratePane extends BasicPane {
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.mainPane = FRGUIPaneFactory.createCardLayout_S_Pane(); this.mainPane = FRGUIPaneFactory.createCardLayout_S_Pane();
this.simplePane = new ShareMainPane(shareCover, rec, false, effectItemGroups); boolean needContentTip = needContentTip();
this.uploadPane = new ShareMainPane(shareCover, rec, true, effectItemGroups); this.simplePane = new ShareMainPane(shareCover, rec, false, effectItemGroups, needContentTip);
this.uploadPane = new ShareMainPane(shareCover, rec, true, effectItemGroups, needContentTip);
//暂时换一下,目前不用上传 //暂时换一下,目前不用上传
this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED)); this.mainPane.add(simplePane, ShareUIUtils.convertStateChange(ItemEvent.DESELECTED));
this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED)); this.mainPane.add(uploadPane, ShareUIUtils.convertStateChange(ItemEvent.SELECTED));
@ -161,6 +168,21 @@ public class ShareGeneratePane extends BasicPane {
} }
} }
private boolean needContentTip() {
long start = System.currentTimeMillis();
XCreator xCreator = ComponentTransformerFactory.getInstance().transform(WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection()).getMiddle();
Set<XCreator> xCreators = new HashSet<>();
xCreator.traversalNameRelatedXCreators(xCreators);
Set<String> nameSet = new HashSet<>();
for (XCreator creator : xCreators) {
nameSet.add(creator.toData().getWidgetName());
}
boolean result = ContentObjectManager.getInstance().needContentTip(shareWidget, nameSet);
FineLoggerFactory.getLogger().debug("needContentTip spend {} ms", (System.currentTimeMillis() - start));
return result;
}
private JPanel createUploadCheckBox() { private JPanel createUploadCheckBox() {
JPanel panel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); JPanel panel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane();

13
designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

@ -131,13 +131,15 @@ public class ShareMainPane extends JPanel {
private boolean upload; private boolean upload;
private List<EffectItemGroup> effectItemGroups; private List<EffectItemGroup> effectItemGroups;
private final boolean needContentTip;
public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List<EffectItemGroup> effectItemGroups) { public ShareMainPane(Image shareCover, Rectangle rec, boolean upload, List<EffectItemGroup> effectItemGroups, boolean needContentTip) {
this.shareCover = shareCover; this.shareCover = shareCover;
this.rec = rec; this.rec = rec;
this.upload = upload; this.upload = upload;
this.effectItemGroups = effectItemGroups; this.effectItemGroups = effectItemGroups;
this.needContentTip = needContentTip;
initCover(shareCover); initCover(shareCover);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -174,7 +176,14 @@ public class ShareMainPane extends JPanel {
private JPanel createOverviewPane(boolean upload) { private JPanel createOverviewPane(boolean upload) {
JPanel componentPane = createComponentOverviewPane(upload); JPanel componentPane = createComponentOverviewPane(upload);
String title = Toolkit.i18nText("Fine-Design_Share_Overview"); String title = Toolkit.i18nText("Fine-Design_Share_Overview");
JPanel overviewPane = FRGUIPaneFactory.createTitledBorderPane(title); JPanel overviewPane = FRGUIPaneFactory.createTopVerticalTitledBorderPane(title);
if (needContentTip) {
UILabel tipsLabel = ShareUIUtils.createTipsLabel(Toolkit.i18nText("Fine-Design_Share_Generate_Content_Tip"));
tipsLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
JPanel panel = new JPanel(FRGUIPaneFactory.createBorderLayout());
panel.add(tipsLabel);
overviewPane.add(panel, BorderLayout.NORTH);
}
overviewPane.add(componentPane, BorderLayout.CENTER); overviewPane.add(componentPane, BorderLayout.CENTER);
return overviewPane; return overviewPane;

Loading…
Cancel
Save