Browse Source

Merge branch 'feature/x' of ssh://code.fineres.com:7999/~fanglei/design10.0 into feature/x

* 'feature/x' of ssh://code.fineres.com:7999/~fanglei/design10.0: (92 commits)
  REPORT-60538 英日韩环境未屏蔽在线组件库
  REPORT-61276 决策报表-最新的release包,打开决策报表会打开一个空cpt;新建frm正常
  REPORT-61205 标准色视觉修改
  REPORT-61275 部分任务默认工具栏展开
  REPORT-61267 【FR11】【组件背景分离】组件复用-组件标题图案的“图案相对位置”切换不生效了,只有在重新上传图案的时候才生效;“位置”也不生效
  REPORT-61249 视觉图变动
  无JIRA任务 换一下svg图片,原来的svg图片有点变形
  REPORT-61237【固定布局-原布局推荐4.1】决策报表-自适应布局-新建空白模板,切换到固定布局,此时无法往设计画布里拖入组件
  REPORT-61055 【主题获取】主题导出插件几个小问题
  REPORT-60991 导出参数设置面板添加无响应
  REPORT-52578 10.0兼容新自适应插件的同步代码在11.0中需要改成异步的
  REPORT-61105 & REPORT-61096 & REPORT-61012 控件联动及兼容老模板调整
  REPORT-61177 解决引导页弹窗展示变成半透明的问题
  REPORT-61207 行间距减小,放在window上文字截断
  REPORT-61219 【主题获取】右键有主题的组件,鼠标从获取主题滑到详细说明,两个都被选中了
  REPORT-60942 加载图视觉更新
  REPORT-60661 国际化url适配
  REPORT-60661 国际化url适配
  REPORT-60661 国际化url适配
  REPORT-61125 交互优化更新
  ...

# Conflicts:
#	designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
feature/x
方磊 3 years ago
parent
commit
90f2d40f8b
  1. 14
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 3
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  4. 1
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  5. 11
      designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java
  6. 46
      designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java
  7. 38
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  8. 27
      designer-base/src/main/java/com/fr/design/data/NameChangeBean.java
  9. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  10. 6
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  11. 25
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  12. 4
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  13. 17
      designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java
  14. 11
      designer-base/src/main/java/com/fr/design/formula/FormulaCheckerException.java
  15. 60
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  16. 11
      designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java
  17. 11
      designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java
  18. 22
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java
  19. 22
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java
  20. 12
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  21. 47
      designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java
  22. 50
      designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java
  23. 12
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java
  24. 21
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  25. 46
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  26. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabGroup.java
  27. 6
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  28. 9
      designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java
  29. 3
      designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java
  30. 119
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java
  31. 4
      designer-base/src/main/java/com/fr/design/locale/impl/ShowOnlineWidgetMark.java
  32. 5
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java
  33. 7
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  34. 31
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  35. 55
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java
  36. 8
      designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
  37. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java
  38. 4
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java
  39. 23
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  40. 19
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java
  41. 98
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java
  42. 10
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
  43. 28
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java
  44. 138
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java
  45. 5
      designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java
  46. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  47. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridControlPane.java
  48. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPagesPane.java
  49. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeGridPane.java
  50. 31
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  51. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeGridPagesDialog.java
  52. 57
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  53. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  54. 4
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java
  55. 5
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java
  56. 7
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  57. 46
      designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java
  58. 26
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  59. 20
      designer-base/src/main/java/com/fr/design/style/color/ColorFactory.java
  60. 3
      designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java
  61. 2
      designer-base/src/main/java/com/fr/env/ErrorDialog.java
  62. 7
      designer-base/src/main/java/com/fr/env/HelpLink.java
  63. 3
      designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java
  64. 5
      designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties
  65. 5
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties
  66. 5
      designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties
  67. 5
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  68. 5
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  69. BIN
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png
  70. 13
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg
  71. BIN
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png
  72. 13
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg
  73. BIN
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png
  74. 23
      designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg
  75. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  76. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  77. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  78. 77
      designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java
  79. 8
      designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java
  80. 18
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java
  81. 21
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  82. 3
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java
  83. 41
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
  84. 4
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
  85. 4
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
  86. 33
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  87. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  88. 33
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  89. 7
      designer-form/src/main/java/com/fr/design/fit/NewJForm.java
  90. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  91. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java
  92. 2
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  93. 27
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  94. 34
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java
  95. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java
  96. 54
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java
  97. 75
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java
  98. 7
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java
  99. 28
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/LocalWidgetBlock.java
  100. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  101. Some files were not shown because too many files have changed in this diff Show More

14
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -91,6 +91,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final String VERSION100 = "100";
private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps";
public static final int LAYOUT_TEMPLATE_SIMPLE_STYLE = 0;
public static final int LAYOUT_TEMPLATE_REAL_STYLE = 1;
/**
* 指定默认工作空间
*/
@ -205,6 +207,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showTemplateMissingPlugin = true;
private int layoutTemplateStyle = LAYOUT_TEMPLATE_SIMPLE_STYLE;
/**
* DesignerEnvManager.
*/
@ -1691,6 +1695,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.openDebug = openDebug;
}
public int getLayoutTemplateStyle() {
return layoutTemplateStyle;
}
public void setLayoutTemplateStyle(int layoutTemplateStyle) {
this.layoutTemplateStyle = layoutTemplateStyle;
}
/**
* Read XML.<br>
* The method will be invoked when read data from XML file.<br>
@ -1861,6 +1873,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false));
this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true));
this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true));
this.setLayoutTemplateStyle(reader.getAttrAsInt("layoutTemplateStyle", LAYOUT_TEMPLATE_SIMPLE_STYLE));
}
private void readReportPaneAttributions(XMLableReader reader) {
@ -2134,6 +2147,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (!this.isShowTemplateMissingPlugin()) {
writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin());
}
writer.attr("layoutTemplateStyle", this.getLayoutTemplateStyle());
writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip());
writer.end();
}

3
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -14,6 +14,7 @@ import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
@ -82,7 +83,7 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane);
// 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), UrlI18nManager.getInstance().getI18nUrl("website"));
// 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL);

4
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -3,9 +3,9 @@ package com.fr.design.actions.help;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox;
import com.fr.i18n.UrlI18nManager;
import com.fr.stable.CommonUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
@ -28,7 +28,7 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com");
return UrlI18nManager.getInstance().getI18nUrl("help");
}
// 生成帮助文档 sitecenter key, help.zh_CN.10

1
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -88,7 +88,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
}
protected void renameConnection(final String oldName, final String newName) {
tableDataConfig.renameTableData(oldName, newName);
StrategyEventsNotifier.modifyDataSet(DSMapping.ofServerDS(new DsNameTarget(oldName)));
}
};

11
designer-base/src/main/java/com/fr/design/beans/ErrorMsgTextFieldAdapter.java

@ -0,0 +1,11 @@
package com.fr.design.beans;
import javax.swing.JComponent;
public interface ErrorMsgTextFieldAdapter {
void setText(String str);
String getText();
JComponent getErrorMsgTextField();
}

46
designer-base/src/main/java/com/fr/design/beans/UITextFieldAdapter.java

@ -0,0 +1,46 @@
package com.fr.design.beans;
import com.fr.design.gui.itextfield.UITextField;
import javax.swing.JComponent;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class UITextFieldAdapter implements ErrorMsgTextFieldAdapter {
private final UITextField uiTextField = new UITextField();
public UITextFieldAdapter(){
addDocumentListener();
}
@Override
public void setText(String str) {
uiTextField.setText(str);
}
@Override
public String getText() {
return uiTextField.getText();
}
public void addDocumentListener() {
uiTextField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
uiTextField.setToolTipText(uiTextField.getText());
}
public void insertUpdate(DocumentEvent e) {
uiTextField.setToolTipText(uiTextField.getText());
}
public void removeUpdate(DocumentEvent e) {
uiTextField.setToolTipText(uiTextField.getText());
}
});
}
@Override
public JComponent getErrorMsgTextField() {
return uiTextField;
}
}

38
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -47,9 +47,11 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -71,8 +73,8 @@ public abstract class DesignTableDataManager {
* 其实globalDsCache没有绝对的必要只是为了操作方便如果没有它那么每次清空服务器数据集或者存储过程的时候还要去遍历找一下
* 这个操作可能比较复杂 从减少代码复杂度的角度看还是很有必要的
*/
private static java.util.Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>();
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>();
private static Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>();
private static Set<NameChangeBean> dsNameChangedSet = new LinkedHashSet<>();
private static List<ChangeListener> globalDsListeners = new ArrayList<>();
private static Map<String, List<ChangeListener>> dsListenersMap = new ConcurrentHashMap<>();
@ -123,7 +125,7 @@ public abstract class DesignTableDataManager {
public static void envChange() {
columnCache.clear();
dsListenersMap.clear();
dsNameChangedMap.clear();
dsNameChangedSet.clear();
clearGlobalDs();
}
@ -136,17 +138,17 @@ public abstract class DesignTableDataManager {
public static void fireDSChanged(Map<String, String> dsNameChangedMap) {
clearGlobalDs();
if (!dsNameChangedMap.isEmpty()) {
setDsNameChangedMap(dsNameChangedMap);
setDsNameChangedSet(dsNameChangedMap);
}
fireDsChanged();
dsNameChangedMap.clear();
}
private static void setDsNameChangedMap(Map<String, String> map) {
private static void setDsNameChangedSet(Map<String, String> map) {
Iterator iterator = map.keySet().iterator();
while (iterator.hasNext()) {
String key = (String) iterator.next();
dsNameChangedMap.put(key, map.get(key));
dsNameChangedSet.add(new NameChangeBean(key, map.get(key)));
}
}
@ -157,23 +159,21 @@ public abstract class DesignTableDataManager {
* @return 是则返回true
*/
public static boolean isDsNameChanged(String oldDsName) {
return dsNameChangedMap.containsKey(oldDsName);
for (NameChangeBean bean : dsNameChangedSet) {
if (ComparatorUtils.equals(oldDsName, bean.getOldName())) {
return true;
}
public static String getChangedDsNameByOldDsName(String oldDsName) {
String changeName;
if (isDsNameChanged(oldDsName)) {
changeName = dsNameChangedMap.get(oldDsName);
} else {
changeName = StringUtils.EMPTY;
}
return false;
}
if (StringUtils.isNotEmpty(changeName)) {
return getChangedDsNameByOldDsName(changeName);
} else {
return oldDsName;
public static String getChangedDsNameByOldDsName(String dsName) {
for (NameChangeBean bean : dsNameChangedSet) {
if (ComparatorUtils.equals(dsName, bean.getOldName())) {
dsName = bean.getChangedName();
}
}
return dsName;
}
public static void addGlobalDsChangeListener(ChangeListener l) {

27
designer-base/src/main/java/com/fr/design/data/NameChangeBean.java

@ -0,0 +1,27 @@
package com.fr.design.data;
public class NameChangeBean {
private String oldName;
private String changedName;
public NameChangeBean(String oldName, String changedName) {
this.oldName = oldName;
this.changedName = changedName;
}
public String getOldName() {
return oldName;
}
public void setOldName(String oldName) {
this.oldName = oldName;
}
public String getChangedName() {
return changedName;
}
public void setChangedName(String changedName) {
this.changedName = changedName;
}
}

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -251,7 +251,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
try {
WorkContext.getCurrent().get(TableDataOperator.class).saveTableData(tableDataBeans);
if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.class.getSimpleName());
EventDispatcher.fire(RemoteConfigEvent.EDIT, TableDataConfig.getInstance().getNameSpace());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

6
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -186,10 +186,12 @@ public class TableDataTreePane extends BasicTableDataTreePane {
for (int i = 0; i < lineTips.length; i++) {
String lineTip = lineTips[i];
List<JLabel> jLabels = new ArrayList<>();
jLabels.add(new JLabel(lineTip));
JLabel lineJLabel = new JLabel(lineTip);
lineJLabel.setForeground(Color.lightGray);
jLabels.add(lineJLabel);
if (i == (lineTips.length - 1)) {
JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind"));
jLabel.setForeground(Color.lightGray);
jLabel.setForeground(Color.blue);
jLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {

25
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -12,6 +12,7 @@ import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.i18n.Toolkit;
import com.fr.event.EventDispatcher;
import com.fr.file.ConnectionConfig;
@ -27,13 +28,14 @@ import com.fr.third.org.apache.commons.collections4.MapUtils;
import com.fr.workspace.WorkContext;
import com.fr.file.ConnectionOperator;
import java.awt.Window;
import javax.swing.*;
import javax.swing.SwingUtilities;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/**
* Connection List Pane.
@ -182,7 +184,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
try {
WorkContext.getCurrent().get(ConnectionOperator.class).saveConnection(connectionBeans);
if (!WorkContext.getCurrent().isLocal()) {
EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.class.getSimpleName());
EventDispatcher.fire(RemoteConfigEvent.EDIT, ConnectionConfig.getInstance().getNameSpace());
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -197,14 +199,23 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
ConnectionConfig cloned = connectionConfig.mirror();
populate(cloned);
}
@Override
protected void renameConnection(String oldName, String newName) {
connectionConfig.renameConnection(oldName, newName);
}
};
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionConfig));
connectionListDialog.setVisible(true);
}
@Override
public void onCopyItem() {
super.onCopyItem();
ListModelElement selectedValue = getSelectedValue();
// identity 需要重置
if (selectedValue != null && selectedValue.wrapper != null) {
Object temp = ((NameObject) selectedValue.wrapper).getObject();
if (temp instanceof JDBCDatabaseConnection) {
JDBCDatabaseConnection object = (JDBCDatabaseConnection) temp;
object.setIdentity(UUID.randomUUID().toString());
}
}
}
}

4
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -16,8 +16,8 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.BrowseUtils;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
@ -159,7 +159,7 @@ public class JDBCDefPane extends JPanel {
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
String url = UrlI18nManager.getInstance().getI18nUrl("odbc.help");
BrowseUtils.browser(url);
}
});

17
designer-base/src/main/java/com/fr/design/formula/FormulaChecker.java

@ -25,7 +25,7 @@ public class FormulaChecker {
private static final String INVALID_FORMULA = Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula");
public static final String COLON = ":";
public static String check(String formulaText) {
public static String check(String formulaText) throws FormulaCheckerException {
StringReader in = new StringReader(formulaText);
FRLexer lexer = new FRLexer(in);
@ -34,12 +34,15 @@ public class FormulaChecker {
try {
Expression expression = parser.parse();
Node node = expression.getConditionalExpression();
return FunctionCheckerDispatcher.getInstance()
.getFunctionChecker(node)
.checkFunction(node) ? VALID_FORMULA : INVALID_FORMULA;
boolean valid = FunctionCheckerDispatcher.getInstance().getFunctionChecker(node).checkFunction(node);
if (valid) {
return VALID_FORMULA;
} else {
throw new FormulaCheckerException(INVALID_FORMULA);
}
} catch (ConditionCheckWrongException cce) {
String functionName = cce.getFunctionName();
return functionName + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Condition_Tips") + COLON;
throw new FormulaCheckerException(functionName + Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Condition_Tips") + COLON);
} catch (FunctionCheckWrongException ce) {
List<FunctionRule> rules = ce.getRules();
String functionName = ce.getFunctionName();
@ -60,10 +63,10 @@ public class FormulaChecker {
errorMsg.append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Check_Or"));
}
}
return errorMsg.toString();
throw new FormulaCheckerException(errorMsg.toString());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return INVALID_FORMULA;
throw new FormulaCheckerException(INVALID_FORMULA);
// alex:继续往下面走,expression为null时告知不合法公式
}
}

11
designer-base/src/main/java/com/fr/design/formula/FormulaCheckerException.java

@ -0,0 +1,11 @@
package com.fr.design.formula;
public class FormulaCheckerException extends Exception {
public FormulaCheckerException() {
}
public FormulaCheckerException(String message) {
super(message);
}
}

60
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -650,12 +650,14 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public void actionPerformed(ActionEvent evt) {
// Execute Formula default cell element.
String formulaText = formulaTextArea.getText().trim();
String formulaValidMessage = FormulaChecker.check(formulaText);
FineJOptionPane.showMessageDialog(
FormulaPane.this,
formulaValidMessage + ".",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.WARNING_MESSAGE);
String formulaValidMessage;
try {
formulaValidMessage = FormulaChecker.check(formulaText);
showMessageDialog(formulaValidMessage + ".");
} catch (FormulaCheckerException e) {
formulaValidMessage = e.getMessage();
showMessageDialog(formulaValidMessage + ".", false);
}
}
};
@ -663,22 +665,26 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override
public void actionPerformed(ActionEvent e) {
String formulaText = formulaTextArea.getText().trim();
String formulaValidMessage = FormulaChecker.check(formulaText);
;
String unSupportFormula = containsUnsupportedSimulationFormulas(formulaText);
if (unSupportFormula != null) {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE);
showMessageDialog(Toolkit.i18nText("Fine-Design_Basic_Formula_Unsupported_Formulas") + ":" + unSupportFormula, false);
return;
}
String formulaValidMessage;
boolean formulaValid;
try {
formulaValidMessage = FormulaChecker.check(formulaText);
formulaValid = true;
} catch (FormulaCheckerException formulaCheckerException) {
formulaValidMessage = formulaCheckerException.getMessage();
formulaValid = false;
}
String messageTips;
if (formulaValidMessage.equals(INVALID_FORMULA)) {
if (ComparatorUtils.equals(formulaValidMessage, INVALID_FORMULA)) {
messageTips = INVALID_FORMULA;
} else {
messageTips = formulaValidMessage.equals(VALID_FORMULA) ? "" : formulaValidMessage + "\n";
messageTips = ComparatorUtils.equals(formulaValidMessage, VALID_FORMULA) ? "" : formulaValidMessage + "\n";
Map<String, Object> paramsMap = setParamsIfExist(formulaText);
Calculator calculator = Calculator.createCalculator();
ParameterMapNameSpace parameterMapNameSpace = ParameterMapNameSpace.create(paramsMap);
@ -699,19 +705,33 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
String result = objectToString.length() > DEFUAL_FOMULA_LENGTH ?
objectToString.substring(0, DEFUAL_FOMULA_LENGTH - ELLIPSIS.length()) + ELLIPSIS : objectToString;
messageTips = messageTips +
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result;
Toolkit.i18nText("Fine-Design_Basic_Formula_Cal_Result") + ":" + result;
FineLoggerFactory.getLogger().info("value:{}", value);
} catch (UtilEvalError utilEvalError) {
FineLoggerFactory.getLogger().error("", utilEvalError);
}
}
showMessageDialog(messageTips, formulaValid);
}
};
private void showMessageDialog(String message) {
showMessageDialog(message, true);
}
private void showMessageDialog(String message, boolean formulaValid) {
if (formulaValid) {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
message);
} else {
FineJOptionPane.showMessageDialog(
FormulaPane.this,
messageTips,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE);
message,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.WARNING_MESSAGE);
}
}
};
private String containsUnsupportedSimulationFormulas(String formulaText) {
try {

11
designer-base/src/main/java/com/fr/design/fun/RegPaneProvider.java

@ -0,0 +1,11 @@
package com.fr.design.fun;
import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.stable.fun.mark.Immutable;
public interface RegPaneProvider extends Immutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "RegPaneProvider";
RegFieldPane createRegPane();
}

11
designer-base/src/main/java/com/fr/design/fun/TextFieldAdapterProvider.java

@ -0,0 +1,11 @@
package com.fr.design.fun;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.stable.fun.mark.Immutable;
public interface TextFieldAdapterProvider extends Immutable {
String XML_TAG = "TextFieldAdapterProvider";
int CURRENT_LEVEL = 1;
ErrorMsgTextFieldAdapter createTextFieldAdapter();
}

22
designer-base/src/main/java/com/fr/design/fun/impl/AbstractRegPaneProvider.java

@ -0,0 +1,22 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.RegPaneProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Joe
* 2021/10/8 15:19
*/
@API(level = RegPaneProvider.CURRENT_LEVEL)
public abstract class AbstractRegPaneProvider implements RegPaneProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

22
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTextFieldAdapterProvider.java

@ -0,0 +1,22 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Joe
* 2021/10/8 15:17
*/
@API(level = TextFieldAdapterProvider.CURRENT_LEVEL)
public abstract class AbstractTextFieldAdapterProvider implements TextFieldAdapterProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

12
designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java

@ -24,6 +24,16 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
private AttributeChangeListener listener;
private String globalName = "";
private boolean autoFireAttributesChanged = true;
public boolean isAutoFireAttributesChanged() {
return this.autoFireAttributesChanged;
}
public void setAutoFireAttributesChanged(boolean autoFireAttributesChanged) {
this.autoFireAttributesChanged = autoFireAttributesChanged;
}
protected AbstractAttrNoScrollPane() {
initAll();
}
@ -127,10 +137,12 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
public void attributeChanged() {
synchronized (this) {
if (listener != null) {
if (autoFireAttributesChanged) {
listener.attributeChange();
}
}
}
}
/**
* 返回图标的路径

47
designer-base/src/main/java/com/fr/design/gui/frpane/AttributeChangeUtils.java

@ -0,0 +1,47 @@
package com.fr.design.gui.frpane;
import java.awt.Component;
import java.awt.Container;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/17
*/
public class AttributeChangeUtils {
private static AbstractAttrNoScrollPane findNearestAttrNoScrollPaneAncestor(Component c) {
for(Container p = c.getParent(); p != null; p = p.getParent()) {
if (p instanceof AbstractAttrNoScrollPane) {
return (AbstractAttrNoScrollPane) p;
}
}
return null;
}
public static void changeComposedUI(Component composedComponent, boolean fireMiddleStateChanged, UIChangeAction action) {
AbstractAttrNoScrollPane attrPane = findNearestAttrNoScrollPaneAncestor(composedComponent);
boolean oldAutoFire = true;
if (!fireMiddleStateChanged) {
// 禁止属性面板自动处理属性更新
if (attrPane != null) {
oldAutoFire = attrPane.isAutoFireAttributesChanged();
attrPane.setAutoFireAttributesChanged(false);
}
}
// 更新UI
action.changeComposedUI();
if (!fireMiddleStateChanged) {
// 恢复属性面板自动处理属性更新
if (attrPane != null) {
attrPane.setAutoFireAttributesChanged(oldAutoFire);
}
}
}
public interface UIChangeAction {
void changeComposedUI();
}
}

50
designer-base/src/main/java/com/fr/design/gui/frpane/RegFieldPane.java

@ -1,21 +1,25 @@
package com.fr.design.gui.frpane;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.reg.NoneReg;
import com.fr.form.ui.reg.RegExp;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/**
* Created by kerry on 2017/9/4.
@ -67,33 +71,35 @@ public class RegFieldPane extends RegPane {
}
private static class RegErrorMsgPane extends BasicPane {
private UITextField regErrorMsgField;
private ErrorMsgTextFieldAdapter errorMsgTextFieldAdapter;
public RegErrorMsgPane() {
initRegErrorMsgField();
setStyle();
}
private void setStyle() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L5, 0, 0));
initRegErrorMsgField();
UILabel tipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"));
tipLabel.setPreferredSize(new Dimension(60, 20));
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, regErrorMsgField}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tipLabel, errorMsgTextFieldAdapter.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, 10, LayoutConstants.VGAP_MEDIUM);
this.add(panel);
}
private void initRegErrorMsgField() {
regErrorMsgField = new UITextField();
regErrorMsgField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
public void insertUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG);
if (provider == null) {
errorMsgTextFieldAdapter = new UITextFieldAdapter();
return;
}
try {
errorMsgTextFieldAdapter = provider.createTextFieldAdapter();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
errorMsgTextFieldAdapter = new UITextFieldAdapter();
public void removeUpdate(DocumentEvent e) {
regErrorMsgField.setToolTipText(regErrorMsgField.getText());
}
});
}
@Override
@ -102,11 +108,11 @@ public class RegFieldPane extends RegPane {
}
public void populate(TextEditor textEditor) {
regErrorMsgField.setText(textEditor.getRegErrorMessage());
errorMsgTextFieldAdapter.setText(textEditor.getRegErrorMessage());
}
public void update(TextEditor textEditor) {
textEditor.setRegErrorMessage(regErrorMsgField.getText());
textEditor.setRegErrorMessage(errorMsgTextFieldAdapter.getText());
}
}

12
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java

@ -21,6 +21,8 @@ public class UITabbedPane extends JTabbedPane{
private String classPath; //panel对象的类名
private String tabName; //Tab名称
private int tabSize = 0;
private Color tabBorderColor;
public UITabbedPane() {
super();
}
@ -93,6 +95,16 @@ public class UITabbedPane extends JTabbedPane{
public int getTabSize(){
return tabSize;
}
public Color getTabBorderColor() {
return tabBorderColor;
}
public void setTabBorderColor(Color tabBorderColor) {
this.tabBorderColor = tabBorderColor;
repaint();
}
@Override
/**
* 获取UI对象

21
designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -31,9 +31,20 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private int addX = -1;
private int addY = -1;
private int rollover = -1;
private Color tabBorderColor = new Color(143, 160, 183);
private final Color DEFAULT_TAB_BORDER_COLOR = new Color(143, 160, 183);
private Color[] tabSelectedColor = {UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE, UIConstants.NORMAL_BLUE};
public Color getTabBorderColor() {
Color color = null;
if (tabPane instanceof UITabbedPane) {
color = ((UITabbedPane) tabPane).getTabBorderColor();
}
if (color == null) {
color = DEFAULT_TAB_BORDER_COLOR;
}
return color;
}
/**
* 创建UI对象
*
@ -252,9 +263,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
private void drawUITabBorder(Graphics g, int tabPlacement, int x, int y, int w, int h,
boolean isSelected, boolean isEnabled, boolean isRollover) {
if (!isEnabled) {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement);
drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
} else if (isSelected || isRollover) {
drawSelectedUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement);
drawSelectedUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
if (isRollover && canClose()) {
closeX = x + w - closeIcon.getIconWidth() - 3;
closeY = 0;
@ -269,7 +280,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
closeIcon.paintIcon(tabPane, g, closeX, closeY);
}
} else {
drawUITabBorder(g, tabBorderColor, x, y, w, h, tabPlacement);
drawUITabBorder(g, getTabBorderColor(), x, y, w, h, tabPlacement);
}
}
@ -322,7 +333,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
}
private void drawUIContentBorder(Graphics g, int x, int y, int w, int h) {
g.setColor(tabBorderColor);
g.setColor(getTabBorderColor());
g.drawRect(x, y, w - 3, h - 3);
// Shadow
g.setColor(new Color(204, 204, 204));

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

@ -3,6 +3,8 @@ package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
@ -24,7 +26,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver, UIObserver {
private static final long serialVersionUID = 1L;
private static final int TEXT_LENGTH = 3;
private static final int BUTTON_SIZE = 2;
@ -37,6 +39,9 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private boolean isToolBarComponent = false;
private boolean isClick;
private UIObserverListener uiObserverListener;
private boolean autoFireStateChanged = true;
public UIButtonGroup(String[] textArray) {
this(textArray, null);
}
@ -72,7 +77,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
setSelectedIndex(index, autoFireStateChanged);
}
};
}
@ -108,7 +113,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
setSelectedIndex(index, autoFireStateChanged);
}
};
}
@ -175,7 +180,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
if (globalNameListener != null) {
globalNameListener.setGlobalName(buttonGroupName);
}
setSelectedWithFireChanged(index);
setSelectedIndex(index, autoFireStateChanged);
}
};
}
@ -253,6 +258,10 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
g2d.setClip(oldClip);
}
public void setAutoFireStateChanged(boolean autoFireStateChanged) {
this.autoFireStateChanged = autoFireStateChanged;
}
/**
* setSelectedItem
*
@ -287,13 +296,14 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return selectedIndex;
}
protected void setSelectedWithFireChanged(int newSelectedIndex) {
protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
if (selectedIndex != newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
if (i == selectedIndex) {
labelButtonList.get(i).setSelectedWithFireListener(true);
} else {
labelButtonList.get(i).setSelected(false);
labelButtonList.get(i).setSelected(i == selectedIndex, false);
}
if (fireChanged) {
fireStateChanged();
}
}
}
@ -304,10 +314,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
* @param newSelectedIndex
*/
public void setSelectedIndex(int newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex);
}
setSelectedIndex(newSelectedIndex, true);
}
private void fireStateChanged() {
@ -322,6 +329,9 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
}
/**
@ -364,6 +374,16 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return true;
}
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
/**
* @param l

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

@ -63,13 +63,8 @@ public class UITabGroup extends UIButtonGroup<Integer> {
}
@Override
protected void setSelectedWithFireChanged(int newSelectedIndex) {
if (selectedIndex != newSelectedIndex) {
selectedIndex = newSelectedIndex;
for (int i = 0; i < labelButtonList.size(); i++) {
labelButtonList.get(i).setSelected(i == selectedIndex);
}
}
protected void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {
super.setSelectedIndex(newSelectedIndex, fireChanged);
tabChanged(newSelectedIndex);
}
}

6
designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java

@ -142,10 +142,12 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
}
}
public void setSelectedWithFireListener(boolean isSelected) {
public void setSelected(boolean isSelected, boolean fireChanged) {
if (this.isSelected != isSelected) {
this.isSelected = isSelected;
if (fireChanged) {
fireSelectedChanged();
}
refresh(isSelected);
}
}
@ -175,7 +177,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override
public void mouseClicked(MouseEvent e) {
if (isEnabled() && !isEventBannded) {
setSelectedWithFireListener(!isSelected());
setSelected(!isSelected(), true);
}
}
};

9
designer-base/src/main/java/com/fr/design/gui/style/FollowingThemePane.java

@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.AttributeChangeUtils;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -47,16 +48,20 @@ public class FollowingThemePane extends BasicPane implements UIObserver {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
followingThemeButtonGroup.setAutoFireStateChanged(false);
followingThemeButtonGroup.setSelectedIndex(1);
followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
AttributeChangeUtils.changeComposedUI(FollowingThemePane.this, false, new AttributeChangeUtils.UIChangeAction() {
@Override
public void changeComposedUI() {
for (FollowingThemeActionChangeListener changeListener : changeListeners) {
changeListener.onFollowingTheme(isFollowingTheme());
}
invalidate();
// 与主题相关的属性面板更新完毕后,再通知外层更新数据
}
});
if (uiObserverListener != null) {
uiObserverListener.doChange();
}

3
designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java

@ -26,6 +26,7 @@ import com.fr.design.style.color.NewColorSelectBox;
import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.general.Background;
import com.fr.general.IOUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.general.act.BorderPacker;
import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
@ -117,7 +118,7 @@ public class TranslucentBorderSpecialPane extends AbstractBorderPackerPane imple
public void actionPerformed(ActionEvent e) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(TWEAK_NINE_POINT_HELP_URL));
desktop.browse(new URI(UrlI18nManager.getInstance().getI18nUrl("nine.point.help")));
} catch (IOException | URISyntaxException ioException) {
ioException.printStackTrace();
}

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

@ -50,9 +50,9 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -86,6 +86,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private static final String CUSTOM = "custom";
private static final String CURRENT_TEMPLATE = "cur";
private static final String OTHER_TEMPLATE = "other";
private static final UILabel EMPTY_LABEL = new UILabel();
static {
EXPORT_TYPES_MAP.put(ExportJavaScript.EXPORT_PDF, Toolkit.i18nText("Fine-Design_Basic_Export_JS_PDF"));
@ -217,6 +218,10 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
this.add(editorPane, BorderLayout.CENTER);
}
public void reset() {
editorPane.populate(new SingleJavaScript[0]);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_Export_JS_Setting");
@ -245,14 +250,16 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
ParameterSettingButton.class
});
this.setDefaultEditor(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultRenderer(ExportTemplateChooser.class, new ExportTemplateChooser());
this.setDefaultEditor(ExportTypeCombobox.class, new ExportTypeCombobox());
this.setDefaultEditor(FileNameCombobox.class, new FileNameCombobox());
this.setDefaultEditor(FileNameFormulaEditor.class, new FileNameFormulaEditor());
this.setDefaultEditor(ParameterCombobox.class, new ParameterCombobox());
this.setDefaultEditor(ParameterSettingButton.class, new ParameterSettingButton());
this.setDefaultRenderer(ParameterSettingButton.class, new ParameterSettingButton());
this.createTable().getColumnModel().getColumn(2).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(4).setMaxWidth(60);
this.createTable().getColumnModel().getColumn(5).setMaxWidth(40);
this.createTable().getColumnModel().getColumn(5).setMaxWidth(50);
}
@Override
@ -286,10 +293,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
// 命名详情
return this.getList().get(row) != null && !this.getList().get(row).isDefaultFileName();
}
if (col == 5) {
// 参数设置按钮
return this.getList().get(row) != null && !this.getList().get(row).isExtendParameters();
}
return true;
}
@ -318,7 +321,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
// 导出文件选择
class ExportTemplateChooser extends AbstractCellEditor implements TableCellEditor {
class ExportTemplateChooser extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private static final long serialVersionUID = -9112506131272704717L;
private JPanel reportletNamePane;
@ -326,16 +329,19 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private UIButton browserButton;
public ExportTemplateChooser() {
reportletNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 路径输入框
reportPathTextField = new UITextField(7);
reportPathTextField = new UITextField(8);
reportPathTextField.setEnabled(false);
reportletNamePane.add(reportPathTextField, BorderLayout.WEST);
// 选择路径按钮
browserButton = new UIButton("...");
browserButton.setVisible(true);
reportletNamePane.add(browserButton, BorderLayout.EAST);
Component[][] templateChooserComponent = {{reportPathTextField, browserButton}};
double[] rowSize = {TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL, 22};
reportletNamePane = TableLayoutHelper.createCommonTableLayoutPane(templateChooserComponent, rowSize, columnSize, 0);
browserButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
@ -384,6 +390,12 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public Object getCellEditorValue() {
return reportPathTextField.getText();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
reportPathTextField.setText((String) value);
return reportletNamePane;
}
}
// 导出方式下拉框
@ -391,6 +403,8 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
private static final long serialVersionUID = -6564079764032351372L;
private UIComboBox exportTypeComboBox;
public ExportTypeCombobox() {
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);
@ -441,6 +455,24 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public FileNameCombobox() {
fileNameComboBox = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, FILENAME_TYPE_MAP);
fileNameComboBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
if (js.isDefaultFileName()) {
js.setFileName(StringUtils.EMPTY);
}
}
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
@ -450,15 +482,6 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
Object ob = fileNameComboBox.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setDefaultFileName(StringUtils.equals(value, DEFAULT));
}
fireTableDataChanged();
}
});
@ -506,7 +529,11 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
if (value != null) {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(value));
} else {
fileNameFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build());
}
return fileNameFormulaEditor;
}
@ -528,6 +555,22 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public ParameterCombobox() {
parameterSetting = getComboBoxWithModel(new String[]{DEFAULT, CUSTOM}, PARAMETER_TYPE_MAP);
parameterSetting.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
final int row = table.getSelectedRow();
if (row == -1) {
return;
}
SingleJavaScript js = getList().get(row);
Object ob = parameterSetting.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setExtendParameters(StringUtils.equals(value, DEFAULT));
}
// 单纯为了刷新表格,使某些联动生效
table.repaint();
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
@ -537,15 +580,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1){
return;
}
SingleJavaScript js = getList().get(table.getSelectedRow());
Object ob = parameterSetting.getSelectedItem();
if (ob != null) {
String value = ob.toString();
js.setExtendParameters(StringUtils.equals(value, DEFAULT));
}
// 这里重新触发是为了触发某些编辑后事件
fireTableDataChanged();
}
});
@ -564,7 +599,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
}
// 参数设置按钮
class ParameterSettingButton extends AbstractCellEditor implements TableCellEditor {
class ParameterSettingButton extends AbstractCellEditor implements TableCellEditor, TableCellRenderer {
private static final long serialVersionUID = 4021592871993049137L;
private UIButton paraButton;
@ -573,8 +608,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public ParameterSettingButton() {
paraSettingPane = new ParameterSettingPane();
paraButton = new UIButton();
paraButton.setBackground(Color.GRAY);
paraButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_Set"));
paraButton.addMouseListener(new MouseAdapter() {
@Override
@ -613,7 +647,13 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
paraSettingPane.refresh(new ArrayList<>(Arrays.asList((ParameterProvider[]) value)));
if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
return EMPTY_LABEL;
}
ParameterProvider[] providers = (ParameterProvider[]) value;
if (providers != null) {
paraSettingPane.refresh(new ArrayList<>(Arrays.asList(providers)));
}
return paraButton;
}
@ -621,6 +661,14 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public Object getCellEditorValue() {
return paraSettingPane.getParameterList();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (getList().get(row) == null || getList().get(row).isExtendParameters()) {
return EMPTY_LABEL;
}
return paraButton;
}
}
// 参数设置弹出框
@ -729,6 +777,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
public void populateBean(ExportJavaScript ob) {
if (ob == null) {
ob = new ExportJavaScript();
otherTemplatePane.reset();
}
this.templateRadioGroup.selectIndexButton(ob.isCurrentTemplate() ? 0 : 1);
if (ob.isCurrentTemplate()) {
@ -744,11 +793,13 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
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()]));
@ -777,6 +828,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
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()];
@ -784,6 +836,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
js.setParameters(parameters);
}
}
}
exportJavaScript.addJS(js);
} else {
List<SingleJavaScript> javaScripts = otherTemplatePane.editorPane.update();

4
designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java → designer-base/src/main/java/com/fr/design/locale/impl/ShowOnlineWidgetMark.java

@ -7,10 +7,10 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class OnlineWidgetsMark implements LocaleMark<Boolean> {
public class ShowOnlineWidgetMark implements LocaleMark<Boolean> {
private Map<Locale, Boolean> map = new HashMap<>();
public OnlineWidgetsMark() {
public ShowOnlineWidgetMark() {
map.put(Locale.CHINA, true);
map.put(Locale.TAIWAN, true);
map.put(Locale.US, false);

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

@ -7,8 +7,8 @@ import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import com.fr.i18n.UrlI18nManager;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
@ -49,7 +49,8 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener {
JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"),
Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"),
CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html"));
UrlI18nManager.getInstance().getI18nUrl("help.install.font")
);
linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink"));
messagePanel.add(linkMessage);

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

@ -40,7 +40,6 @@ public class GuideView extends JDialog {
this.setSize(window.getSize());
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setBg();
this.setGlassPane(new GuideLoadingGlassPane());
DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() {
@Override
@ -106,12 +105,16 @@ public class GuideView extends JDialog {
}
public void showLoading() {
this.setGlassPane(GuideLoadingGlassPane.getInstance());
GuideLoadingGlassPane.getInstance().startLoading();
updateGuideViewLocation();
this.setVisible(true);
this.invalidate();
this.getGlassPane().setVisible(true);
}
public void hideLoading() {
GuideLoadingGlassPane.getInstance().stopLoading();
this.getGlassPane().setVisible(false);
repaint();
SwingUtilities.invokeLater(new Runnable() {
@ -124,6 +127,6 @@ public class GuideView extends JDialog {
private void updateGuideViewLocation() {
GUICoreUtils.centerWindow(window, this);
this.setSize(getSize());
this.setBounds(window.getBounds());
}
}

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

@ -9,6 +9,7 @@ import com.fr.design.mainframe.guide.tip.BubbleTip;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JPanel;
@ -21,6 +22,7 @@ import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@ -33,6 +35,7 @@ import java.util.List;
public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private static final int DEFAULT_ARROW_HEIGHT = 12;
private static final int DEFAULT_ARROW_WIDTH = 18;
public static final Insets DEFAULT_HIGHLIGHT_INSETS = new Insets(5, 5, 5, 5);
private GuideScene nextScene;
private SceneFilter sceneFilter;
@ -169,9 +172,22 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private UILabel getTargetComponentWithImage(BufferedImage image, Rectangle rectangle) {
ImageIcon ic = new ImageIcon(image);
UILabel label = new UILabel(ic);
UILabel label = new UILabel(ic){
@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.setOpaque(true);
label.setBounds(rectangle);
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;
}
@ -307,9 +323,6 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
nextButton.setBounds((getSceneWidth() - 60) / 2, getSceneHeight() - 100, 60, 30);
add(nextButton);
}
container.revalidate();
container.repaint();
}
showContainer();
if (lifecycle != null) {
@ -319,9 +332,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
@Override
public void complete() {
container.getLayeredPane().remove(this);
container.repaint();
clear();
if (lifecycle != null && !lifecycle.onComplete()) {
return;
}
@ -386,14 +397,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return container.getLayeredPane().getHeight();
}
private void clear() {
public void clear() {
targetList = new ArrayList<>();
highlightList = new ArrayList<>();
this.nextButton = null;
if (this.getComponentCount() > 0) {
this.removeAll();
invalidate();
repaint();
}
}
@Override
public void paint(Graphics g) {

55
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java

@ -1,13 +1,15 @@
package com.fr.design.mainframe.guide.scene;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.mainframe.guide.base.GuideManager;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -58,50 +60,61 @@ public class ClickScene extends AbstractGuideScene{
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if ((e.getClickCount() == 1 && clickType == ClickType.LEFT) || (e.getClickCount() == 2 && clickType == ClickType.LEFT_DOUBLE)) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
dealWithDispatchLeftClick(target, e, isDispatch);
}
} else if (e.getButton() == MouseEvent.BUTTON3 && clickType == ClickType.RIGHT) {
clear();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
}
});
}
@Override
public void mousePressed(MouseEvent e) {
if (isDispatch) {
if (target instanceof AbstractButton) {
AbstractButton b = (AbstractButton) target;
b.setFocusable(false);
}
redispatchMouseEvent(e, target);
}
}
@Override
public void mouseReleased(MouseEvent e) {
public void mousePressed(MouseEvent e) {
if ((target instanceof AbstractButton) && (target.getParent() instanceof UIButtonGroup)) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
}
@Override
public void mouseEntered(MouseEvent e) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
});
}
private void dealWithDispatchLeftClick(Component target, MouseEvent e, boolean isDispatch) {
clear();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void mouseExited(MouseEvent e) {
public void run() {
if (isDispatch) {
if (target instanceof AbstractButton) {
AbstractButton button = (AbstractButton) target;
ActionListener[] actionListeners= button.getActionListeners();
for(int i = 0; i < actionListeners.length; i++) {
ActionListener actionListener = actionListeners[i];
actionListener.actionPerformed(new ActionEvent(
button,
ActionEvent.ACTION_PERFORMED,
button.getActionCommand(),
e.getWhen(),
e.getModifiers()
));
}
} else {
redispatchMouseEvent(e, target);
}
}
complete();
}
});
}
@ -114,7 +127,7 @@ public class ClickScene extends AbstractGuideScene{
@Override
public void showScene() {
// 交互类的 scene 如果没有高亮内容块载,需要及时终止Guide,否则就没法去掉模态框影响到设计器主功能的使用了
if (this.getComponentCount() == 0) {
if (this.getComponentCount() == 0 && getHighlightList().isEmpty()) {
GuideManager.getInstance().getCurrentGuide().terminate();
} else {
super.showScene();

8
designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java

@ -2,8 +2,6 @@ package com.fr.design.mainframe.guide.tip;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.ui.bubble.Bubble;
@ -16,9 +14,11 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BubbleTip implements GuideTip {
private static final int GAP = 5;
private BubbleWithClose bubbleBox;
private Point anchor;
/**
*
* @param title 标题
@ -70,12 +70,12 @@ public class BubbleTip implements GuideTip {
int bubbleW = bubbleBox.getPreferredSize().width;
int bubbleH = bubbleBox.getPreferredSize().height;
if (bubbleBox.isTailHorizontal()) {
int x = bubbleBox.isTailLeft() ? anchor.x : anchor.x - bubbleW;
int x = bubbleBox.isTailLeft() ? anchor.x + GAP : anchor.x - bubbleW - GAP;
int y = anchor.y - (int) (bubbleH * bubbleBox.getTailStart());
bubbleBox.setBounds(x, y, bubbleW, bubbleH);
} else if (bubbleBox.isTailVertical()) {
int x = anchor.x - (int) (bubbleW * bubbleBox.getTailStart());
int y = bubbleBox.isTailTop() ? anchor.y : anchor.y - bubbleH;
int y = bubbleBox.isTailTop() ? anchor.y + GAP : anchor.y - bubbleH - GAP;
bubbleBox.setBounds(x, y, bubbleW, bubbleH);
}
}

28
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java

@ -17,6 +17,7 @@ import java.awt.event.ActionListener;
public class BubbleHint extends Bubble {
private UIButton confirmButton;
private static final Color CONTENT_TEXT_COLOR = new Color(51, 51, 52);
public BubbleHint() {
super(TailDirection.TOP, 0.9f);
@ -38,21 +39,21 @@ public class BubbleHint extends Bubble {
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
UILabel content1 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
content1.setPreferredSize(new Dimension(190,20));
content1.setHorizontalAlignment(SwingConstants.CENTER);
UILabel content1 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1"));
UILabel content2 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
content2.setPreferredSize(new Dimension(190,20));
content2.setHorizontalAlignment(SwingConstants.CENTER);
UILabel content2 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2"));
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
buttonContainer.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
buttonContainer.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));
buttonContainer.setPreferredSize(new Dimension(190,40));
buttonContainer.setOpaque(false);
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know"));
confirmButton.setPreferredSize(new Dimension(78, 24));
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")) {
public Dimension getPreferredSize() {
return new Dimension(78, 24);
}
};
buttonContainer.add(confirmButton);
contentPane.add(title);
@ -71,4 +72,13 @@ public class BubbleHint extends Bubble {
confirmButton.removeActionListener(listener);
}
private UILabel createContentLabel(String text) {
UILabel content = new UILabel(text);
content.setPreferredSize(new Dimension(190,20));
content.setHorizontalAlignment(SwingConstants.CENTER);
content.setFont(content.getFont().deriveFont(14.0f));
content.setForeground(CONTENT_TEXT_COLOR);
return content;
}
}

4
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java

@ -30,7 +30,7 @@ public class ExpandPane extends JPanel {
}
private void initComponent() {
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5);
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 0);
layout.setAlignLeft(true);
this.setLayout(layout);
@ -47,7 +47,7 @@ public class ExpandPane extends JPanel {
private JPanel createHeader() {
headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
headerPane.setPreferredSize(new Dimension(200, 24));
headerPane.setPreferredSize(new Dimension(200, 16));
UILabel headerTitle = new UILabel(this.title);
headerTitle.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
arrow = new UILabel(downIcon);

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

@ -14,7 +14,9 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -22,6 +24,7 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Window;
import java.awt.event.ActionEvent;
@ -34,12 +37,16 @@ public class GuideCompleteDialog extends JDialog {
private static final int ICON_HEIGHT = 182;
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 Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 22);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18);
private static final Font BUTTON_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 14);
private static GuideCompleteDialog dialog;
public static GuideCompleteDialog getInstance() {
if (dialog == null) {
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
}
dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame());
return dialog;
}
@ -65,15 +72,16 @@ public class GuideCompleteDialog extends JDialog {
container.setBorder(BorderFactory.createEmptyBorder(15, 52, 25, 52));
UILabel title = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Complete_Confirm"));
title.setFont(title.getFont().deriveFont(22.0f));
title.setFont(TITLE_FONT);
title.setPreferredSize(new Dimension(190, 30));
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setForeground(FONT_COLOR);
textArea = new UITextPane();
changeLineSpacing(textArea, 0.15f,false);
textArea.setEnabled(false);
textArea.setOpaque(false);
textArea.setFont(textArea.getFont().deriveFont(18.0f));
textArea.setFont(CONTENT_FONT);
textArea.setPreferredSize(new Dimension(236, 52));
textArea.setBorder(null);
textArea.setDisabledTextColor(FONT_COLOR);
@ -83,7 +91,8 @@ public class GuideCompleteDialog extends JDialog {
doc.setParagraphAttributes(0, doc.getLength(), center, false);
JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane();
buttonContainer.setPreferredSize(new Dimension(190,38));
buttonContainer.setPreferredSize(new Dimension(190,43));
buttonContainer.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
buttonContainer.setOpaque(false);
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){
@ -92,6 +101,7 @@ public class GuideCompleteDialog extends JDialog {
return new Dimension(122, 38);
}
};
button.setFont(BUTTON_FONT);
button.setUI(confirmButtonUI);
button.setRoundBorder(true);
button.setForeground(Color.WHITE);
@ -131,4 +141,11 @@ 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);
}
}

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

@ -9,11 +9,11 @@ import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
public class GuideLoadingGlassPane extends JPanel {
private static final String loadingImagePath = "/com/fr/design/mainframe/guide/loading.gif";
private static GuideLoadingGlassPane loadingPane;
public static GuideLoadingGlassPane getInstance() {
@ -32,16 +32,15 @@ public class GuideLoadingGlassPane extends JPanel {
public void initComponent() {
JPanel loadingView = FRGUIPaneFactory.createBorderLayout_S_Pane();
loadingView.setOpaque(false);
loadingView.setPreferredSize(new Dimension(130, 120));
loadingView.setPreferredSize(new Dimension(150, 90));
JPanel imageContainer = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
imageContainer.setOpaque(false);
ImagePanel imagePanel = new ImagePanel(loadingImagePath);
imagePanel.setOpaque(false);
imagePanel.setPreferredSize(new Dimension(84, 84));
imageContainer.add(imagePanel);
imageContainer.add(GuideLoadingPane.getInstance());
UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait"));
hintLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
hintLabel.setHorizontalAlignment(SwingConstants.CENTER);
hintLabel.setForeground(Color.WHITE);
@ -50,4 +49,12 @@ public class GuideLoadingGlassPane extends JPanel {
this.add(loadingView, new GridBagConstraints());
}
public void startLoading() {
GuideLoadingPane.getInstance().start();
}
public void stopLoading() {
GuideLoadingPane.getInstance().stop();
}
}

98
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java

@ -0,0 +1,98 @@
package com.fr.design.mainframe.guide.ui;
import javax.swing.JPanel;
import javax.swing.Timer;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by kerry on 2020-10-23
*/
public class GuideLoadingPane extends JPanel {
private static final BasicStroke STROKE = new BasicStroke(4);
private static final int FPS = 30;
private static final int START_ANGLE = 90;
private static GuideLoadingPane imagePanel;
private Image image;
private int angle;
private Timer timer;
public static GuideLoadingPane getInstance() {
if (imagePanel == null) {
imagePanel = new GuideLoadingPane();
}
return imagePanel;
}
public GuideLoadingPane() {
this.setOpaque(false);
this.setPreferredSize(new Dimension(50, 50));
timer = new Timer(1000 / FPS, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
repaint();
angle -= 180 / FPS; // 5 degrees per 100 ms = 50 degrees/second
if (angle > -270) {
angle += 2 * 360;
}
}
});
}
public void start() {
angle = START_ANGLE;
timer.start();
}
public void stop() {
timer.stop();
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Composite oldComposite = g2.getComposite();
Stroke oldStroke = g2.getStroke();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
int d = Math.min(getWidth(), getHeight());
int r = d / 2;
Point circlePoint = new Point(getWidth() / 2, getHeight() / 2);
g2.setColor(Color.WHITE);
g2.fillOval(circlePoint.x - r, circlePoint.y - r, d, d);
g2.setColor(Color.BLACK);
int waitCircleD = d / 10;
int waitCircleR = waitCircleD / 2;
g2.fillOval(circlePoint.x - r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD);
g2.fillOval(circlePoint.x - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD);
g2.fillOval(circlePoint.x + r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD);
g2.setStroke(STROKE);
g2.setColor(Color.decode("#419BF9"));
int lineWidth = (int) STROKE.getLineWidth();
g2.drawArc(circlePoint.x - r + lineWidth / 2 , circlePoint.y - r + lineWidth / 2, d - lineWidth, d - lineWidth, angle, -90);
g2.setStroke(oldStroke);
g2.setComposite(oldComposite);
}
}

10
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.guide.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -14,7 +15,6 @@ import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.base.GuideVersion;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -31,9 +31,9 @@ import java.awt.event.ActionListener;
public class GuideManageDialog extends JDialog {
private static final int DEFAULT_HEIGHT = 400;
private static final int DEFAULT_WIDTH = 600;
private static final Icon GROUP_COMPLETE_NONE = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_none.png");
private static final Icon GROUP_COMPLETE_SOME = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_some.png");
private static final Icon GROUP_COMPLETE_ALL = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_all.png");
private static final Icon GROUP_COMPLETE_NONE = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_none.svg");
private static final Icon GROUP_COMPLETE_SOME = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_some.svg");
private static final Icon GROUP_COMPLETE_ALL = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_all.svg");
private static final Color BORDER_COLOR = new Color(224, 224, 225);
private static final Color UNCOMPLETE_FONT_COLOR = new Color(51, 51, 52);
private static final Color COMPLETE_FONT_COLOR = new Color(51,51,52,128);
@ -74,7 +74,7 @@ public class GuideManageDialog extends JDialog {
}
private JPanel createGuideVersionPane(GuideVersion guideVersion) {
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5);
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 10);
for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) {
JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard);

28
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java

@ -1,28 +0,0 @@
package com.fr.design.mainframe.guide.ui;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
/**
* Created by kerry on 2020-10-23
*/
public class ImagePanel extends JPanel {
private Image image;
public ImagePanel(String imagePath) {
image = Toolkit.getDefaultToolkit().createImage(ImagePanel.class
.getResource(imagePath));
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (image != null) {
g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
}
}
}

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

@ -9,6 +9,7 @@ import com.fr.stable.StringUtils;
import javax.swing.Icon;
import javax.swing.JTextPane;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
@ -18,7 +19,6 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Rectangle;
@ -32,13 +32,21 @@ import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
public class BubbleWithClose extends Bubble {
private static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 14);
private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
private static final int TITLE_LINE_HEIGHT = 22;
private static final int CONTENT_LINE_HEIGHT = 18;
private static final Icon ICON = IOUtils.readIcon("/com/fr/design/mainframe/guide/close.png");
private static final int HEADER_HEIGHT = 24;
private static final Color HEADER_COLOR = new Color(245, 245, 246);
private static final Color TITLE_COLOR = new Color(51, 51, 52);
private static final Color CONTENT_COLOR = new Color(51,51,52,128);
private static final Insets DEFAULT_INSET = new Insets(10, 15, 10, 15);
private static final Color HIGHLIGHT_COLOR = new Color(65, 155, 249);
private static final Insets DEFAULT_INSET = new Insets(15, 15, 15, 15);
private static final int MIN_WIDTH = 140;
private static final int MAX_WIDTH = 275;
private static final int ICON_GAP = 10;
private static final int ICON_SIZE = 10;
private static final int TEXT_GAP = 5;
private String title;
@ -46,6 +54,8 @@ public class BubbleWithClose extends Bubble {
private UITextPane titleTextArea;
private UITextPane contentTextArea;
private UIButton closeButton;
private Dimension titleSize;
private Dimension contentSize;
public BubbleWithClose(String title, String content) {
this(title, content, TailDirection.LEFT, 0.5f);
@ -87,23 +97,17 @@ public class BubbleWithClose extends Bubble {
@Override
public void componentResized(ComponentEvent e) {
Rectangle rectBounds = getRectBounds();
Dimension buttonSize = closeButton.getPreferredSize();
closeButton.setBounds(getWidth() - 10 - buttonSize.width, rectBounds.y + (HEADER_HEIGHT - buttonSize.height) / 2, buttonSize.width, buttonSize.height);
Dimension titleSize = new Dimension(0,0);
Dimension contentSize = new Dimension(0, 0);
closeButton.setBounds(rectBounds.x + rectBounds.width - DEFAULT_INSET.right - ICON_SIZE, rectBounds.y + 21, ICON_SIZE, ICON_SIZE);
if (titleTextArea != null) {
titleSize = calTextSize(titleTextArea, getTextAreaMaxWidth());
int x = rectBounds.x + (rectBounds.width - getHorizontalInsets() - titleSize.width) / 2 + DEFAULT_INSET.left;
int y = rectBounds.y + HEADER_HEIGHT + DEFAULT_INSET.top;
int x = rectBounds.x + DEFAULT_INSET.left;
int y = rectBounds.y + DEFAULT_INSET.top;
titleTextArea.setBounds(x, y, titleSize.width, titleSize.height);
}
if (contentTextArea != null) {
contentSize = calTextSize(contentTextArea, getTextAreaMaxWidth());
int x = rectBounds.x + (rectBounds.width - getHorizontalInsets() - contentSize.width) / 2 + DEFAULT_INSET.left;
int y = rectBounds.y = HEADER_HEIGHT + DEFAULT_INSET.top + (titleSize.height == 0 ? 0 : titleSize.height + 10);
int x = rectBounds.x + DEFAULT_INSET.left;
int y = rectBounds.y + DEFAULT_INSET.top + (titleSize.height == 0 ? 0 : titleSize.height + getTextGap());
contentTextArea.setBounds(x,y, contentSize.width, contentSize.height);
}
setSize(getPreferredSize().width, getPreferredSize().height);
@ -116,7 +120,7 @@ public class BubbleWithClose extends Bubble {
closeButton = new UIButton();
closeButton.setIcon(ICON);
closeButton.set4ToolbarButton();
closeButton.setPreferredSize(new Dimension(12, 12));
closeButton.setPreferredSize(new Dimension(ICON_SIZE, ICON_SIZE));
closeButton.setRolloverEnabled(false);
closeButton.setPressedPainted(false);
this.add(closeButton);
@ -138,44 +142,84 @@ public class BubbleWithClose extends Bubble {
private void createTitleTextArea() {
if (StringUtils.isNotEmpty(title)) {
titleTextArea = createTextArea(title, FONT, TITLE_COLOR);
titleTextArea = createTextArea(title, TITLE_FONT, TITLE_LINE_HEIGHT, TITLE_COLOR);
this.add(titleTextArea);
}
titleSize = calTextSize(titleTextArea, TITLE_LINE_HEIGHT, getTextAreaWidth(MAX_WIDTH), getTextAreaWidth(MIN_WIDTH));
}
private void createContentTextArea() {
if (StringUtils.isNotEmpty(content)) {
contentTextArea = createTextArea(content, FONT, CONTENT_COLOR);
contentTextArea = createTextArea(content, CONTENT_FONT, CONTENT_LINE_HEIGHT, CONTENT_COLOR);
this.add(contentTextArea);
}
contentSize = calTextSize(contentTextArea, CONTENT_LINE_HEIGHT, getTextAreaWidth(MAX_WIDTH), getTextAreaWidth(MIN_WIDTH));
}
private UITextPane createTextArea(String str, Font font, Color foreground) {
private UITextPane createTextArea(String str, Font font, int lineHeight, Color foreground) {
int lineSpace = lineHeight - font.getSize();
UITextPane textArea= new UITextPane(){
@Override
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0);
}
};
textArea.setText(str);
textArea.setEnabled(false);
textArea.setFont(font);
changeLineSpacing(textArea, lineHeight, true);
textArea.setEditable(false);
textArea.setForeground(foreground);
textArea.setDisabledTextColor(foreground);
textArea.setBorder(null);
textArea.setFont(font);
textArea.setOpaque(false);
textArea.setForeground(foreground);
StyledDocument doc = textArea.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);
textArea.setText(str);
highlightText(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) {
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setForeground(sas, HIGHLIGHT_COLOR);
StyledDocument doc = textArea.getStyledDocument();
String text = textArea.getText();
int startPos = -1;
for (int i = 0; i < text.length(); i ++) {
char ch = text.charAt(i);
if (ch == '【') {
startPos = i;
}
if (ch == '】') {
if (startPos > 0) {
try {
doc.setCharacterAttributes(startPos, (i - startPos + 1), sas, false);
startPos = -1;
} catch (Exception e) {
}
}
}
}
}
@Override
protected int getDefaultWidth() {
return Math.max(titleSize.width, contentSize.width) + getHorizontalInsets() + ICON_GAP + ICON_SIZE + (isTailHorizontal() ? TAIL_HEIGHT : 0) ;
}
@Override
protected int getDefaultHeight() {
Dimension titleSize = calTextSize(titleTextArea, getDefaultTextAreaMaxWidth());
Dimension contentSize = calTextSize(contentTextArea, getDefaultTextAreaMaxWidth());
return (isTailVertical() ? TAIL_HEIGHT : 0) + HEADER_HEIGHT + titleSize.height + (titleSize.height == 0 ? 0 : 5) + contentSize.height + getVerticalInsets();
return titleSize.height + contentSize.height + getTextGap() + getVerticalInsets() + (isTailVertical() ? TAIL_HEIGHT : 0);
}
private int getTextGap() {
return (titleSize.height != 0 && contentSize.height != 0) ? TEXT_GAP : 0;
}
private LayoutManager getLayoutManager() {
@ -206,18 +250,6 @@ public class BubbleWithClose extends Bubble {
};
}
@Override
protected void paintBubbleBg(Graphics2D g2) {
super.paintBubbleBg(g2);
paintHeaderBg(g2);
}
private void paintHeaderBg(Graphics2D g2) {
g2.setColor(HEADER_COLOR);
Rectangle bounds = getRectBounds();
g2.fillRoundRect(bounds.x, bounds.y, bounds.width, HEADER_HEIGHT, 10, 10);
}
private int countLines(JTextPane textArea, int max_width) {
AttributedString text = new AttributedString(textArea.getText());
text.addAttribute(TextAttribute.FONT, textArea.getFont());
@ -234,28 +266,26 @@ public class BubbleWithClose extends Bubble {
return lines;
}
private Dimension calTextSize(JTextPane textArea, int maxWidth) {
private Dimension calTextSize(JTextPane textArea, int lineHeight, int maxWidth, int minWidth) {
if (textArea == null) {
return new Dimension(0, 0);
return new Dimension(minWidth, 0);
}
FontMetrics fontMetrics = GraphHelper.getFontMetrics(textArea.getFont());
int line = countLines(textArea, maxWidth);
int width = maxWidth;
if (line == 1) {
width = fontMetrics.stringWidth(textArea.getText());
width = Math.max(fontMetrics.stringWidth(textArea.getText()), minWidth);
}
int height = fontMetrics.getHeight() * line;
int height = lineHeight * line;
return new Dimension(width, height);
}
private int getTextAreaMaxWidth() {
return getWidth() - (isTailHorizontal() ? TAIL_HEIGHT : 0) -getHorizontalInsets();
}
private int getDefaultTextAreaMaxWidth() {
return BUBBLE_WIDTH - getHorizontalInsets();
private int getTextAreaWidth(int bubbleWidth) {
return bubbleWidth - getHorizontalInsets() - ICON_SIZE - ICON_GAP;
}
private int getHorizontalInsets() {
return DEFAULT_INSET.left + DEFAULT_INSET.right;
}

5
designer-base/src/main/java/com/fr/design/mainframe/share/collect/ComponentCollector.java

@ -288,6 +288,8 @@ public class ComponentCollector implements XMLable {
private JSONArray getGroupingDetail() {
JSONArray ja = JSONFactory.createJSON(JSON.ARRAY);
try {
DefaultShareGroupManager.getInstance().refresh();
Group[] groups = DefaultShareGroupManager.getInstance().getAllGroup();
for(Group group : groups) {
JSONObject jo = JSONFactory.createJSON(JSON.OBJECT);
@ -295,6 +297,9 @@ public class ComponentCollector implements XMLable {
jo.put(CONTAIN_AMOUNT, group.getAllBindInfoList().length);
ja.add(jo);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
return ja;
}

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

@ -267,6 +267,10 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
return nameTextField.checkValid();
}
public String getThemeName() {
return nameTextField.getText();
}
public List<Color> getCurrentColorScheme() {
return colorListPane.update();
}

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

@ -52,7 +52,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
* Created by Starryi on 2021/8/13
*/
public class TemplateThemeGridControlPane<T extends TemplateTheme> extends BasicPane {
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 10;
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 20;
public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37;
private final RemoveThemeAction removeAction;
private final UIButton setTheme4NewTemplateButton;
@ -92,7 +92,7 @@ public class TemplateThemeGridControlPane<T extends TemplateTheme> extends Basic
private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
add(createActionsContainer(), BorderLayout.NORTH);

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

@ -34,7 +34,6 @@ import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
@ -286,18 +285,15 @@ public class TemplateThemeGridPagesPane extends JPanel {
}
public static class TemplateThemeManagingPane extends TemplateThemeGridPagePane {
public static final int CONTENT_WIDTH = TemplateThemeGridControlPane.CONTENT_WIDTH + 4;
public static final int CONTENT_HEIGHT = TemplateThemeGridControlPane.CONTENT_HEIGHT + 10;
private final UITabbedPane tabbedPane;
private final TemplateThemeGridControlPane<FormTheme> formThemesManagerPane;
private final TemplateThemeGridControlPane<ReportTheme> reportThemesManagerPane;
public TemplateThemeManagingPane() {
setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
tabbedPane = new UITabbedPane();
tabbedPane.setTabBorderColor(new Color(0xE0E0E1));
add(tabbedPane, BorderLayout.CENTER);
formThemesManagerPane = TemplateThemeGridControlPane.createFormThemesManagerPane();

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

@ -8,6 +8,8 @@ import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -68,7 +70,12 @@ public class TemplateThemeGridPane<T extends TemplateTheme> extends BasicPane {
contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP));
fillContentListPane();
UIScrollPane scrollPane = new UIScrollPane(contentListPane);
JPanel wrapper1 = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapper1.add(contentListPane, BorderLayout.NORTH);
JPanel wrapper2 = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapper2.add(wrapper1, BorderLayout.WEST);
UIScrollPane scrollPane = new UIScrollPane(wrapper2);
scrollPane.setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

31
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -60,6 +60,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private UIButton saveButton = new UIButton();
private UIButton saveAsButton = new UIButton();
private TemplateThemeProfileActionListener actionListener = new TemplateThemeProfileActionAdapter();
public TemplateThemeProfilePane(TemplateThemeConfig<T> config) {
super();
this.config = config;
@ -112,6 +114,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
return;
}
saveButton.setEnabled(valid && isMutable);
actionListener.onThemeNameChecked(themeEditorPane.getThemeName(), valid);
}
});
@ -138,6 +141,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
if (saveAsButton != null) {
saveAsButton.setEnabled(StringUtils.isNotEmpty(name));
}
actionListener.onInitialize(theme);
isPopulating = false;
}
@ -214,6 +219,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
super.afterCommit();
saveButton.setEnabled(false);
saveAsButton.setEnabled(true);
actionListener.onSaved(config.cachedFetch(getName()));
DesignerToastMsgUtil.toastPrompt(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Save_Successfully"));
}
});
@ -330,4 +336,29 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
this.dispose();
}
}
public void addProfileActionListener(TemplateThemeProfileActionListener actionListener) {
if (actionListener != null) {
this.actionListener = actionListener;
}
}
public interface TemplateThemeProfileActionListener {
void onInitialize(TemplateTheme theme);
void onThemeNameChecked(String name, boolean valid);
void onSaved(TemplateTheme theme);
}
public static class TemplateThemeProfileActionAdapter implements TemplateThemeProfileActionListener {
@Override
public void onInitialize(TemplateTheme theme) {}
@Override
public void onThemeNameChecked(String name, boolean valid) { }
@Override
public void onSaved(TemplateTheme theme) {}
}
}

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

@ -1,7 +1,5 @@
package com.fr.design.mainframe.theme.dialog;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -16,7 +14,7 @@ import javax.swing.JPanel;
* Created by Starryi on 2021/8/13
*/
public class TemplateThemeGridPagesDialog extends TemplateThemeDialog implements TemplateThemeGridPagesPane.PageChangeListener {
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 40;
public static final int CONTENT_WIDTH = TemplateThemeGridPane.CONTENT_WIDTH + 48;
public static final int CONTENT_HEIGHT = TemplateThemeGridPane.CONTENT_HEIGHT + 37;
protected TemplateThemeGridPagesPane overallPane;

57
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

@ -90,6 +90,37 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
paintSeparator((Graphics2D) g);
}
private void paintSeparator(Graphics2D g2d) {
Border border = getBorder();
if (border instanceof LineBorder && titlePane != null) {
Border containerBorder = container.getBorder();
Insets insets = containerBorder.getBorderInsets(container);
int y = titlePane.getHeight() + insets.top;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color lineColor = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
g2d.setColor(lineColor);
g2d.setStroke(new BasicStroke(thickness * 2));
g2d.drawLine(0, y, getWidth(), y);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
@ -144,7 +175,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
data.setInsetImagePadding(titlePacker.getInsetImagePadding());
data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft());
data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight());
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder()));
}
public Label getData(){
@ -172,31 +202,6 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
}
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
private static class Utils {
private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) {

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

@ -49,7 +49,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
public PreviewPane() {
this.setPreferredSize(new Dimension(517, 270));
this.setBorder(BorderFactory.createEmptyBorder(7, 10, 5, 10));
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = createNorthPane();

4
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AbstractTemplateStylePane.java

@ -7,4 +7,8 @@ public abstract class AbstractTemplateStylePane<T> extends BasicPane {
public abstract void populate(T ob);
public abstract T update();
public AbstractTemplateStylePane<T> generateCleanPane() {
return this;
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleTemplateStyleEditor.java

@ -32,6 +32,11 @@ public class AccessibleTemplateStyleEditor extends UneditableAccessibleEditor {
setValue(stylePane.update());
fireStateChanged();
}
@Override
public void doCancel() {
stylePane = stylePane.generateCleanPane();
}
});
stylePane.populate(getValue());
dlg.setVisible(true);

7
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java

@ -44,12 +44,14 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
private JPanel right;
private CardLayout card;
private Set<Class<? extends MobileTemplateStyle>> extraStyle = new HashSet<>();
private WCardTagLayout tagLayout;
public MobileTemplateStylePane(WCardTagLayout tagLayout){
init(tagLayout);
}
public void init(WCardTagLayout tagLayout){
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.tagLayout = tagLayout;
listModel = new DefaultListModel();
card = new CardLayout();
right = FRGUIPaneFactory.createCardLayout_S_Pane();
@ -147,4 +149,9 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
list.addAll(sets);
return Collections.unmodifiableList(list);
}
@Override
public AbstractTemplateStylePane<MobileTemplateStyle> generateCleanPane() {
return new MobileTemplateStylePane(this.tagLayout);
}
}

46
designer-base/src/main/java/com/fr/design/report/fit/BaseFitAttrPane.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.report.fit.menupane.FitPreviewPane;
@ -15,9 +16,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -33,6 +32,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected JPanel contentJPanel;
protected UILabel belowSetLabel;
protected UIComboBox itemChoose;
protected java.util.List<FitAttrModel> fitAttrModelList = new ArrayList<>();
@ -41,6 +41,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
public JPanel attrJPanel;
public FitPreviewPane previewJPanel;
public FitAttrModel fitAttrModel;
private static final int BELOW_SET_COMPONENT_HSPACE = 8;
protected BaseFitAttrPane() {
@ -90,14 +91,14 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
}
for (int i = 0; i < columnSize.length; i++) {
if (i == 0) {
columnSize[i] = 80;
columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.firstColumn").getWidth();
} else {
columnSize[i] = 100;
columnSize[i] = DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.column").getWidth();
}
}
attrJPanel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
attrJPanel.setBorder(new EmptyBorder(0, 100, 10, 100));
attrJPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
contentJPanel.add(attrJPanel);
}
@ -136,9 +137,18 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initPreviewJPanel() {
previewJPanel = new FitPreviewPane();
previewJPanel.setBorder(BorderFactory.createEmptyBorder(0, getPreviewJPanelLeft(), 0, 0));
contentJPanel.add(previewJPanel);
}
private int getPreviewJPanelLeft() {
int left = 0;
if (belowSetLabel.getPreferredSize() != null) {
left = belowSetLabel.getPreferredSize().width + BELOW_SET_COMPONENT_HSPACE;
}
return left;
}
protected int getStateInPC(int index) {
FitType[] fitTypes = fitAttrModel.getFitTypes();
return fitTypes[index].getState();
@ -180,7 +190,7 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
@Override
protected String title4PopupWindow() {
return i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
return i18nText("Fine-Designer_PC_Fit_Attr");
}
protected abstract String[] getItemNames();
@ -188,29 +198,26 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
protected void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
contentJPanel = new JPanel();
contentJPanel.setLayout(FRGUIPaneFactory.createCenterFlowLayout());
contentJPanel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(false, FlowLayout.LEFT, 0, 0);
this.add(contentJPanel);
initItemChoose();
initPrompt();
}
private void initItemChoose() {
JPanel chooseJPanel = new JPanel();
chooseJPanel.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
JPanel chooseJPanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
ItemListener itemListener = getItemListener();
itemChoose = new UIComboBox(getItemNames());
itemChoose.addItemListener(itemListener);
UILabel belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
belowSetLabel = new UILabel(i18nText("Fine-Design_Report_Blow_Set"));
JPanel hSpaceLabel = new JPanel();
hSpaceLabel.setSize(BELOW_SET_COMPONENT_HSPACE, 0);
JPanel buttonPane = GUICoreUtils.createFlowPane(new Component[]{
belowSetLabel, itemChoose}, FlowLayout.LEFT, 0, 0);
belowSetLabel, hSpaceLabel, itemChoose}, FlowLayout.LEFT);
chooseJPanel.add(buttonPane);
chooseJPanel.setPreferredSize(new Dimension(500, 50));
JPanel jPanel = new JPanel();
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.add(chooseJPanel, BorderLayout.WEST);
contentJPanel.add(jPanel);
chooseJPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
contentJPanel.add(chooseJPanel);
}
@ -221,6 +228,9 @@ public abstract class BaseFitAttrPane extends BasicBeanPane<ReportFitAttr> {
}
protected void initPrompt() {
}
protected void refresh() {
validate();
repaint();

26
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -4,6 +4,7 @@ import com.fr.design.actions.JTemplateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -34,22 +35,6 @@ public class ReportFitAttrAction extends JTemplateAction {
return null;
}
};
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public ReportFitAttrAction(JTemplate jTemplate) {
super(jTemplate);
@ -57,12 +42,7 @@ public class ReportFitAttrAction extends JTemplateAction {
}
private void initMenuStyle() {
JTemplate jTemplate = getEditingComponent();
if (jTemplate.isJWorkBook()) {
this.setMenuKeySet(REPORT_FIT_ATTR);
} else {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
}
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon("/com/fr/design/images/reportfit/fit");
@ -87,13 +67,13 @@ public class ReportFitAttrAction extends JTemplateAction {
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
UIDialog dialog = attrPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
}, DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.report.fit.templatePane.dialog"));
dialog.setVisible(true);
}

20
designer-base/src/main/java/com/fr/design/style/color/ColorFactory.java

@ -72,16 +72,16 @@ public interface ColorFactory {
};
public static final Color STANDARD_COLORS[] = {
new Color(166, 89, 66),
new Color(166, 123, 66),
new Color(166, 66, 66),
new Color(103, 166, 66),
new Color(66, 121, 166),
new Color(68, 66, 166),
new Color(98, 66, 166),
new Color(146, 66, 166),
new Color(75, 18, 89),
new Color(89, 18, 51)
new Color(234, 68, 49),
new Color(179, 96, 36),
new Color(232, 147, 37),
new Color(109, 214, 50),
new Color(51, 147, 219),
new Color(56, 54, 179),
new Color(93, 54, 179),
new Color(154, 54, 179),
new Color(127, 76, 217),
new Color(179, 36, 102)
};

3
designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java

@ -53,7 +53,6 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
@Override
protected T doInBackground() throws Exception {
TimeUnit.SECONDS.sleep(5);
return this.callable.call();
}
@ -134,7 +133,7 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
this.template.setOpening(false);
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
// 需要判断当前打开的模板是不是异步执行后失败的模板 是的话立即展示失败后的提示内容 否则只设置下失败的提示内容
if (ComparatorUtils.equals(currentTemplate.getEditingFILE().getName(), this.template.getName())) {
if (ComparatorUtils.equals(currentTemplate.getEditingFILE().getName(), this.template.getEditingFILE().getName())) {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showOpenFailedCover(text);
DesignerFrameFileDealerPane.getInstance().stateChange();
} else {

2
designer-base/src/main/java/com/fr/env/ErrorDialog.java vendored

@ -39,7 +39,7 @@ public class ErrorDialog extends JDialog implements ActionListener {
messagePanel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
MessageWithLink messageWithLink = new MessageWithLink(message + ",", Toolkit.i18nText("Fine-Design_Basic_Sync_Help"), CloudCenter.getInstance().acquireUrlByKind("help.replacejars", "https://help.fanruan.com/finereport/doc-view-3268.html"));
messageWithLink.setPreferredSize(new Dimension(108, 20));
messageWithLink.setPreferredSize(new Dimension(150, 20));
JPanel messageLinkPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
messageLinkPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 5, 0));
messageLinkPane.add(messageWithLink);

7
designer-base/src/main/java/com/fr/env/HelpLink.java vendored

@ -1,7 +1,7 @@
package com.fr.env;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.i18n.UrlI18nManager;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.StringUtils;
import java.util.HashMap;
@ -18,8 +18,7 @@ public class HelpLink {
public static String getLink(String solution) {
Map<String, String> map = new HashMap<>();
LocaleMark<String> linkMark = LocaleCenter.getMark(RemoteDesignLocaleMark.class);
String link = linkMark.getValue();
String link = UrlI18nManager.getInstance().getI18nUrl("help.remote.design");
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Change_PassWord"), StringUtils.EMPTY);
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Cert_Error_Solution"), link);
map.put(InterProviderFactory.getProvider().getLocText("Fine-Core_Remote_Design_Connection_Unknown_Error_Solution"), link);

3
designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java vendored

@ -5,6 +5,7 @@ import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
@ -62,7 +63,7 @@ public class SyncFailedPluginsDialog extends JDialog {
JPanel messagePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
MessageWithLink messageWithLink = new MessageWithLink(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugin_Fail_Suggestion"),Toolkit.i18nText("Fine-Design_Basic_Sync_Deal_Immediately"),
CloudCenter.getInstance().acquireUrlByKind("help.installplugins", "https://help.fanruan.com/finereport/doc-view-2198.html"));
messageWithLink.setPreferredSize(new Dimension(316, 20));
messageWithLink.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.env.SyncFailedPluginsDialog.messageWithLink"));
messagePane.add(messageWithLink);
messagePane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));

5
designer-base/src/main/resources/com/fr/design/i18n/dimension_en.properties

@ -7,4 +7,9 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=490*95
com.fr.design.version.detail.label=750*30
com.fr.design.version.detail.dialog=900*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=800*630
com.fr.design.report.fit.templatePane.dialog=800*400
com.fr.design.report.fit.firstColumn=120*20
com.fr.design.report.fit.column=160*20

5
designer-base/src/main/resources/com/fr/design/i18n/dimension_ja_JP.properties

@ -6,4 +6,9 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=430*95
com.fr.design.version.detail.label=650*30
com.fr.design.version.detail.dialog=800*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=400*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=170*20
com.fr.design.report.fit.column=100*20

5
designer-base/src/main/resources/com/fr/design/i18n/dimension_ko_KR.properties

@ -6,4 +6,9 @@ com.fr.env.RemoteEnvPane.dialog=458*132
com.fr.design.version.check.dialog=450*95
com.fr.design.version.detail.label=700*30
com.fr.design.version.detail.dialog=850*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*36
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=130*20
com.fr.design.report.fit.column=100*20

5
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -7,4 +7,9 @@ com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20

5
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -6,4 +6,9 @@ com.fr.env.RemoteEnvPane.dialog=308*132
com.fr.design.version.check.dialog=230*95
com.fr.design.version.detail.label=450*30
com.fr.design.version.detail.dialog=600*500
com.fr.env.SyncFailedPluginsDialog.messageWithLink=316*20
com.fr.design.web.pane.text.field=450*20
com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20

BIN
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 B

13
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>全部完成</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="规范" transform="translate(-82.000000, -660.000000)">
<g id="icon_QuestionIcon_normal备份-9" transform="translate(82.000000, 660.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<path d="M8,0 C12.4178824,0 16,3.58211765 16,8 C16,12.4178824 12.4178824,16 8,16 C3.58211765,16 0,12.4178824 0,8 C0,3.58211765 3.58211765,0 8,0 Z M8,0.5 C3.85826002,0.5 0.5,3.85826002 0.5,8 C0.5,12.14174 3.85826002,15.5 8,15.5 C12.14174,15.5 15.5,12.14174 15.5,8 C15.5,3.85826002 12.14174,0.5 8,0.5 Z" id="Fill-3" fill="#9FCCFB" fill-rule="nonzero"></path>
<path d="M8,1 C11.8656471,1 15,4.13435294 15,8 C15,11.8656471 11.8656471,15 8,15 C4.13435294,15 1,11.8656471 1,8 C1,4.13435294 4.13435294,1 8,1 Z M11.1613691,5.19061128 L6.93333556,9.72064718 L5.03863539,7.69061128 C4.81253501,7.44836087 4.43286168,7.43526869 4.19061128,7.66136907 C3.94836087,7.88746945 3.93526869,8.26714277 4.16136907,8.50939318 L6.4947024,11.0093932 C6.73190478,11.2635386 7.13476635,11.2635386 7.37196872,11.0093932 L12.0386354,6.00939318 C12.2647358,5.76714277 12.2516436,5.38746945 12.0093932,5.16136907 C11.7671428,4.93526869 11.3874694,4.94836087 11.1613691,5.19061128 Z" id="形状结合" fill="#419BF9"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

13
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>未完成@2x</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="规范" transform="translate(-223.000000, -660.000000)">
<g id="icon_QuestionIcon_normal备份-9" transform="translate(223.000000, 660.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<path d="M8,0 C12.4178824,0 16,3.58211765 16,8 C16,12.4178824 12.4178824,16 8,16 C3.58211765,16 0,12.4178824 0,8 C0,3.58211765 3.58211765,0 8,0 Z M8,0.5 C3.85826002,0.5 0.5,3.85826002 0.5,8 C0.5,12.14174 3.85826002,15.5 8,15.5 C12.14174,15.5 15.5,12.14174 15.5,8 C15.5,3.85826002 12.14174,0.5 8,0.5 Z" id="Fill-3" fill-opacity="0.338693045" fill="#419BF9" fill-rule="nonzero"></path>
<path d="M8,1 C11.8656471,1 15,4.13435294 15,8 C15,11.8656471 11.8656471,15 8,15 C4.13435294,15 1,11.8656471 1,8 C1,4.13435294 4.13435294,1 8,1 Z M8,2 C4.68663769,2 2,4.68663769 2,8 C2,11.3133623 4.68663769,14 8,14 C11.3133623,14 14,11.3133623 14,8 C14,4.68663769 11.3133623,2 8,2 Z" id="Fill-3" fill="#419BF9" fill-rule="nonzero"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

23
designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>部分完成</title>
<defs>
<path d="M14,7 C14,10.8656471 10.8656471,14 7,14 C3.13435294,14 0,10.8656471 0,7 C0,3.13435294 3.13435294,0 7,0 C10.8656471,0 14,3.13435294 14,7 Z" id="path-1"></path>
</defs>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="规范" transform="translate(-155.000000, -660.000000)">
<g id="icon_QuestionIcon_normal备份-9" transform="translate(155.000000, 660.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<path d="M8,0 C12.4178824,0 16,3.58211765 16,8 C16,12.4178824 12.4178824,16 8,16 C3.58211765,16 0,12.4178824 0,8 C0,3.58211765 3.58211765,0 8,0 Z M8,0.5 C3.85826002,0.5 0.5,3.85826002 0.5,8 C0.5,12.14174 3.85826002,15.5 8,15.5 C12.14174,15.5 15.5,12.14174 15.5,8 C15.5,3.85826002 12.14174,0.5 8,0.5 Z" id="Fill-3" fill="#BFDDFD" fill-rule="nonzero"></path>
<g id="路径-3" transform="translate(1.000000, 1.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="蒙版"></g>
<path d="M0.652488577,7.36430983 C7.24039717,3.20105356 7.90994979,10.1117332 13.9699833,7.81918587 C18.0100056,6.29082097 18.0100056,7.06390999 13.9699833,10.1384529 L11.1005083,14 L2.36825002,13.4206497 L-0.640871294,7.81918587 C-4.17057044,10.2914394 -3.73945048,10.139814 0.652488577,7.36430983 Z" id="路径-4" fill="#419BF9" mask="url(#mask-2)"></path>
<path d="M7,0 C10.8656471,0 14,3.13435294 14,7 C14,10.8656471 10.8656471,14 7,14 C3.13435294,14 0,10.8656471 0,7 C0,3.13435294 3.13435294,0 7,0 Z M7,1 C3.68663769,1 1,3.68663769 1,7 C1,10.3133623 3.68663769,13 7,13 C10.3133623,13 13,10.3133623 13,7 C13,3.68663769 10.3133623,1 7,1 Z" id="蒙版" fill="#419BF9" fill-rule="nonzero" mask="url(#mask-2)"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -660,7 +660,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true);
setSelected(true, true);
fireSelectedChanged();
//需要先更新,最后重构面板

7
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -5,6 +5,7 @@ import com.fr.design.constants.KeyWords;
import com.fr.design.gui.autocomplete.AutoCompletion;
import com.fr.design.gui.autocomplete.BasicCompletion;
import com.fr.design.gui.autocomplete.DefaultCompletionProvider;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -45,7 +46,7 @@ public class VanChartHtmlLabelPane extends JPanel {
private UICheckBox isCustomHeight;
private UITextField customHeight;
private VanChartStylePane parent;
private AbstractAttrNoScrollPane parent;
private JPanel widthAndHeightPane;
@ -53,7 +54,7 @@ public class VanChartHtmlLabelPane extends JPanel {
contentTextArea.setText(text);
}
public void setParent(VanChartStylePane parent) {
public void setParent(AbstractAttrNoScrollPane parent) {
this.parent = parent;
}
@ -126,7 +127,7 @@ public class VanChartHtmlLabelPane extends JPanel {
};
}
private void fireJSChange() {
protected void fireJSChange() {
if (parent != null) {
parent.attributeChanged();
}

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -356,7 +356,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
if (isEnabled()) {
noSelected();
changeAxisSelected(getButtonName());
setSelectedWithFireListener(true);
setSelected(true, true);
fireSelectedChanged();
}
}

77
designer-form/src/main/java/com/fr/design/actions/FormFitAttrAction.java

@ -1,77 +0,0 @@
package com.fr.design.actions;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog;
import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.fit.menupane.TemplateFitAttrPane;
import com.fr.report.fit.FitProvider;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
* Created by Administrator on 2015/7/6 0006.
*/
public class FormFitAttrAction extends JTemplateAction {
private static final MenuKeySet REPORT_FIT_ATTR_ELEMENTCASE = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return DesignerUIModeConfig.getInstance().newUIMode() ?
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit_PC_Adaptive_Attr") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
public FormFitAttrAction(JTemplate jTemplate) {
super(jTemplate);
initMenuStyle();
}
private void initMenuStyle() {
this.setMenuKeySet(REPORT_FIT_ATTR_ELEMENTCASE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(DesignerUIModeConfig.getInstance().newUIMode() ?
"/com/fr/design/images/reportfit/fit.png" :
"/com/fr/design/images/reportfit/fit");
}
@Override
public void actionPerformed(ActionEvent e) {
final JTemplate jwb = getEditingComponent();
if (jwb == null) {
return;
}
final FitProvider wbTpl = (FitProvider) jwb.getTarget();
ReportFitAttr fitAttr = wbTpl.getReportFitAttr();
TemplateFitAttrPane templateFitAttrPane = new TemplateFitAttrPane(jwb);
showFitDialog(fitAttr, jwb, wbTpl, templateFitAttrPane);
}
private void showFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
dialog.setVisible(true);
}
}

8
designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java

@ -41,6 +41,14 @@ public class FormDeleteAction extends FormWidgetEditAction {
return comp;
}
@Override
public JComponent createToolBarComponentByName(String componentName) {
JComponent comp = super.createToolBarComponentByName(componentName);
// 除了 BACKSPACE 之外,DELETE 键也要能删除(直接在此处添加绑定,没有按钮提示)
comp.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
return comp;
}
/**
* 删除
*

18
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java

@ -4,7 +4,10 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.layout.FRBorderLayout;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils;
import java.awt.BorderLayout;
@ -61,7 +64,22 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
private boolean isBeyondMinConstraint(int minConstraint, int value) {
if (minConstraint > value) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
if (container.getBackupBound() != null) {
// 手动拖动导致变矮的场景
container.setSize(container.getBackupBound().getSize());
} else {
// 自适应布局平分高度导致变矮的场景
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt != null) {
jt.undo();
}
}
});
}
return true;
} else {
return false;

21
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -68,7 +68,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
public FRFitLayoutAdapter(XLayoutContainer container) {
super(container);
initMinSize();
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minHeight);
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minWidth, minHeight, actualVal);
painter = this.frLayoutState.getPainter();
}
@ -151,13 +151,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//如果当前处于边缘地带, 那么就把他贴到父容器上
boolean isMatchEdge = matchEdge(x, y);
int componentHeight = comp.getHeight();
int componentWidth = comp.getWidth();
//上半部分高度
int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
//下半部分高度
int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
//布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
@ -167,17 +160,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return false;
}
if (isCrossPointArea(comp, x, y)) {
return canAcceptWhileCrossPoint(comp, x, y);
}
if (isTrisectionArea(comp, x, y)) {
return canAcceptWhileTrisection(comp, x, y);
}
boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
return this.frLayoutState.accept(creator, x, y);
}
private boolean isExtraContainer(Component comp) {

3
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFixLayoutAdapter.java

@ -110,7 +110,8 @@ public class FRFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public boolean accept(XCreator creator, int x, int y) {
return true;
Component component = container.getComponentAt(x, y);
return component != container;
}

41
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java

@ -12,13 +12,20 @@ import java.awt.Component;
import java.util.ArrayList;
public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
private int minHeight;
private FRBodyLayoutAdapter parentLayoutAdapter;
private static final double TOP_HALF = 0.25;
private static final double BOTTOM_HALF = 0.75;
private final int minWidth;
private final int minHeight;
private final int actualVal;
private final FRBodyLayoutAdapter parentLayoutAdapter;
public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minHeight) {
public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minWidth, int minHeight, int actualVal) {
super(container);
this.parentLayoutAdapter = parentLayoutAdapter;
this.minWidth = minWidth;
this.minHeight = minHeight;
this.actualVal = actualVal;
}
@Override
@ -100,7 +107,33 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public boolean accept(XCreator creator, int x, int y) {
return true;
Component comp = container.getComponentAt(x, y);
if (comp == null || checkInterval(comp)) {
return false;
}
int componentHeight = comp.getHeight();
int componentWidth = comp.getWidth();
//上半部分高度
int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
//下半部分高度
int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
if (parentLayoutAdapter.isCrossPointArea(comp, x, y)) {
return parentLayoutAdapter.canAcceptWhileCrossPoint(comp, x, y);
}
if (parentLayoutAdapter.isTrisectionArea(comp, x, y)) {
return parentLayoutAdapter.canAcceptWhileTrisection(comp, x, y);
}
boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
}
// 间隔区域
private boolean checkInterval(Component comp) {
return container.getComponentCount() > 0 && comp == container;
}
@Override

4
designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java

@ -1,6 +1,5 @@
package com.fr.design.designer.beans.painters;
import com.fr.design.designer.beans.painters.AbstractPainter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout;
@ -50,7 +49,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
} else if (!((XCreator) currentComp).acceptType(XOccupiedLayout.class)) {
state = OperateState.COMPONENT_REPLACE;
}
state.paint(g, creator.getBackupRectangle(), currentComp.getBounds(), new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
Rectangle currentCompRec = new Rectangle(currentComp.getX() - startX, currentComp.getY() - startY, currentComp.getWidth(), currentComp.getHeight());
state.paint(g, creator.getBackupRectangle(), currentCompRec, new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
} else {
Color bColor = XCreatorConstants.LAYOUT_FORBIDDEN_COLOR;
int[] hot_rec = new int[]{x, y, 0, 0};

4
designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java

@ -40,11 +40,11 @@ public class FROccupiedLayoutPainter extends AbstractPainter {
Composite backupComposite = g2d.getComposite();
g2d.setColor(XCreatorConstants.DRAG_IN_OCCUPIED_LAYOUT_COLOR);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.05f));
g2d.fillRect(container.getX(), container.getY(), container.getWidth(), container.getHeight());
g2d.fillRect(container.getX() - startX, container.getY() - startY, container.getWidth(), container.getHeight());
g2d.setStroke(XCreatorConstants.DASH_STROKE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
g2d.drawRect(container.getX() + 1, container.getY() + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.drawRect(container.getX() - startX + 1, container.getY() - startY + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.setStroke(backupStroke);
g2d.setComposite(backupComposite);
g2d.setColor(backupColor);

33
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -273,12 +273,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
parentCreator.setBorder(border); // 容器绘制完整边框
bodyCreator.setBorder(BorderFactory.createEmptyBorder()); // body不绘制边框
titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title绘制底部边框
if (border instanceof LineBorder) {
Color color = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
titleCreator.setBorder(new BottomLineBorder(color, thickness));
}
titleCreator.setBorder(BorderFactory.createEmptyBorder()); // title不绘制边框
if (bodyCreator instanceof XBorderStyleWidgetCreator) {
XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyCreator;
@ -407,32 +402,6 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
}
// 适用于标题栏的底部边框
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D)g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
public static class NoBackgroundPaneUI extends BasicPanelUI {
@Override
public void update(Graphics g, JComponent c) {

1
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -886,6 +886,7 @@ public class XWFitLayout extends XLayoutContainer {
isRefreshing = true;
this.remove(oldCreator);
this.add(newCreator);
dealDirections(newCreator, false);
//对于新增的绝对布局的组件,需要更新下内部组件的大小
if (newCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) newCreator).updateBoundsWidget();

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

@ -15,6 +15,8 @@ import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ContainerEvent;
import java.awt.geom.Rectangle2D;
@ -187,6 +189,37 @@ public class XWTitleLayout extends DedicateLayoutContainer {
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
paintSeparator((Graphics2D) g);
}
private void paintSeparator(Graphics2D g2d) {
Border border = getBorder();
XCreator titleCreator = getTitleCreator();
if (border instanceof LineBorder && titleCreator != null) {
int height = titleCreator.getHeight();
Insets paddingInsets = getInsets();
int y = height + paddingInsets.top;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Color lineColor = ((LineBorder) border).getLineColor();
int thickness = ((LineBorder) border).getThickness();
g2d.setColor(lineColor);
g2d.setStroke(new BasicStroke(thickness * 2));
g2d.drawLine(0, y, getWidth(), y);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
@Override
public void paintBackground(Graphics2D g2d) {
if (getComponentCount() > 1) {

7
designer-form/src/main/java/com/fr/design/fit/NewJForm.java

@ -13,7 +13,6 @@ import com.fr.design.fit.common.AdaptiveSwitchUtil;
import com.fr.design.fit.common.LayoutTool;
import com.fr.form.fit.NewFormMarkAttr;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.actions.FormFitAttrAction;
import com.fr.design.actions.NewFormMobileAttrAction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.preview.DeveloperPreview;
@ -129,9 +128,9 @@ public class NewJForm extends JForm {
@Override
public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, new ShortCut[0]);
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, new ShortCut[0]);
} else {
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), new FormFitAttrAction(this)}, this.getElementCaseDesign().shortcut4TemplateMenu());
return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new NewFormMobileAttrAction(this), getReportFitAttrAction()}, this.getElementCaseDesign().shortcut4TemplateMenu());
}
}
@ -183,7 +182,7 @@ public class NewJForm extends JForm {
private void processColumnAbsorbingEffect(XWTitleLayout xwTitleLayout, DynamicUnitList columnUnitList, Dimension bound) {
int temp = 0;
int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();;
int resolution = DesignerUIModeConfig.getInstance().getScreenResolution();
int difference = 0;
int i = 0;
while (true) {

7
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -25,7 +25,6 @@ import com.fr.stable.Constants;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite;
import java.awt.Color;
@ -114,14 +113,8 @@ public class FormDesignerUI extends ComponentUI {
if (designer.getPainter() != null) {
// ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用,
// 相当于一个浮动层, 要考虑参数面板的高度
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
designer.getArea().getVerticalValue() + designer.getParaHeight());
return null;
}
}.execute();
}
AddingModel addingModel = designer.getAddingModel();

9
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -6,7 +6,7 @@ import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.OnlineWidgetsMark;
import com.fr.design.locale.impl.ShowOnlineWidgetMark;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
@ -100,7 +100,8 @@ public class FormWidgetDetailPane extends FormDockView{
}
headGroup = new UIHeadGroup(paneNames) {
protected void tabChanged(int newSelectedIndex) {
if (newSelectedIndex == 1) {
//初始化还未展示的时候不需要收集其 marketClick
if (this.isShowing() && newSelectedIndex == 1) {
ComponentCollector.getInstance().collectMarkerClick();
}
cardLayout.show(centerPane, paneList.get(newSelectedIndex).getTitle());
@ -182,7 +183,7 @@ public class FormWidgetDetailPane extends FormDockView{
}
private boolean isShowOnlineWidgetRepoPane() {
LocaleMark<Boolean> mark = LocaleCenter.getMark(OnlineWidgetsMark.class);
return mark.getValue();
LocaleMark<Boolean> localeMark = LocaleCenter.getMark(ShowOnlineWidgetMark.class);
return localeMark.getValue();
}
}

2
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -597,7 +597,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}
private ShortCut getReportFitAttrAction() {
protected ShortCut getReportFitAttrAction() {
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.getConfigShortCut(this);

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

@ -81,6 +81,9 @@ import static javax.swing.JOptionPane.ERROR_MESSAGE;
* 创建组件事件
*/
public class CreateComponentAction extends UpdateAction {
private static final double MAX_WIDTH = 960.0;
private static final double MAX_HEIGHT = 540.0;
ShareUIAspect aspect;
/**
* 等待时间 500 ms.
@ -114,8 +117,12 @@ public class CreateComponentAction extends UpdateAction {
// 获取选中的组件
Triple<Widget, XCreator, Rectangle> sharedTriple = ComponentTransformerFactory.getInstance().transform(selection);
if (sharedTriple == null) {
FineJOptionPane.showMessageDialog(designerFrame, Toolkit.i18nText("Fine-Design_Share_Select_Error_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), ERROR_MESSAGE, IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png"));
showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Select_Error_Tip"));
return;
}
if (isBeyondMaxSize(sharedTriple.getRight())) {
showErrMsgDialog(Toolkit.i18nText("Fine-Design_Share_Widget_Size_Error_Tip"));
return;
}
@ -398,4 +405,20 @@ public class CreateComponentAction extends UpdateAction {
}
return paras;
}
private boolean isBeyondMaxSize(Rectangle rec) {
double width = rec.getWidth();
double height = rec.getHeight();
return width > 0 && height > 0 && (width > MAX_WIDTH || height > MAX_HEIGHT);
}
private void showErrMsgDialog(String err) {
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
err,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
ERROR_MESSAGE,
IOUtils.readIcon("/com/fr/base/images/share/Information_Icon_warning_normal_32x32.png")
);
}
}

34
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/DownloadSuitableThemeAction.java

@ -8,11 +8,15 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.util.DownloadUtils;
import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog;
import com.fr.stable.StringUtils;
@ -22,6 +26,7 @@ import com.fr.workspace.WorkContext;
import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.Color;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
@ -35,15 +40,37 @@ import java.util.concurrent.ExecutionException;
*/
public class DownloadSuitableThemeAction extends UpdateAction {
private final String themePath;
private final UIPopupMenu popupMenu;
private boolean downloading = false;
private JTemplate<?, ?> currentTemplate;
public DownloadSuitableThemeAction(String themePath) {
public DownloadSuitableThemeAction(String themePath, UIPopupMenu popupMenu) {
this.themePath = themePath;
this.popupMenu = popupMenu;
this.putValue(Action.SMALL_ICON, null);
this.setName(Toolkit.i18nText("Fine-Design_Share_Download_Suitable_Theme"));
}
@Override
public UIMenuItem createMenuItem() {
return getLoadingMenuItem();
}
public LoadingMenuItem getLoadingMenuItem() {
Object object = this.getValue(LoadingMenuItem.class.getName());
if (object == null) {
UIMenuItem menuItem = new LoadingMenuItem(this);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(LoadingMenuItem.class.getName(), object);
}
return (LoadingMenuItem) object;
}
@Override
public void actionPerformed(ActionEvent e) {
currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
@ -78,6 +105,8 @@ public class DownloadSuitableThemeAction extends UpdateAction {
}
downloading = true;
LoadingMenuItem menuItem = getLoadingMenuItem();
menuItem.startLoading();
new SwingWorker<FormTheme, Void>() {
@Override
@ -96,11 +125,14 @@ public class DownloadSuitableThemeAction extends UpdateAction {
onThemeFetched(theme);
downloading = false;
LoadingMenuItem menuItem = getLoadingMenuItem();
menuItem.stopLoading();
}
}.execute();
}
public void onThemeFetched(FormTheme theme) {
popupMenu.menuSelectionChanged(false);
if (theme == null) {
return;
}

14
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/Jump2DetailAction.java

@ -1,11 +1,14 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.i18n.Toolkit;
import com.fr.form.share.bean.OnlineShareWidget;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.stable.StringUtils;
import javax.swing.Action;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
@ -27,6 +30,15 @@ public class Jump2DetailAction extends UpdateAction {
this.setName(Toolkit.i18nText("Fine-Design_Share_Jump_To_Detail"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
if (StringUtils.isNotEmpty(id)) {

54
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/LoadingMenuItem.java

@ -0,0 +1,54 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.general.IOUtils;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import java.awt.Graphics;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/10/19
*/
public class LoadingMenuItem extends UIMenuItem {
private boolean loading = false;
private final Icon profileIcon = IOUtils.readIcon("/com/fr/design/form/images/loading.gif");
public LoadingMenuItem(Action action) {
super(action);
setOpaque(true);
setBackground(ColorConstants.BACKGROUND);
setUI(new SharedComponentActionMenuItemUI());
}
public void startLoading() {
loading = true;
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 20));
revalidate();
repaint();
}
public void stopLoading() {
loading = false;
setBorder(BorderFactory.createEmptyBorder());
revalidate();
repaint();
}
public boolean isLoading() {
return loading;
}
@Override
protected void paintBorder(Graphics g) {
super.paintBorder(g);
if (loading) {
profileIcon.paintIcon(this, g, getWidth() - 20, 0);
}
}
}

75
designer-form/src/main/java/com/fr/design/mainframe/share/ui/actions/SharedComponentActionMenuItemUI.java

@ -0,0 +1,75 @@
package com.fr.design.mainframe.share.ui.actions;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.imenu.UIMenuItemUI;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import javax.swing.ButtonModel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.MenuSelectionManager;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/10/18
*/
public class SharedComponentActionMenuItemUI extends UIMenuItemUI {
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
g.setColor(ColorConstants.BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight);
if (menuItem.isOpaque()) {
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
}
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 0, 0, menuWidth, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor);
}
}
@Override
protected void doClick(MenuSelectionManager msm) {
if (hasLoadingMenuItem()) {
return;
}
if (menuItem instanceof LoadingMenuItem) {
menuItem.doClick(0);
} else {
super.doClick(msm);
}
}
private boolean hasLoadingMenuItem() {
Container parent = menuItem.getParent();
if (parent instanceof UIPopupMenu) {
Component[] components = parent.getComponents();
for (Component component: components) {
if (component instanceof LoadingMenuItem && ((LoadingMenuItem) component).isLoading()) {
return true;
}
}
}
return false;
}
}

7
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/AbstractOnlineWidgetBlock.java

@ -1,10 +1,10 @@
package com.fr.design.mainframe.share.ui.block;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.share.ui.actions.DownloadSuitableThemeAction;
import com.fr.design.mainframe.share.ui.actions.Jump2DetailAction;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.online.OnlineResourceManager;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetSelectPane;
import com.fr.design.mainframe.share.ui.online.ResourceLoader;
@ -116,12 +116,13 @@ public abstract class AbstractOnlineWidgetBlock extends PreviewWidgetBlock<Onlin
public JPopupMenu createRightClickPopupMenu() {
UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER);
popupMenu.setOpaque(true);
popupMenu.setBackground(ColorConstants.BACKGROUND);
OnlineShareWidget widget = getWidget();
String suitableThemeFile = widget.getThemePath();
if (StringUtils.isNotEmpty(suitableThemeFile)) {
popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile).createMenuItem());
popupMenu.add(new DownloadSuitableThemeAction(suitableThemeFile, popupMenu).createMenuItem());
}
popupMenu.add(new Jump2DetailAction(getWidget().getId()).createMenuItem());

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

@ -9,13 +9,16 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.group.ui.GroupMoveDialog;
import com.fr.design.mainframe.share.ui.actions.SharedComponentActionMenuItemUI;
import com.fr.design.mainframe.share.ui.base.PopupMenuItem;
import com.fr.design.mainframe.share.ui.constants.ColorConstants;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.local.LocalWidgetSelectPane;
import com.fr.design.mainframe.share.ui.local.WidgetSelectedManager;
@ -275,9 +278,10 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
UIPopupMenu popupMenu = new UIPopupMenu();
popupMenu.setOnlyText(true);
popupMenu.setBackground(UIConstants.DEFAULT_BG_RULER);
popupMenu.add(new PopupMenuItem(new MoveGroupAction()));
popupMenu.add(new PopupMenuItem(new RemoveAction()));
popupMenu.setOpaque(true);
popupMenu.setBackground(ColorConstants.BACKGROUND);
popupMenu.add(new MoveGroupAction().createMenuItem());
popupMenu.add(new RemoveAction().createMenuItem());
return popupMenu;
}
@ -288,6 +292,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
this.setName(Toolkit.i18nText("Fine-Design_Share_Group_Move"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
new GroupMoveDialog(DesignerContext.getDesignerFrame()) {
@ -314,6 +327,15 @@ public class LocalWidgetBlock extends PreviewWidgetBlock<DefaultSharableWidget>
this.setName(Toolkit.i18nText("Fine-Design_Share_Remove"));
}
@Override
public UIMenuItem createMenuItem() {
UIMenuItem menuItem = super.createMenuItem();
menuItem.setOpaque(true);
menuItem.setBackground(ColorConstants.BACKGROUND);
menuItem.setUI(new SharedComponentActionMenuItemUI());
return menuItem;
}
@Override
public void actionPerformed(ActionEvent e) {
int rv = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),

2
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java

@ -58,7 +58,7 @@ public abstract class PreviewWidgetBlock<T> extends JPanel implements MouseListe
return null;
}
protected JPopupMenu getRightClickPopupMenu() {
public JPopupMenu getRightClickPopupMenu() {
return rightClickPopupMenu;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save