Browse Source

Merge pull request #6343 in DESIGN/design from final/11.0 to release/11.0

* commit '225d19cb2356e32a60eb42706cd93e2840642c6a': (25 commits)
  REPORT-60896 mac目录蒙层结束后有遗留透明块
  REPORT-61299 popupMenu的子组件高亮不需要弹窗
  REPORT-61299 弹窗类面板高亮区域不加白边
  REPORT-61437 导出-导出事件-自定义命名-提示文字会消失
  REPORT-60896 代码还原
  REPORT-61301 布局推荐-mac设计器全屏时,固定布局/非固定布局的弹窗飘移
  无JIRA任务 引导任务的组件替换下
  REPORT-61415 主题色颜色选择框黑色列不符合设计
  REPORT-61413 【主题切换】cpt预览图里的左上角斜线单元格应该和小标题格式一致
  REPORT-60896 引导蒙层有残留阴影
  REPORT-61207 引导相关字体显示不对且被截断
  REPORT-60366 fr11-linux设计器-插件无法在线更新
  CHART-21579 模版主题编辑页面-图表-系列-渐变色的色值联动逻辑修改
  CHART-21560 【FR11】图表tab切换按钮切换编辑失效,无法触发保存
  REPORT-61373 【主题获取】11.0的组件下载不了
  CHART-21593 【主题获取】生成跟随主题的组件后,拖到其他主题的模板中,图表还是跟随主题
  REPORT-61338 设计器主题-主题配色修改保存后出现异常空白提示框
  REPORT-61361 新插件管理11.0适配
  REPORT-61302 【FR11】【组件背景分离】&【固定布局-原布局推荐4.1】决策报表-组件背景分离做过一个组件移入tab块,组件悬停在tab上超过1s就判断为移入tab内部,现在和10.0的效果不一样了
  REPORT-61012 & REPORT-61285 控件联动问题及样式问题
  ...
bugfix/11.0
superman 3 years ago
parent
commit
7a49da5e7a
  1. 10
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  2. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  3. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
  4. 8
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java
  5. 140
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  6. 78
      designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java
  7. 16
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java
  8. 7
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  9. 52
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  10. 21
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  11. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java
  12. 25
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
  13. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/utils/GuideUIUtils.java
  14. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  15. 42
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java
  16. 48
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  17. 60
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java
  18. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java
  19. 5
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ChartStyleEditPane.java
  20. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java
  21. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  22. 2
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  23. 2
      designer-base/src/main/java/com/fr/design/upm/UpmUtils.java
  24. 2
      designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java
  25. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  26. 3
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  27. 17
      designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java
  28. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  29. 4
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  30. 12
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

10
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -80,10 +80,12 @@ public class PluginUtils {
public static String transPluginsToString(List<PluginContext> plugins) throws Exception { public static String transPluginsToString(List<PluginContext> plugins) throws Exception {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
for (PluginContext plugin : plugins) { for (PluginContext plugin : plugins) {
JSONObject jo = new JSONObject(); if (VersionIntervalType.isSupported(plugin.supportCurrentFRVersion())) {
jo.put("id", plugin.getID()); JSONObject jo = new JSONObject();
jo.put("version", plugin.getVersion()); jo.put("id", plugin.getID());
jsonArray.put(jo); jo.put("version", plugin.getVersion());
jsonArray.put(jo);
}
} }
return jsonArray.toString(); return jsonArray.toString();
} }

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -314,7 +314,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver, UIOb
* @param newSelectedIndex * @param newSelectedIndex
*/ */
public void setSelectedIndex(int newSelectedIndex) { public void setSelectedIndex(int newSelectedIndex) {
setSelectedIndex(newSelectedIndex, true); setSelectedIndex(newSelectedIndex, false);
} }
private void fireStateChanged() { private void fireStateChanged() {

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java

@ -64,7 +64,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
@Override @Override
protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
super.setSelectedIndex(newSelectedIndex, fireChanged); super.setSelectedIndex(newSelectedIndex, false);
tabChanged(newSelectedIndex); tabChanged(newSelectedIndex);
} }
} }

8
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableEditorPane.java

@ -153,4 +153,12 @@ public class UITableEditorPane<T> extends BasicPane {
tableModel.stopCellEditing(); tableModel.stopCellEditing();
} }
/**
* 设置表头是否可以改变大小
*/
public void setHeaderResizing(boolean resizingAllowed){
editTable.getTableHeader().setResizingAllowed(resizingAllowed);
}
} }

140
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -72,7 +72,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private ExportRadioGroup templateRadioGroup; private ExportRadioGroup templateRadioGroup;
private UIRadioButton currentTemplateRadio; private UIRadioButton currentTemplateRadio;
private UIRadioButton otherTemplateRadio; private UIRadioButton otherTemplateRadio;
private UIComboBox exportTypeComboBox;
private CardLayout card; private CardLayout card;
private JPanel templatePanel; private JPanel templatePanel;
private CurrentTemplatePane currentTemplatePane; private CurrentTemplatePane currentTemplatePane;
@ -110,6 +109,8 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private FormulaEditor fileNameFormulaEditor; private FormulaEditor fileNameFormulaEditor;
private UICheckBox extendParametersCheckBox; private UICheckBox extendParametersCheckBox;
private ReportletParameterViewPane parameterViewPane; private ReportletParameterViewPane parameterViewPane;
private UIComboBox exportTypeComboBox;
private UILabel fileNameTipLabel;
public CurrentTemplatePane() { public CurrentTemplatePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -167,7 +168,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); fileNameFormulaEditor = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula"));
fileNameFormulaEditor.setVisible(false); fileNameFormulaEditor.setVisible(false);
fileNameFormulaEditor.setEnabled(false); fileNameFormulaEditor.setEnabled(false);
UILabel fileNameTipLabel = new UILabel("<html><body style=\"color:rgb(147,147,147)\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>"); fileNameTipLabel = new UILabel("<html><body style=\"color:rgb(147,147,147)\">" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Front") + "\\/:*?\"<>|" + Toolkit.i18nText("Fine-Design_Basic_Export_JS_Title_Tip_Back") + "</html>");
fileNameTipLabel.setVisible(false); fileNameTipLabel.setVisible(false);
fileNameRadioGroup.addActionListener(new ActionListener() { fileNameRadioGroup.addActionListener(new ActionListener() {
@Override @Override
@ -196,6 +197,56 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
fileNamePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2)); fileNamePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2));
return fileNamePane; return fileNamePane;
} }
public void updateSingleJavaScript(SingleJavaScript js){
js.setTemplatePath(DEFAULT);
js.setExportType(GeneralUtils.objectToString(exportTypeComboBox.getSelectedItem()));
js.setDefaultFileName(defaultNameRadio.isSelected());
js.setFileName(getFileName());
js.setExtendParameters(extendParametersCheckBox.isSelected());
if (extendParametersCheckBox.isSelected()) {
js.setParameters(null);
} else {
if (parameterViewPane != null) {
List<ParameterProvider> parameterList = parameterViewPane.update();
if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters);
js.setParameters(parameters);
}
}
}
}
public void populateSingleJavaScript(SingleJavaScript js){
exportTypeComboBox.setSelectedItem(js.getExportType());
fileNameRadioGroup.selectIndexButton(js.isDefaultFileName() ? 0 : 1);
if (!js.isDefaultFileName()) {
fileNameFormulaEditor.setEnabled(true);
fileNameFormulaEditor.setVisible(true);
fileNameTipLabel.setVisible(true);
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(js.getFileName()));
}
if (js.isExtendParameters()) {
extendParametersCheckBox.setSelected(true);
} else {
extendParametersCheckBox.setSelected(false);
if (this.parameterViewPane != null) {
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = js.getParameters();
this.parameterViewPane.populate(parameters);
}
}
}
private JPanel initExportTypePane() {
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type") + ":");
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}
, EXPORT_TYPES_MAP);
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}};
JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p});
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2));
return exportTypePane;
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
@ -214,6 +265,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other"))); this.setBorder(UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template_Other")));
editorPane = new UITableEditorPane<>(new ExportJSTableModel()); editorPane = new UITableEditorPane<>(new ExportJSTableModel());
editorPane.setHeaderResizing(false);
this.add(editorPane, BorderLayout.CENTER); this.add(editorPane, BorderLayout.CENTER);
} }
@ -221,6 +273,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public void reset() { public void reset() {
editorPane.populate(new SingleJavaScript[0]); editorPane.populate(new SingleJavaScript[0]);
} }
public void updateExportJavaScript(ExportJavaScript exportJavaScript){
List<SingleJavaScript> javaScripts = editorPane.update();
for (SingleJavaScript js : javaScripts) {
exportJavaScript.addOtherTemplateJS(js);
}
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
@ -433,7 +491,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
exportTypeComboBox.setSelectedItem(value); exportTypeComboBox.setSelectedItem(getList().get(row).getExportType());
return exportTypeComboBox; return exportTypeComboBox;
} }
@ -489,7 +547,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
fileNameComboBox.setSelectedItem(value); fileNameComboBox.setSelectedItem(getList().get(row).isDefaultFileName() ? DEFAULT : CUSTOM);
return fileNameComboBox; return fileNameComboBox;
} }
@ -588,7 +646,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override @Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
parameterSetting.setSelectedItem(value); parameterSetting.setSelectedItem(getList().get(row).isExtendParameters() ? DEFAULT : CUSTOM);
return parameterSetting; return parameterSetting;
} }
@ -729,17 +787,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
this.add(totalPanel); this.add(totalPanel);
} }
private JPanel initExportTypePane() {
UILabel typeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Type") + ":");
exportTypeComboBox = getComboBoxWithModel(new String[]{ExportJavaScript.EXPORT_PDF, ExportJavaScript.EXPORT_EXCEL_PAGE, ExportJavaScript.EXPORT_EXCEL_SIMPLE, ExportJavaScript.EXPORT_EXCEL_SHEET, ExportJavaScript.EXPORT_WORD, ExportJavaScript.EXPORT_IMAGE}
, EXPORT_TYPES_MAP);
Component[][] components = new Component[][]{{typeLabel, exportTypeComboBox}};
JPanel exportTypePane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p}, new double[]{p, p});
exportTypePane.setBorder(BorderFactory.createEmptyBorder(5, 2, 5, 2));
return exportTypePane;
}
private JPanel initChooseTemplatePane() { private JPanel initChooseTemplatePane() {
UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":"); UILabel templateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Export_JS_Template") + ":");
templateRadioGroup = new ExportRadioGroup(); templateRadioGroup = new ExportRadioGroup();
@ -780,30 +827,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
otherTemplatePane.reset(); otherTemplatePane.reset();
} }
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1); this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1);
if (ob.isCurrentTemplate()) { currentTemplatePane.populateSingleJavaScript(ob.getCurrentTemplateJavaScript());
SingleJavaScript js = ob.getJavaScript();
exportTypeComboBox.setSelectedItem(js.getExportType()); OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);
currentTemplatePane.fileNameRadioGroup.selectIndexButton(js.isDefaultFileName() ? 0 : 1); pane.editorPane.populate(ob.getJsListForOtherTemplates().toArray(new SingleJavaScript[ob.getJsListForOtherTemplates().size()]));
if (!js.isDefaultFileName()) {
currentTemplatePane.fileNameFormulaEditor.setEnabled(true);
currentTemplatePane.fileNameFormulaEditor.setVisible(true);
currentTemplatePane.fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(js.getFileName()));
}
if (js.isExtendParameters()) {
currentTemplatePane.extendParametersCheckBox.setSelected(true);
} else {
currentTemplatePane.extendParametersCheckBox.setSelected(false);
if (this.parameterViewPane != null) {
List<ParameterProvider> parameterList = this.parameterViewPane.update();
parameterList.clear();
ParameterProvider[] parameters = js.getParameters();
this.parameterViewPane.populate(parameters);
}
}
} else {
OtherTemplatePane pane = (OtherTemplatePane) this.templatePanel.getComponent(1);
pane.editorPane.populate(ob.getJsList().toArray(new SingleJavaScript[ob.getJsList().size()]));
}
} }
@Override @Override
@ -817,33 +844,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public void updateBean(ExportJavaScript exportJavaScript) { public void updateBean(ExportJavaScript exportJavaScript) {
boolean selected = currentTemplateRadio.isSelected(); boolean selected = currentTemplateRadio.isSelected();
exportJavaScript.setCurrentTemplate(selected); exportJavaScript.setCurrentTemplate(selected);
if (selected) { SingleJavaScript js = new SingleJavaScript();
SingleJavaScript js = new SingleJavaScript(); js.setCurrentTemplate(selected);
js.setCurrentTemplate(true); currentTemplatePane.updateSingleJavaScript(js);
js.setTemplatePath(DEFAULT); exportJavaScript.addCurrentTemplateJS(js);
js.setExportType(GeneralUtils.objectToString(exportTypeComboBox.getSelectedItem()));
js.setDefaultFileName(currentTemplatePane.defaultNameRadio.isSelected()); otherTemplatePane.updateExportJavaScript(exportJavaScript);
js.setFileName(getFileName());
js.setExtendParameters(currentTemplatePane.extendParametersCheckBox.isSelected());
if (currentTemplatePane.extendParametersCheckBox.isSelected()) {
exportJavaScript.setParameters(null);
} else {
if (parameterViewPane != null) {
List<ParameterProvider> parameterList = parameterViewPane.update();
if (!parameterList.isEmpty()) {
Parameter[] parameters = new Parameter[parameterList.size()];
parameterList.toArray(parameters);
js.setParameters(parameters);
}
}
}
exportJavaScript.addJS(js);
} else {
List<SingleJavaScript> javaScripts = otherTemplatePane.editorPane.update();
for (SingleJavaScript js : javaScripts) {
exportJavaScript.addJS(js);
}
}
} }
private String getFileName() { private String getFileName() {

78
designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java

@ -17,6 +17,7 @@ import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
@ -38,6 +39,17 @@ public class NorthRegionContainerPane extends JPanel {
private JMenuBar menuBar; private JMenuBar menuBar;
private PluginFilter pluginFilter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
};
private volatile boolean existDesignExtraPlugin;
public static NorthRegionContainerPane getInstance() { public static NorthRegionContainerPane getInstance() {
if (THIS == null) { if (THIS == null) {
synchronized (NorthRegionContainerPane.class) { synchronized (NorthRegionContainerPane.class) {
@ -66,34 +78,64 @@ public class NorthRegionContainerPane extends JPanel {
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮 //顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
initPluginListener(northEastPane, ad);
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
}
private void initPluginListener(JPanel northEastPane, ToolBarMenuDock ad) {
//优先级为-1,保证最后全面刷新一次 //优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { PluginEventListener pluginOnRunOrStopListener = new PluginEventListener(-1) {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshAll(northEastPane, ad);
refreshNorthEastPane(northEastPane, ad);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
}
});
} }
}, new PluginFilter() { };
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
PluginEventListener afterAllPluginsActiveListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(pluginOnRunOrStopListener, pluginFilter);
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
boolean needRefresh = DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isVisible() && existDesignExtraPlugin;
if (needRefresh) {
refreshAll(northEastPane, ad);
}
}
};
PluginEventListener beforeAllPluginStopListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
GeneralContext.stopListenPlugin(pluginOnRunOrStopListener);
}
};
PluginEventListener pluginEventListener = new PluginEventListener() {
@Override @Override
public boolean accept(PluginContext context) { public void on(PluginEvent event) {
existDesignExtraPlugin = true;
}
};
GeneralContext.listenPluginRunningChanged(pluginEventListener, pluginFilter);
GeneralContext.listenPlugin(PluginEventType.AfterAllActive, afterAllPluginsActiveListener);
GeneralContext.listenPlugin(PluginEventType.BeforeAllStop, beforeAllPluginStopListener);
return context.contain(PluginModule.ExtraDesign); }
private void refreshAll(JPanel northEastPane, ToolBarMenuDock ad) {
refreshNorthEastPane(northEastPane, ad);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (DesignerContext.getDesignerFrame() == null) {
return;
}
DesignerContext.getDesignerFrame().refresh();
DesignerContext.getDesignerFrame().repaint();
} }
}); });
refreshNorthEastPane(northEastPane, ad);
return northEastPane;
} }
private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) { private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) {

16
designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java

@ -10,6 +10,8 @@ import com.fr.stable.StringUtils;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
public class Guide { public class Guide {
private String id; private String id;
@ -101,7 +103,7 @@ public class Guide {
} }
GuideManager.getInstance().setCurrentGuide(this); GuideManager.getInstance().setCurrentGuide(this);
guideView.showLoading(); guideView.showLoading();
guideView.addHierarchyListener(loadingHierarchyListener);
new SwingWorker<Boolean, Void>() { new SwingWorker<Boolean, Void>() {
@Override @Override
protected Boolean doInBackground() { protected Boolean doInBackground() {
@ -135,6 +137,9 @@ public class Guide {
public void start() { public void start() {
guideView.hideLoading(); guideView.hideLoading();
}
private void startScene() {
if (scene != null) { if (scene != null) {
guideView.setScene(scene); guideView.setScene(scene);
guideView.showGuide(); guideView.showGuide();
@ -161,6 +166,7 @@ public class Guide {
if (lifecycle != null) { if (lifecycle != null) {
lifecycle.onTerminate(); lifecycle.onTerminate();
} }
guideView.removeHierarchyListener(loadingHierarchyListener);
end(); end();
} }
@ -186,4 +192,12 @@ public class Guide {
public void removeGuideLifecycle() { public void removeGuideLifecycle() {
this.lifecycle = null; this.lifecycle = null;
} }
private HierarchyListener loadingHierarchyListener = new HierarchyListener() {
@Override
public void hierarchyChanged(HierarchyEvent e) {
guideView.removeHierarchyListener(loadingHierarchyListener);
startScene();
}
};
} }

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

@ -85,7 +85,12 @@ public class GuideView extends JDialog {
updateGuideViewLocation(); updateGuideViewLocation();
this.setVisible(true); this.setVisible(true);
if (scene != null) { if (scene != null) {
scene.start(); SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scene.start();
}
});
} else { } else {
GuideManager.getInstance().getCurrentGuide().complete(); GuideManager.getInstance().getCurrentGuide().complete();
} }

52
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -13,6 +13,7 @@ import javax.swing.BorderFactory;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.AWTException; import java.awt.AWTException;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
@ -75,13 +76,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (component instanceof JComponent) { if (component instanceof JComponent) {
JComponent jComponent = (JComponent) component; JComponent jComponent = (JComponent) component;
image = ScreenImage.createImage(jComponent); image = ScreenImage.createImage(jComponent);
highlightList.add(getTargetComponentWithImage(image, rectangle, !(component.getParent() instanceof JPopupMenu)));
} else if (component instanceof Window) { } else if (component instanceof Window) {
image = ScreenImage.createImage(component); image = ScreenImage.createImage(component);
highlightList.add(getTargetComponentWithImage(image, rectangle, false));
} else { } else {
image = captureImage(component); image = captureImage(component);
highlightList.add(getTargetComponentWithImage(image, rectangle,true));
} }
targetList.add(component); targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle));
return true; return true;
} catch (AWTException e) { } catch (AWTException e) {
e.printStackTrace(); e.printStackTrace();
@ -99,7 +103,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
try { try {
targetList.add(null); targetList.add(null);
BufferedImage image = captureImage(rectangle); BufferedImage image = captureImage(rectangle);
highlightList.add(getTargetComponentWithImage(image, rectangle)); highlightList.add(getTargetComponentWithImage(image, rectangle, true));
return true; return true;
} catch (AWTException e) { } catch (AWTException e) {
e.printStackTrace(); e.printStackTrace();
@ -133,7 +137,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
image = ScreenImage.createImage(component).getSubimage(origin.x, origin.y, origin.width, origin.height); image = ScreenImage.createImage(component).getSubimage(origin.x, origin.y, origin.width, origin.height);
} }
targetList.add(component); targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle)); highlightList.add(getTargetComponentWithImage(image, rectangle, true));
return true; return true;
} catch (AWTException e) { } catch (AWTException e) {
e.printStackTrace(); e.printStackTrace();
@ -170,24 +174,29 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return highlightList; return highlightList;
} }
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) { private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle, boolean showBorder) {
ImageIcon ic = new ImageIcon(image); ImageIcon ic = new ImageIcon(image);
UILabel label = new UILabel(ic){ UILabel label;
@Override if (showBorder) {
public Insets getInsets() { label = new UILabel(ic){
return DEFAULT_HIGHLIGHT_INSETS; @Override
} public Insets getInsets() {
}; return DEFAULT_HIGHLIGHT_INSETS;
}
label.setBorder(BorderFactory.createMatteBorder(DEFAULT_HIGHLIGHT_INSETS.top, DEFAULT_HIGHLIGHT_INSETS.left, DEFAULT_HIGHLIGHT_INSETS.bottom, DEFAULT_HIGHLIGHT_INSETS.right, Color.WHITE)); };
label.setBackground(Color.WHITE);
label.setOpaque(true);
label.setBounds(new Rectangle(
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
));
} else {
label = new UILabel(ic);
label.setBounds(rectangle);
}
label.setOpaque(true);
label.setBounds(new Rectangle(
rectangle.x - DEFAULT_HIGHLIGHT_INSETS.left,
rectangle.y - DEFAULT_HIGHLIGHT_INSETS.top,
rectangle.width + DEFAULT_HIGHLIGHT_INSETS.left + DEFAULT_HIGHLIGHT_INSETS.right,
rectangle.height + DEFAULT_HIGHLIGHT_INSETS.top + DEFAULT_HIGHLIGHT_INSETS.bottom
));
return label; return label;
} }
@ -398,8 +407,9 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
} }
public void clear() { public void clear() {
targetList = new ArrayList<>(); targetList.clear();
highlightList = new ArrayList<>(); highlightList.clear();
pointsList.clear();
this.nextButton = null; this.nextButton = null;
if (this.getComponentCount() > 0) { if (this.getComponentCount() > 0) {
this.removeAll(); this.removeAll();

21
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java

@ -7,6 +7,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.guide.utils.GuideUIUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -14,9 +15,7 @@ import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet; import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants; import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
@ -37,9 +36,9 @@ public class GuideCompleteDialog extends JDialog {
private static final int ICON_HEIGHT = 182; private static final int ICON_HEIGHT = 182;
private static final Color FONT_COLOR = new Color(51, 51, 52); private static final Color FONT_COLOR = new Color(51, 51, 52);
private static final Color BUTTON_BG_COLOR = new Color(65, 155,249); private static final Color BUTTON_BG_COLOR = new Color(65, 155,249);
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 22); private static final Font TITLE_FONT = new Font("Default", Font.BOLD, 22);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18); private static final Font CONTENT_FONT = new Font("Default", Font.PLAIN, 18);
private static final Font BUTTON_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 14); private static final Font BUTTON_FONT = new Font("Default", Font.BOLD, 14);
private static GuideCompleteDialog dialog; private static GuideCompleteDialog dialog;
public static GuideCompleteDialog getInstance() { public static GuideCompleteDialog getInstance() {
@ -78,12 +77,11 @@ public class GuideCompleteDialog extends JDialog {
title.setForeground(FONT_COLOR); title.setForeground(FONT_COLOR);
textArea = new UITextPane(); textArea = new UITextPane();
changeLineSpacing(textArea, 0.15f,false); textArea.setFont(CONTENT_FONT);
GuideUIUtils.setTextPaneLineHeight(textArea, 26);
textArea.setEnabled(false); textArea.setEnabled(false);
textArea.setOpaque(false); textArea.setOpaque(false);
textArea.setFont(CONTENT_FONT);
textArea.setPreferredSize(new Dimension(236, 52)); textArea.setPreferredSize(new Dimension(236, 52));
textArea.setBorder(null);
textArea.setDisabledTextColor(FONT_COLOR); textArea.setDisabledTextColor(FONT_COLOR);
StyledDocument doc = textArea.getStyledDocument(); StyledDocument doc = textArea.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet(); SimpleAttributeSet center = new SimpleAttributeSet();
@ -141,11 +139,4 @@ public class GuideCompleteDialog extends JDialog {
} }
} }
}; };
private void changeLineSpacing(JTextPane pane, float factor, boolean replace) {
pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
StyleConstants.setLineSpacing(set, factor);
pane.setParagraphAttributes(set, replace);
}
} }

2
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java

@ -40,7 +40,7 @@ public class GuideLoadingGlassPane extends JPanel {
imageContainer.add(GuideLoadingPane.getInstance()); imageContainer.add(GuideLoadingPane.getInstance());
UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait")); UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait"));
hintLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14)); hintLabel.setFont(new Font("Default", Font.PLAIN, 14));
hintLabel.setHorizontalAlignment(SwingConstants.CENTER); hintLabel.setHorizontalAlignment(SwingConstants.CENTER);
hintLabel.setForeground(Color.WHITE); hintLabel.setForeground(Color.WHITE);

25
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java

@ -4,12 +4,12 @@ package com.fr.design.mainframe.guide.ui.bubble;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.gui.frpane.UITextPane; import com.fr.design.gui.frpane.UITextPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.guide.utils.GuideUIUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JTextPane; import javax.swing.JTextPane;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet; import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants; import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
@ -32,8 +32,8 @@ import java.text.AttributedCharacterIterator;
import java.text.AttributedString; import java.text.AttributedString;
public class BubbleWithClose extends Bubble { public class BubbleWithClose extends Bubble {
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14); private static final Font TITLE_FONT = new Font("Default", Font.PLAIN, 14);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12); private static final Font CONTENT_FONT = new Font("Default", Font.PLAIN, 12);
private static final int TITLE_LINE_HEIGHT = 22; private static final int TITLE_LINE_HEIGHT = 22;
private static final int CONTENT_LINE_HEIGHT = 18; private static final int CONTENT_LINE_HEIGHT = 18;
@ -157,33 +157,18 @@ public class BubbleWithClose extends Bubble {
} }
private UITextPane createTextArea(String str, Font font, int lineHeight, Color foreground) { private UITextPane createTextArea(String str, Font font, int lineHeight, Color foreground) {
int lineSpace = lineHeight - font.getSize(); UITextPane textArea= new UITextPane();
UITextPane textArea= new UITextPane(){
@Override
public Insets getInsets() {
return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0);
}
};
textArea.setFont(font); textArea.setFont(font);
changeLineSpacing(textArea, lineHeight, true); GuideUIUtils.setTextPaneLineHeight(textArea, lineHeight);
textArea.setEditable(false); textArea.setEditable(false);
textArea.setForeground(foreground); textArea.setForeground(foreground);
textArea.setDisabledTextColor(foreground); textArea.setDisabledTextColor(foreground);
textArea.setBorder(null);
textArea.setOpaque(false); textArea.setOpaque(false);
textArea.setText(str); textArea.setText(str);
highlightText(textArea); highlightText(textArea);
return textArea; return textArea;
} }
private void changeLineSpacing(JTextPane pane, int lineHeight, boolean replace) {
pane.selectAll();
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
StyleConstants.setLineSpacing(set, (float)(lineHeight - fontMetrics.getHeight()) / fontMetrics.getHeight());
pane.setParagraphAttributes(set, replace);
}
private void highlightText(JTextPane textArea) { private void highlightText(JTextPane textArea) {
SimpleAttributeSet sas = new SimpleAttributeSet(); SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setForeground(sas, HIGHLIGHT_COLOR); StyleConstants.setForeground(sas, HIGHLIGHT_COLOR);

28
designer-base/src/main/java/com/fr/design/mainframe/guide/utils/GuideUIUtils.java

@ -0,0 +1,28 @@
package com.fr.design.mainframe.guide.utils;
import com.fr.base.GraphHelper;
import javax.swing.BorderFactory;
import javax.swing.JTextPane;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import java.awt.FontMetrics;
import java.awt.Insets;
public class GuideUIUtils {
public static void setTextPaneLineHeight(JTextPane pane, int lineHeight) {
pane.selectAll();
pane.setMargin(new Insets(0,0,0,0));
MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes());
FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont());
int delta = (lineHeight - fontMetrics.getHeight()) / 2 * 2 ;
if (delta > 0) {
StyleConstants.setLineSpacing(set, delta/ 2.0f / fontMetrics.getHeight());
pane.setParagraphAttributes(set, false);
int dis = fontMetrics.getDescent() - fontMetrics.getLeading();
int marginTop = dis > 0 ? ((delta - dis) / 2 + dis) : ((delta - dis) / 2);
pane.setBorder(BorderFactory.createEmptyBorder(marginTop, 0,0,0));
}
}
}

3
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -17,7 +17,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.theme.edit.CellStyleListEditPane; import com.fr.design.mainframe.theme.edit.CellStyleListEditPane;
import com.fr.design.mainframe.theme.edit.ChartStyleEditPane; import com.fr.design.mainframe.theme.edit.ChartStyleEditPane;
import com.fr.design.mainframe.theme.edit.ui.ColorListExtendedPane;
import com.fr.design.mainframe.theme.edit.ui.ColorListPane; import com.fr.design.mainframe.theme.edit.ui.ColorListPane;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils; import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.AutoCheckTextField; import com.fr.design.mainframe.theme.ui.AutoCheckTextField;
@ -163,8 +162,6 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
FineColorFlushUtils.replaceCacheObject(theme, replaceByColorScheme); FineColorFlushUtils.replaceCacheObject(theme, replaceByColorScheme);
FineColorManager.traverse(theme, replaceByColorScheme); FineColorManager.traverse(theme, replaceByColorScheme);
populateBean4CustomEditors(theme); populateBean4CustomEditors(theme);
//图表渐变色
chartStyleSettingPane.populateGradientBar(colors);
this.repaint(); this.repaint();
} }

42
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java

@ -43,6 +43,8 @@ import java.awt.Stroke;
import java.awt.Window; import java.awt.Window;
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 static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -63,27 +65,31 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
private final AsyncThemeFetcher<T> asyncThemeFetcher; private final AsyncThemeFetcher<T> asyncThemeFetcher;
public static TemplateThemeGridControlPane<FormTheme> createFormThemesManagerPane() { private final Window window;
public static TemplateThemeGridControlPane<FormTheme> createFormThemesManagerPane(Window window) {
FormThemeConfig config = FormThemeConfig.getInstance(); FormThemeConfig config = FormThemeConfig.getInstance();
FormThemeProfilePane editPane = new FormThemeProfilePane(config); FormThemeProfilePane editPane = new FormThemeProfilePane(config);
return new TemplateThemeGridControlPane<>(config, editPane); return new TemplateThemeGridControlPane<>(window, config, editPane);
} }
public static TemplateThemeGridControlPane<ReportTheme> createReportThemesManagerPane() { public static TemplateThemeGridControlPane<ReportTheme> createReportThemesManagerPane(Window window) {
ReportThemeConfig config = ReportThemeConfig.getInstance(); ReportThemeConfig config = ReportThemeConfig.getInstance();
ReportThemeProfilePane editPane = new ReportThemeProfilePane(config); ReportThemeProfilePane editPane = new ReportThemeProfilePane(config);
return new TemplateThemeGridControlPane<>(config, editPane); return new TemplateThemeGridControlPane<>(window, config, editPane);
} }
public TemplateThemeGridControlPane(TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeGridControlPane(Window window, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.window = window;
this.config = config; this.config = config;
this.profilePane = profilePane; this.profilePane = profilePane;
this.themeListPane = new TemplateThemeGridPane<>(true, config, profilePane); this.themeListPane = new TemplateThemeGridPane<>(window, true, config, profilePane);
this.removeAction = new RemoveThemeAction(false); this.removeAction = new RemoveThemeAction(false);
this.setTheme4NewTemplateButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Default_Setting")); this.setTheme4NewTemplateButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Pane_Default_Setting"));
this.asyncThemeFetcher = new AsyncThemeFetcher<>(1, config); this.asyncThemeFetcher = new AsyncThemeFetcher<>(1, config);
initializePane(); initializePane();
registerWindowListener();
} }
public TemplateThemeConfig<T> getConfig() { public TemplateThemeConfig<T> getConfig() {
@ -117,6 +123,16 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
repaint(); repaint();
} }
private void registerWindowListener() {
window.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
super.windowClosed(e);
asyncThemeFetcher.shutdown();
}
});
}
private void resetEnableRemoveAction(T selectedTheme, RemoveThemeAction removeAction) { private void resetEnableRemoveAction(T selectedTheme, RemoveThemeAction removeAction) {
if (selectedTheme == null) { if (selectedTheme == null) {
removeAction.setEnabled(false); removeAction.setEnabled(false);
@ -254,7 +270,6 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
setName(name); setName(name);
setMnemonic('R'); setMnemonic('R');
this.prototypeThemeName = prototypeThemeName; this.prototypeThemeName = prototypeThemeName;
asyncThemeFetcher.submit(prototypeThemeName, null);
} }
@Override @Override
@ -308,17 +323,4 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} }
} }
public void startListenThemeConfig() {
themeListPane.startListenThemeConfig();
}
public void stopListenThemeConfig() {
themeListPane.stopListenThemeConfig();
}
public void stopAsyncFetchTheme() {
asyncThemeFetcher.shutdown();
themeListPane.stopAsyncFetchTheme();
}
} }

48
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java

@ -38,6 +38,7 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.Stroke; import java.awt.Stroke;
import java.awt.Window;
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;
@ -61,11 +62,11 @@ public class TemplateThemeGridPagesPane extends JPanel {
private PageChangeListener pageChangeListener; private PageChangeListener pageChangeListener;
private TemplateThemeGridPagePane currentTemplateThemeGridPagePane; private TemplateThemeGridPagePane currentTemplateThemeGridPagePane;
public TemplateThemeGridPagesPane() { public TemplateThemeGridPagesPane(Window window) {
initializePane(); initializePane(window);
} }
private void initializePane() { private void initializePane(Window window) {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
@ -82,9 +83,9 @@ public class TemplateThemeGridPagesPane extends JPanel {
add(contentPane, BorderLayout.CENTER); add(contentPane, BorderLayout.CENTER);
themeUsingPane = new TemplateThemeUsingPane(); themeUsingPane = new TemplateThemeUsingPane(window);
contentPane.add(themeUsingPane, themeUsingPane.getTitle()); contentPane.add(themeUsingPane, themeUsingPane.getTitle());
themeManagingPane = new TemplateThemeManagingPane(); themeManagingPane = new TemplateThemeManagingPane(window);
contentPane.add(themeManagingPane, themeManagingPane.getTitle()); contentPane.add(themeManagingPane, themeManagingPane.getTitle());
showThemeUsingPane(); showThemeUsingPane();
@ -189,11 +190,6 @@ public class TemplateThemeGridPagesPane extends JPanel {
return button; return button;
} }
public void exit() {
themeUsingPane.exit();
themeManagingPane.exit();
}
public void setPageChangeListener(PageChangeListener changeListener) { public void setPageChangeListener(PageChangeListener changeListener) {
this.pageChangeListener = changeListener; this.pageChangeListener = changeListener;
} }
@ -232,15 +228,13 @@ public class TemplateThemeGridPagesPane extends JPanel {
public abstract static class TemplateThemeGridPagePane extends BasicPane { public abstract static class TemplateThemeGridPagePane extends BasicPane {
public abstract TemplateThemeConfig<? extends TemplateTheme> getConfig(); public abstract TemplateThemeConfig<? extends TemplateTheme> getConfig();
public void exit() { }
} }
public static class TemplateThemeUsingPane extends TemplateThemeGridPagePane { public static class TemplateThemeUsingPane extends TemplateThemeGridPagePane {
private final JTemplate<?,?> template; private final JTemplate<?,?> template;
public final TemplateThemeGridPane<? extends TemplateTheme> themeListPane; public final TemplateThemeGridPane<? extends TemplateTheme> themeListPane;
public TemplateThemeUsingPane() { public TemplateThemeUsingPane(Window window) {
super(); super();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
setBorder(new CompoundBorder( setBorder(new CompoundBorder(
@ -249,9 +243,7 @@ public class TemplateThemeGridPagesPane extends JPanel {
template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateThemeConfig<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig(); TemplateThemeConfig<? extends TemplateTheme> config = template.getUsingTemplateThemeConfig();
themeListPane = new TemplateThemeGridPane<>(false, config, null); themeListPane = new TemplateThemeGridPane<>(window, false, config, null);
themeListPane.startListenThemeConfig();
themeListPane.setSelectedChangeListener(new ChangeListener() { themeListPane.setSelectedChangeListener(new ChangeListener() {
@Override @Override
@ -272,12 +264,6 @@ public class TemplateThemeGridPagesPane extends JPanel {
return template.getUsingTemplateThemeConfig(); return template.getUsingTemplateThemeConfig();
} }
@Override
public void exit() {
themeListPane.stopListenThemeConfig();
themeListPane.stopAsyncFetchTheme();
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title"); return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Title");
@ -286,20 +272,16 @@ public class TemplateThemeGridPagesPane extends JPanel {
public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane { public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane {
private final UITabbedPane tabbedPane; private final UITabbedPane tabbedPane;
private final TemplateThemeGridControlPane<FormTheme> formThemesManagerPane;
private final TemplateThemeGridControlPane<ReportTheme> reportThemesManagerPane;
public TemplateThemeManagingPane() { public TemplateThemeManagingPane(Window window) {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
tabbedPane = new UITabbedPane(); tabbedPane = new UITabbedPane();
tabbedPane.setTabBorderColor(new Color(0xE0E0E1)); tabbedPane.setTabBorderColor(new Color(0xE0E0E1));
add(tabbedPane, BorderLayout.CENTER); add(tabbedPane, BorderLayout.CENTER);
formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane(); TemplateThemeGridControlPane<FormTheme> formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane(window);
formThemesManagerPane.startListenThemeConfig(); TemplateThemeGridControlPane<ReportTheme> reportThemesManagerPane = TemplateThemeGridControlPane.createReportThemesManagerPane(window);
reportThemesManagerPane = TemplateThemeGridControlPane.createReportThemesManagerPane();
reportThemesManagerPane.startListenThemeConfig();
tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Form_Tab"), formThemesManagerPane); tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Form_Tab"), formThemesManagerPane);
tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Report_Tab"), reportThemesManagerPane); tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Report_Tab"), reportThemesManagerPane);
@ -321,14 +303,6 @@ public class TemplateThemeGridPagesPane extends JPanel {
} }
} }
@Override
public void exit() {
formThemesManagerPane.stopListenThemeConfig();
formThemesManagerPane.stopAsyncFetchTheme();
reportThemesManagerPane.stopListenThemeConfig();
reportThemesManagerPane.stopAsyncFetchTheme();
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"); return Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title");

60
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java

@ -8,8 +8,6 @@ import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener; import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -18,8 +16,11 @@ import javax.swing.ScrollPaneConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Window;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -53,13 +54,17 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
private ChangeListener changeListener; private ChangeListener changeListener;
public TemplateThemeGridPane(boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) { private final Window window;
public TemplateThemeGridPane(Window window, boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.window = window;
this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker; this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker;
this.config = config; this.config = config;
this.profilePane = profilePane; this.profilePane = profilePane;
this.contentListPane = new JPanel(); this.contentListPane = new JPanel();
this.asyncThemeFetcher = new AsyncThemeFetcher<>(ASYNC_FETCH_THEME_THREAD_COUNT, config); this.asyncThemeFetcher = new AsyncThemeFetcher<>(ASYNC_FETCH_THEME_THREAD_COUNT, config);
initializePane(); initializePane();
registerWindowListener();
} }
private void initializePane() { private void initializePane() {
@ -84,6 +89,24 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
} }
private void registerWindowListener() {
window.addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
super.windowOpened(e);
startListenThemeConfig();
asyncFetchThemes();
}
@Override
public void windowClosed(WindowEvent e) {
super.windowClosed(e);
stopListenThemeConfig();
asyncThemeFetcher.shutdown();
}
});
}
public void fillContentListPane() { public void fillContentListPane() {
contentListPane.removeAll(); contentListPane.removeAll();
List<String> names = config.getThemeNames(); List<String> names = config.getThemeNames();
@ -97,6 +120,7 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
} }
} }
} }
private TemplateThemeBlock<T> createCachedTemplateThemeBlock(String name) { private TemplateThemeBlock<T> createCachedTemplateThemeBlock(String name) {
TemplateThemeBlock<T> block = blockCache.get(name); TemplateThemeBlock<T> block = blockCache.get(name);
if (block == null) { if (block == null) {
@ -115,19 +139,6 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
setSelectedBlock(block); setSelectedBlock(block);
} }
}); });
asyncThemeFetcher.submit(name, new AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter<T>() {
@Override
public void beforeCachedFetch() {
super.beforeCachedFetch();
block.setTheme(null);
}
@Override
public void afterCachedFetch(T theme) {
super.afterCachedFetch(theme);
block.setTheme(theme);
}
});
return block; return block;
} }
@ -154,6 +165,15 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
asyncThemeFetcher.submit(themeName, new AsyncThemeListItemFetchCallback(themeName)); asyncThemeFetcher.submit(themeName, new AsyncThemeListItemFetchCallback(themeName));
} }
private void asyncFetchThemes() {
List<String> names = config.getThemeNames();
for (String name: names) {
if (config.contains(name)) {
asyncThemeFetcher.submit(name, new AsyncThemeListItemFetchCallback(name));
}
}
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return null; return null;
@ -163,7 +183,7 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
return selectedBlock != null ? selectedBlock.getTheme() : null; return selectedBlock != null ? selectedBlock.getTheme() : null;
} }
public void startListenThemeConfig() { private void startListenThemeConfig() {
if (themeConfigChangeListener == null) { if (themeConfigChangeListener == null) {
themeConfigChangeListener = new TemplateThemeConfig.ThemeConfigChangeListener() { themeConfigChangeListener = new TemplateThemeConfig.ThemeConfigChangeListener() {
@Override @Override
@ -219,17 +239,13 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
} }
} }
public void stopListenThemeConfig() { private void stopListenThemeConfig() {
if (themeConfigChangeListener != null) { if (themeConfigChangeListener != null) {
config.removeThemeConfigChangeListener(themeConfigChangeListener); config.removeThemeConfigChangeListener(themeConfigChangeListener);
themeConfigChangeListener = null; themeConfigChangeListener = null;
} }
} }
public void stopAsyncFetchTheme() {
asyncThemeFetcher.shutdown();
}
private class AsyncThemeListItemFetchCallback extends AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter<T> { private class AsyncThemeListItemFetchCallback extends AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter<T> {
private final String themeName; private final String themeName;
public AsyncThemeListItemFetchCallback(String themeName) { public AsyncThemeListItemFetchCallback(String themeName) {

8
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java

@ -28,7 +28,7 @@ public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
overallPane = new TemplateThemeGridPagesPane(); overallPane = new TemplateThemeGridPagesPane(this);
overallPane.setPageChangeListener(this); overallPane.setPageChangeListener(this);
return overallPane; return overallPane;
} }
@ -43,12 +43,6 @@ public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements
return overallPane.createRightButtons(); return overallPane.createRightButtons();
} }
@Override
public void exit() {
overallPane.exit();
super.exit();
}
@Override @Override
public void onPageChangeListener() { public void onPageChangeListener() {
setupActionButtons(); setupActionButtons();

5
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ChartStyleEditPane.java

@ -13,7 +13,6 @@ import com.fr.design.mainframe.theme.edit.chart.ChartTitleAndBackgroundStylePane
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.Color;
/** /**
* @author Bjorn * @author Bjorn
@ -88,10 +87,6 @@ public class ChartStyleEditPane extends MultiTabPane<ThemedChartStyle> {
return chartStyle; return chartStyle;
} }
public void populateGradientBar(List<Color> colors) {
chartSeriesStylePane.populateGradientBar(colors);
}
@Override @Override
public boolean accept(Object ob) { public boolean accept(Object ob) {
return false; return false;

6
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartSeriesStylePane.java

@ -74,12 +74,6 @@ public class ChartSeriesStylePane extends AbstractChartStylePane {
checkTypeButton(); checkTypeButton();
} }
public void populateGradientBar(List<Color> colors) {
gradientBar.updateColor(colors.get(0), colors.get(1));
this.repaint();
}
public void update(ThemedChartStyle chartStyle) { public void update(ThemedChartStyle chartStyle) {
chartStyle.getThemedChartSeriesColor().setCombineColor(colorTypeButton.getSelectedIndex() == 0); chartStyle.getThemedChartSeriesColor().setCombineColor(colorTypeButton.getSelectedIndex() == 0);
chartStyle.getThemedChartSeriesColor().setBeginColor(gradientBar.getSelectColorPointBtnP1().getColorInner()); chartStyle.getThemedChartSeriesColor().setBeginColor(gradientBar.getSelectColorPointBtnP1().getColorInner());

2
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -68,7 +68,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Row_Name")}, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Data"), Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Row_Name")},
new Point2D[]{new Point(159, 71), new Point(225, 49)}); new Point2D[]{new Point(159, 71), new Point(225, 49)});
cornerCell.setPreferredSize(new Dimension(225, 71)); cornerCell.setPreferredSize(new Dimension(225, 71));
headerCellList.add(cornerCell); titleCellList.add(cornerCell);
northPane.add(cornerCell, BorderLayout.WEST); northPane.add(cornerCell, BorderLayout.WEST);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
northPane.add(centerPane, BorderLayout.CENTER); northPane.add(centerPane, BorderLayout.CENTER);

2
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -169,7 +169,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
Color.decode("#CCCCCC"), Color.decode("#CCCCCC"),
// 2列灰度色 // 2列灰度色
Color.decode("#333333"), Color.decode("#000000"),
Color.decode("#FFFFFF"), Color.decode("#FFFFFF"),
}; };

2
designer-base/src/main/java/com/fr/design/upm/UpmUtils.java

@ -37,7 +37,7 @@ public class UpmUtils {
} }
private static String fetchLatestVersion() { private static String fetchLatestVersion() {
String version = CloudCenter.getInstance().acquireUrlByKind("upm.script.version"); String version = CloudCenter.getInstance().acquireUrlByKind("upm.script.version.v11");
if (StringUtils.isBlank(version)) { if (StringUtils.isBlank(version)) {
version = "1.0"; version = "1.0";
} }

2
designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java

@ -34,7 +34,7 @@ public class UpmUtilsTest {
EasyMock.expect(ServerPreferenceConfig.getInstance()).andReturn(serverPreferenceConfig).anyTimes(); EasyMock.expect(ServerPreferenceConfig.getInstance()).andReturn(serverPreferenceConfig).anyTimes();
CloudCenter cloudCenter = EasyMock.mock(CloudCenter.class); CloudCenter cloudCenter = EasyMock.mock(CloudCenter.class);
EasyMock.expect(cloudCenter.acquireUrlByKind("upm.script.version")).andReturn("2.0").anyTimes(); EasyMock.expect(cloudCenter.acquireUrlByKind("upm.script.version.v11")).andReturn("2.0").anyTimes();
PowerMock.mockStatic(CloudCenter.class); PowerMock.mockStatic(CloudCenter.class);
EasyMock.expect(CloudCenter.getInstance()).andReturn(cloudCenter).anyTimes(); EasyMock.expect(CloudCenter.getInstance()).andReturn(cloudCenter).anyTimes();

9
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.designer.creator; package com.fr.design.designer.creator;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.theme.FineColorFlushUtils; import com.fr.base.theme.FineColorFlushUtils;
import com.fr.base.theme.FineColorGather; import com.fr.base.theme.FineColorGather;
import com.fr.base.theme.FineColorManager; import com.fr.base.theme.FineColorManager;
@ -86,6 +87,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.List;
/** /**
* XCreator的相关处理 * XCreator的相关处理
@ -384,7 +386,12 @@ public class XCreatorUtils {
public static void setupTemplateTheme(XCreator container, final boolean forceFollowingTheme, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) { public static void setupTemplateTheme(XCreator container, final boolean forceFollowingTheme, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) {
FineColorGather colorGather = new FineColorManager.FineColorReplaceByTheme(currentTemplateUsingTheme, compatible); FineColorGather colorGather = new FineColorManager.FineColorReplaceByTheme(currentTemplateUsingTheme, compatible);
Form.traversalWidget(container.toData(), new WidgetGather() { Widget root = container.toData();
List<BaseChartCollection> chartCollections = root.getChartCollections();
for (BaseChartCollection chartCollection: chartCollections) {
chartCollection.onTemplateUsingThemeChange(currentTemplateUsingTheme, compatible);
}
Form.traversalWidget(root, new WidgetGather() {
@Override @Override
public void dealWith(Widget widget) { public void dealWith(Widget widget) {
TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget; TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget;

3
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -96,11 +96,13 @@ public class FormCreatorDropTarget extends DropTarget {
boolean formSubmit2Adapt = !addingModel.getXCreator().canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class); boolean formSubmit2Adapt = !addingModel.getXCreator().canEnterIntoAdaptPane() && container.acceptType(XWFitLayout.class);
if (model != null && !chartEnter2Para && !formSubmit2Adapt) { if (model != null && !chartEnter2Para && !formSubmit2Adapt) {
tabDragInner.tryDragIn();
success = model.add2Container(designer, container, x, y); success = model.add2Container(designer, container, x, y);
} }
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }
if (success) { if (success) {
tabDragInner.reset();
// 如果添加成功,则触发相应事件 // 如果添加成功,则触发相应事件
XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent(); XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent();
//SetSelection时要确保选中的是最顶层的布局 //SetSelection时要确保选中的是最顶层的布局
@ -143,7 +145,6 @@ public class FormCreatorDropTarget extends DropTarget {
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget}));
designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED);
tabDragInner.tryDragIn();
} else { } else {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();
// 拖入失败 取消选中 // 拖入失败 取消选中

17
designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
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;
@ -64,16 +62,13 @@ public class TabDragInner {
*/ */
public void tryDragIn() { public void tryDragIn() {
if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) { if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) {
EditingMouseListener editingMouseListener = new EditingMouseListener(designer);
editingMouseListener.refreshTopXCreator();
belowXLayoutContainer.setEditable(true); belowXLayoutContainer.setEditable(true);
if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) { }
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); }
if (adapter != null) {
editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); public void reset() {
belowXLayoutContainer.setDragInAble(false); if (belowXLayoutContainer != null) {
} belowXLayoutContainer.setDragInAble(false);
}
} }
} }

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

@ -39,12 +39,14 @@ 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 static com.fr.form.share.constants.ShareComponentConstants.REU_INFO_PATH;
/** /**
* created by Harrison on 2020/05/27 * created by Harrison on 2020/05/27
**/ **/
public class DownloadUtils { public class DownloadUtils {
private static final String REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "file/download"; private static final String REUSES_URL = StableUtils.pathJoin(ShareComponentConstants.REU_INFO_PATH, "file/download");
private static final String PACKAGE_REUSES_URL = CloudCenter.getInstance().acquireUrlByKind("af.reuseInfo") + "package/download/"; private static final String PACKAGE_REUSES_URL = StableUtils.pathJoin(ShareComponentConstants.REU_INFO_PATH, "package/download/");
private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" + private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" +
"1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" + "1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" +
"tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" + "tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" +

4
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java

@ -87,9 +87,11 @@ public class ChangeLayoutComponentGuide {
@Override @Override
public boolean prepared() { public boolean prepared() {
switchButton.getComponentPopupMenu().setVisible(true); switchButton.getComponentPopupMenu().setVisible(true);
Rectangle popupBounds = GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight());
switchButton.getComponentPopupMenu().show(scene.getContainer(), popupBounds.x, popupBounds.y);
scene.addCustomTarget( scene.addCustomTarget(
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()), GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight()) popupBounds
); );
scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true); scene.addClickTarget(switchButton.getComponentPopupMenu().getComponent(1), ClickScene.ClickType.LEFT, true);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f); scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);

12
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -47,9 +47,9 @@ import java.util.TimerTask;
public class UseLayoutAndComponentGuide { public class UseLayoutAndComponentGuide {
private static final String[] PRE_INSTALL_COMPONENTS = { private static final String[] PRE_INSTALL_COMPONENTS = {
"大屏标题-酷炫蓝.25fcd194-d4db-406f-8a08-210f3c262870.reu", "新功能引导-标题.309634e8-2946-43a7-aea5-1d3fb68c8823.reu",
"散点闪烁地图-酷炫蓝.5e17c2eb-5b18-4b6c-854a-5ffff7f6337a.reu", "新功能引导-左侧组件.76797e8e-1e56-480a-b07c-3acb05b604ca.reu",
"排名明细表.b4dab4f2-7b1a-4540-a2d4-65c3e080334e.reu" "新功能引导-右侧组件.35fbbb73-da84-479d-b387-1da7b05b23e8.reu"
}; };
private static final String RESOURCE_PATH = "/com/fr/report/guide/component"; private static final String RESOURCE_PATH = "/com/fr/report/guide/component";
private static UIHeadMenu fileHeadMenu; private static UIHeadMenu fileHeadMenu;
@ -62,9 +62,9 @@ public class UseLayoutAndComponentGuide {
.nextScene(createScene3()) .nextScene(createScene3())
.nextScene(createScene4()) .nextScene(createScene4())
.nextScene(createScene5()) .nextScene(createScene5())
.nextScene(createScene6("box0","25fcd194-d4db-406f-8a08-210f3c262870")) .nextScene(createScene6("box0","309634e8-2946-43a7-aea5-1d3fb68c8823"))
.nextScene(createScene6("box1","5e17c2eb-5b18-4b6c-854a-5ffff7f6337a")) .nextScene(createScene6("box1","76797e8e-1e56-480a-b07c-3acb05b604ca"))
.nextScene(createScene6("box2","b4dab4f2-7b1a-4540-a2d4-65c3e080334e")) .nextScene(createScene6("box2","35fbbb73-da84-479d-b387-1da7b05b23e8"))
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createPreviewClickScene()); .nextScene(GuideSceneHelper.createPreviewClickScene());

Loading…
Cancel
Save