Browse Source

Merge pull request #3326 in DESIGN/design from release/10.0 to final/10.0

* commit 'd8bac391fe857210adbe39c38c1df51f8562cb9d': (104 commits)
  REPORT-46892 切换目录有插件版本不匹配目录配置页面显示问题
  REPORT-46584 【10.0.13冒烟】设计器卡死
  REPORT-46892 【冒烟】切换到本地目录有插件版本不匹配时,远程配置页面会消失的比较慢
  REPORT-46585 fix 单个插件监听逻辑保持与之前一致
  REPORT-46585 切换工作目录时 先移除后添加插件监听
  REPORT-46285 jdk11-背景图标,有一点异常的红色显示 【问题原因】这个问题是由jdk差异造成的,前景色和背景色图标都是由上面的图标+下面的取色矩形组成,下面的取色矩形的位置由整个图标的宽高决定,而在jdk11下,拿到的宽高与jdk8一样,但是最终绘制出来的取色矩形会往左边偏移一点,大概是1px,而背景色图标之前下面的取色矩形初始为红色,在偏移了之后,绘制底下取色矩形不能完全覆盖初始红色,所以漏了一点出来,表现为异常的红色。 【改动思路】与产品确认后,决定先把背景色图标取色矩形设置为透明色,这样就不会漏出一点红色,而取色矩形绘制有点偏移的问题需要去改一下UIColorButton的UI,这个在换完相关图标后再统一修改比较好
  REPORT-45689 加上判空
  CHART-17822 设计器界面内的图形不小心切换到其他图形且不保存,点击撤销键没法返回到切换前的图形
  REPORT-46574 & REPORT-46813 & REPORT-46550
  REPORT-45689 兼容空类型 无须填充面板
  REPORT-46679 jdk11-设计器内图标优化-目录树图标都模糊,尤其是刷新图标 【问题原因】svg图标漏传到release分支了,所以显示的是之前的png图,比较模糊 【改动思路】补充图标
  REPORT-46234 普通报表\聚合报表,点击para,上方是控件设置,但是下方是组件名称
  REPORT-46585 在远程新建编辑的未保存模板切换回本地不能保存
  REPORT-45689  顶部参数界面样式优化
  REPORT-46713 && REPORT-46469 && REPORT-46735 删去注释代码
  REPORT-46713 && REPORT-46469 && REPORT-46735 【问题原因】由REPORT-44961中的改动引起 【改动思路】引起了两个客户bug,需要在明天的中间版本发布,因此还没仔细排查原因,暂时先回退掉REPORT-44961中的改动,赶一下明天的发布,后续继续修改REPORT-44961的时候再排查原因
  CHART-17805 饼图面板美化
  REPORT-46683 【冒烟】数据库查询,选中表并拖动的时候,弹窗变化了 在UIConstants中添加一个EMPTY_ICON代表无图标,然后在UpdateAction的setSmallIcon方法中对传过来的资源路径进行判断,如果为"",就把null作为Icon 的Value值put到map中,与之前的逻辑一致
  REPORT-46589 把单独过滤的类抽出来 以过滤器形式调用
  REPORT-46683 【冒烟】数据库查询,选中表并拖动的时候,弹窗变化了 SQLEitPane的分隔符误传成CR了,改为LF重新上传
  ...
final/10.0
superman 4 years ago
parent
commit
cc9e83124b
  1. 105
      designer-base/src/main/java/com/fr/base/svg/IconUtils.java
  2. 82
      designer-base/src/main/java/com/fr/base/svg/SVGIcon.java
  3. 92
      designer-base/src/main/java/com/fr/base/svg/SVGLoader.java
  4. 181
      designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java
  5. 101
      designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java
  6. 25
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  7. 86
      designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java
  8. 6
      designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java
  9. 4
      designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java
  10. 7
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  11. 62
      designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
  12. 8
      designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java
  13. 9
      designer-base/src/main/java/com/fr/design/actions/community/BugAction.java
  14. 4
      designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java
  15. 4
      designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java
  16. 5
      designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java
  17. 4
      designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java
  18. 4
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  19. 5
      designer-base/src/main/java/com/fr/design/actions/community/SignAction.java
  20. 4
      designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java
  21. 5
      designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java
  22. 5
      designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java
  23. 5
      designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java
  24. 5
      designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java
  25. 5
      designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java
  26. 7
      designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java
  27. 8
      designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java
  28. 6
      designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java
  29. 5
      designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java
  30. 10
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  31. 4
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  32. 6
      designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java
  33. 4
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java
  34. 6
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  35. 8
      designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java
  36. 6
      designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java
  37. 8
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  38. 6
      designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java
  39. 6
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  40. 6
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  41. 4
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  42. 36
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  43. 195
      designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java
  44. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  45. 4
      designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java
  46. 50
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  47. 1
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  48. 11
      designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  49. 32
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  50. 27
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  51. 14
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  52. 27
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  53. 37
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  54. 12
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  55. 109
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  56. 8
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  57. 71
      designer-base/src/main/java/com/fr/design/file/TemplateResource.java
  58. 66
      designer-base/src/main/java/com/fr/design/file/TemplateResourceManager.java
  59. 21
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  60. 34
      designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java
  61. 19
      designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java
  62. 52
      designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java
  63. 8
      designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java
  64. 34
      designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java
  65. 37
      designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java
  66. 19
      designer-base/src/main/java/com/fr/design/fun/TemplateTreeDefineProcessor.java
  67. 5
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java
  68. 23
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java
  69. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java
  70. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java
  71. 31
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java
  72. 8
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java
  73. 22
      designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java
  74. 123
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  75. 7
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  76. 1
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  77. 1
      designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java
  78. 11
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  79. 7
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  80. 15
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  81. 22
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java
  82. 2
      designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java
  83. 14
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  84. 74
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  85. 10
      designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java
  86. 68
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  87. 19
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateEvent.java
  88. 30
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  89. 3
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java
  90. 19
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java
  91. 8
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java
  92. 33
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java
  93. 43
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java
  94. 42
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java
  95. 47
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java
  96. 55
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java
  97. 154
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java
  98. 9
      designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java
  99. 34
      designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java
  100. 20
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  101. Some files were not shown because too many files have changed in this diff Show More

105
designer-base/src/main/java/com/fr/base/svg/IconUtils.java

@ -0,0 +1,105 @@
package com.fr.base.svg;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
* 主要是用来读取svgIcon的工具类
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/12/23
*/
public class IconUtils {
private static final String ICON_SUFFIX_SVG = ".svg";
private static final String ICON_SUFFIX_PNG = ".png";
private static final String ICON_SUFFIX_GIF = ".gif";
private static final String SUFFIX_SEPARATOR = ".";
public static final String ICON_TYPE_NORMAL= "_normal.svg";
public static final String ICON_TYPE_DISABLED= "_disabled.svg";
public static final String ICON_TYPE_PRESSED= "_pressed.svg";
/**
* 可以读取SVG图标或者普通图标并且可以读取不带扩展名的文件
* 不带扩展名时以svg优先其次png最后gif
* @param resource 图片路径
* @return 图标
*/
public static Icon readIcon(String resource) {
// 判断是否有.XXX文件后缀
if (resource.contains(SUFFIX_SEPARATOR)) {
// 判断是否以.svg结尾
if (resource.endsWith(ICON_SUFFIX_SVG)) {
return SVGIcon.readSVGIcon(resource);
}
return IOUtils.readIcon(resource);
}
// 文件无后缀时
return readNoSuffixResource(resource, ICON_TYPE_NORMAL);
}
/**
* 尝试读取不带扩展名的图标svg优先其次png最后gif都没读到就打印错误日志返回空白Icon
* @param resource 图片路径
* @param svgIconType 针对svg来说的图标类型
* 取值为ICON_TYPE_NORMALICON_TYPE_DISABLEDICON_TYPE_PRESSED
* @return 图标
*/
private static Icon readNoSuffixResource(String resource, String svgIconType) {
String svgPath = resource + svgIconType;
if (IOUtils.readResource(svgPath) != null) {
return SVGIcon.readSVGIcon(svgPath);
}
String pngPath = resource + ICON_SUFFIX_PNG;
if (IOUtils.readResource(pngPath) != null) {
return IOUtils.readIcon(pngPath);
}
String gifPath = resource + ICON_SUFFIX_GIF;
if (IOUtils.readResource(gifPath) != null) {
return IOUtils.readIcon(gifPath);
}
FineLoggerFactory.getLogger().error("File not exists:{}", resource);
return new ImageIcon();
}
/**
* 读取指定类型的svgIcon
* @param resource
* @param svgIconType
* @return
*/
public static Icon readSVGIcon(String resource, String svgIconType) {
// 判断下是否有后缀
if (!resource.contains(SUFFIX_SEPARATOR)) {
return readNoSuffixResource(resource, svgIconType);
}
// 如果是".png"后缀,就替换为传入的svgIconType,然后读取图标
if (resource.endsWith(ICON_SUFFIX_PNG)) {
return readSpecifiedTypeIcon(resource, ICON_SUFFIX_PNG, svgIconType);
}
// 如果是"_XXXXXX.svg"后缀
if (resource.endsWith(ICON_TYPE_NORMAL)) {
return readSpecifiedTypeIcon(resource, ICON_TYPE_NORMAL, svgIconType);
}
if (resource.endsWith(ICON_TYPE_DISABLED)) {
return readSpecifiedTypeIcon(resource, ICON_TYPE_DISABLED, svgIconType);
}
if (resource.endsWith(ICON_TYPE_PRESSED)) {
return readSpecifiedTypeIcon(resource, ICON_TYPE_PRESSED, svgIconType);
}
return readIcon(resource);
}
private static Icon readSpecifiedTypeIcon(String resource, String oldSuffix, String newSuffix) {
String iconPath = resource.replace(oldSuffix, newSuffix);
if (IOUtils.readResource(iconPath) != null) {
return SVGIcon.readSVGIcon(iconPath);
}
return readIcon(resource);
}
}

82
designer-base/src/main/java/com/fr/base/svg/SVGIcon.java

@ -0,0 +1,82 @@
package com.fr.base.svg;
import com.fr.general.IOUtils;
import javax.swing.Icon;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
/**
* SVG转化而来的Icon
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/12/17
*/
public class SVGIcon implements Icon {
private BufferedImage image;
private static final boolean HI_DPI_SURPORT = SystemScaleUtils.isJreHiDPIEnabled();
public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale();
private static final String ICON_PREFIX = "/";
public SVGIcon(BufferedImage image) {
this.image = image;
}
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (HI_DPI_SURPORT) {
Graphics2D graphics = (Graphics2D) g.create(x, y, image.getWidth(null), image.getHeight(null));
float scale = SYSTEM_SCALE;
graphics.scale(1 / scale, 1 / scale);
graphics.drawImage(image, 0, 0, null);
graphics.scale(1.0D, 1.0D);
graphics.dispose();
} else {
g.drawImage(image, x, y, null);
}
}
@Override
public int getIconWidth() {
return HI_DPI_SURPORT ? (int) (image.getWidth() / SYSTEM_SCALE) : image.getWidth();
}
@Override
public int getIconHeight() {
return HI_DPI_SURPORT ? (int) (image.getHeight() / SYSTEM_SCALE) : image.getHeight();
}
/**
* 读取高清图标
* @param url
* @return
*/
public static Icon readSVGIcon(String url) {
if (!url.startsWith(ICON_PREFIX)) {
url = ICON_PREFIX + url;
}
BufferedImage image = (BufferedImage) SVGLoader.load(url);
return image == null ? IOUtils.readIcon(url) : new SVGIcon(image);
}
/**
* 读取指定尺寸的图标
* @param url 资源路径
* @param width 宽度
* @param height 高度
* @return
*/
public static Icon readSVGIcon(String url, float width, float height) {
if (!url.startsWith(ICON_PREFIX)) {
url = ICON_PREFIX + url;
}
BufferedImage image = (BufferedImage) SVGLoader.load(url, width, height);
return image == null ? IOUtils.readIcon(url) : new SVGIcon(image);
}
}

92
designer-base/src/main/java/com/fr/base/svg/SVGLoader.java

@ -0,0 +1,92 @@
package com.fr.base.svg;
import com.fr.general.IOUtils;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.xmlgraphics.java2d.Dimension2DDouble;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
/**
* SVG图标加载器
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/12/17
*/
public class SVGLoader {
public static final int ICON_DEFAULT_SIZE = 16;
public SVGLoader() {
}
@Nullable
public static Image load(@NotNull String url) {
try {
URL resource = IOUtils.getResource(url, SVGLoader.class);
if (resource == null) {
return null;
}
return load(resource, SVGIcon.SYSTEM_SCALE);
} catch (IOException ignore) {
return null;
}
}
@Nullable
public static Image load(@NotNull URL url) throws IOException {
return load(url, SVGIcon.SYSTEM_SCALE);
}
@Nullable
public static Image load(@NotNull URL url, double scale) throws IOException {
try {
String svgUri = url.toString();
TranscoderInput input = new TranscoderInput(svgUri);
return SVGTranscoder.createImage(scale, input).getImage();
} catch (TranscoderException ignore) {
return null;
}
}
@Nullable
public static Image load(@NotNull URL url, double scale, Dimension2DDouble dimension) throws IOException {
try {
String svgUri = url.toString();
TranscoderInput input = new TranscoderInput(svgUri);
return SVGTranscoder.createImage(scale, input,
(float) (dimension.getWidth() * scale), (float) (dimension.getHeight() * scale)).getImage();
} catch (TranscoderException ignore) {
return null;
}
}
@Nullable
public static Image load(@NotNull URL url, double scale, double overriddenWidth, double overriddenHeight) throws IOException {
try {
String svgUri = url.toString();
TranscoderInput input = new TranscoderInput(svgUri);
return SVGTranscoder.createImage(scale, input, (float) (overriddenWidth * scale), (float) (overriddenHeight * scale)).getImage();
} catch (TranscoderException ignore) {
return null;
}
}
@Nullable
public static Image load(@NotNull String url, float width, float height) {
try {
URL resource = IOUtils.getResource(url, SVGLoader.class);
if (resource == null) {
return null;
}
TranscoderInput input = new TranscoderInput(resource.toString());
return SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input, -1, -1, width, height).getImage();
} catch (TranscoderException ignore) {
return null;
}
}
}

181
designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java

@ -0,0 +1,181 @@
package com.fr.base.svg;
import com.fr.stable.AssistUtils;
import com.fr.value.AtomicNotNullLazyValue;
import org.apache.batik.anim.dom.SAXSVGDocumentFactory;
import org.apache.batik.anim.dom.SVGOMDocument;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.transcoder.SVGAbstractTranscoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.batik.util.XMLResourceDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.w3c.dom.Element;
import org.w3c.dom.svg.SVGDocument;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.StringReader;
/**
* 可以根据某个缩放倍数scale将SVG图片转化为Image对象
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/12/17
*/
public class SVGTranscoder extends ImageTranscoder {
private static final float DEFAULT_VALUE = -1.0F;
public static final float ICON_DEFAULT_SIZE = 16F;
private float origDocWidth;
private float origDocHeight;
@Nullable
private BufferedImage image;
private final double scale;
@NotNull
private static AtomicNotNullLazyValue<Double> iconMaxSize = new AtomicNotNullLazyValue<Double>() {
@NotNull
@Override
protected Double compute() {
double maxSize = Double.MAX_VALUE;
if (!GraphicsEnvironment.isHeadless()) {
GraphicsDevice defaultScreenDevice = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getDefaultScreenDevice();
Rectangle bounds = defaultScreenDevice.getDefaultConfiguration().getBounds();
AffineTransform tx = defaultScreenDevice
.getDefaultConfiguration()
.getDefaultTransform();
maxSize = Math.max(bounds.width * tx.getScaleX(), bounds.height * tx.getScaleY());
}
return maxSize;
}
};
public SVGTranscoder(double scale) {
this.scale = scale;
this.width = ICON_DEFAULT_SIZE;
this.height = ICON_DEFAULT_SIZE;
}
public SVGTranscoder(double scale, float width, float height) {
this.scale = scale;
this.width = width;
this.height = height;
}
public final float getOrigDocWidth() {
return this.origDocWidth;
}
public final void setOrigDocWidth(float origDocWidth) {
this.origDocWidth = origDocWidth;
}
public final float getOrigDocHeight() {
return this.origDocHeight;
}
public final void setOrigDocHeight(float origDocHeight) {
this.origDocHeight = origDocHeight;
}
public static double getIconMaxSize() {
return iconMaxSize.getValue();
}
@Nullable
public final BufferedImage getImage() {
return this.image;
}
@NotNull
public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input) throws TranscoderException {
return createImage(scale, input, -1, -1);
}
@NotNull
public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight) throws TranscoderException {
return createImage(scale, input, overriddenWidth, overriddenHeight, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE);
}
@NotNull
public static SVGTranscoder createImage(double scale, @NotNull TranscoderInput input, float overriddenWidth, float overriddenHeight, float width, float height) throws TranscoderException {
SVGTranscoder transcoder = new SVGTranscoder(scale, width, height);
if (!AssistUtils.equals(overriddenWidth, DEFAULT_VALUE)) {
transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, overriddenWidth);
}
if (!AssistUtils.equals(overriddenHeight, DEFAULT_VALUE)) {
transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, overriddenHeight);
}
double iconMaxSize = SVGTranscoder.iconMaxSize.getValue();
transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_WIDTH, (float) iconMaxSize);
transcoder.addTranscodingHint(SVGAbstractTranscoder.KEY_MAX_HEIGHT, (float) iconMaxSize);
transcoder.transcode(input, null);
return transcoder;
}
private static SVGDocument createFallbackPlaceholder() {
try {
String fallbackIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\">\n" +
" <rect x=\"1\" y=\"1\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"red\" stroke-width=\"2\"/>\n" +
" <line x1=\"1\" y1=\"1\" x2=\"15\" y2=\"15\" stroke=\"red\" stroke-width=\"2\"/>\n" +
" <line x1=\"1\" y1=\"15\" x2=\"15\" y2=\"1\" stroke=\"red\" stroke-width=\"2\"/>\n" +
"</svg>\n";
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
return (SVGDocument) factory.createDocument(null, new StringReader(fallbackIcon));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
@Override
protected void setImageSize(float docWidth, float docHeight) {
super.setImageSize((float) (docWidth * this.scale), (float) (docHeight * this.scale));
this.origDocWidth = docWidth;
this.origDocHeight = docHeight;
}
@Override
@NotNull
public BufferedImage createImage(int width, int height) {
return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
}
@Override
public void writeImage(@NotNull BufferedImage image, @Nullable TranscoderOutput output) {
this.image = image;
}
@Override
@NotNull
protected UserAgent createUserAgent() {
return new SVGAbstractTranscoderUserAgent() {
@Override
@NotNull
public SVGDocument getBrokenLinkDocument(@NotNull Element e, @NotNull String url, @NotNull String message) {
return createFallbackPlaceholder();
}
};
}
/**
* 开放访问权限
*/
@Override
public BridgeContext createBridgeContext(SVGOMDocument doc) {
return super.createBridgeContext(doc);
}
}

101
designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java

@ -0,0 +1,101 @@
package com.fr.base.svg;
import com.bulenkov.iconloader.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import org.jetbrains.annotations.NotNull;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicReference;
/**
* 获取系统Scale相关的工具类
* @author Yvan
* @version 10.0
* Created by Yvan on 2020/12/17
*/
public class SystemScaleUtils {
private static final AtomicReference<Boolean> JRE_HIDPI = new AtomicReference<>();
private static final String HI_DPI = "hidpi";
/**
* 判断是否支持高清
* @return
*/
public static boolean isJreHiDPIEnabled() {
if (JRE_HIDPI.get() != null) {
return JRE_HIDPI.get();
}
if (OperatingSystem.isMacos()) {
// 如果是mac os系统,直接返回true
return true;
}
if (OperatingSystem.isWindows() && StableUtils.getMajorJavaVersion() <= 8) {
// 如果是jdk8 + Windows系统,直接返回false
return false;
}
synchronized (JRE_HIDPI) {
if (JRE_HIDPI.get() != null) {
return JRE_HIDPI.get();
}
boolean result = false;
if (getBooleanProperty(HI_DPI, true)) {
try {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Class<?> sunGraphicsEnvironmentClass = Class.forName("sun.java2d.SunGraphicsEnvironment");
if (sunGraphicsEnvironmentClass.isInstance(ge)) {
try {
Method method = sunGraphicsEnvironmentClass.getDeclaredMethod("isUIScaleEnabled");
method.setAccessible(true);
result = (Boolean)method.invoke(ge);
}
catch (NoSuchMethodException e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
}
catch (Throwable ignore) {
}
}
JRE_HIDPI.set(result);
return result;
}
}
public static boolean getBooleanProperty(@NotNull final String key, final boolean defaultValue) {
final String value = System.getProperty(key);
return value == null ? defaultValue : Boolean.parseBoolean(value);
}
/**
* 获取系统Scale
* @return
*/
public static float sysScale() {
// 如果检测到是retina,直接返回2
if (UIUtil.isRetina()) {
return 2.0f;
}
float scale = 1.0f;
// 先判断是否支持高清,不支持代表此时是Windows + jdk8 的设计器,返回的scale值为1.0
if (isJreHiDPIEnabled()) {
// 获取屏幕图形设备对象
GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
if (graphicsDevice != null) {
// 获取图形配置对象
GraphicsConfiguration configuration = graphicsDevice.getDefaultConfiguration();
if (configuration != null && configuration.getDevice().getType() != GraphicsDevice.TYPE_PRINTER) {
// 获取屏幕缩放率,Windows+jdk11环境下会得到用户设置的dpi值
scale = (float) configuration.getDefaultTransform().getScaleX();
}
}
}
return scale;
}
}

25
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -1,6 +1,7 @@
package com.fr.design; package com.fr.design;
import com.fr.common.report.ReportState; import com.fr.common.report.ReportState;
import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -35,6 +36,7 @@ import com.fr.process.engine.core.FineProcessContext;
import com.fr.rpc.Result; import com.fr.rpc.Result;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.env.PluginErrorRemindDialog;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
@ -144,6 +146,7 @@ public class EnvChangeEntrance {
template.refreshToolArea(); template.refreshToolArea();
} }
showServiceDialog(selectedEnv); showServiceDialog(selectedEnv);
pluginErrorRemind();
} catch (WorkspaceAuthException | RegistEditionException e) { } catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -297,6 +300,28 @@ public class EnvChangeEntrance {
} }
} }
/**
* 插件启动错误信息提示
*/
public void pluginErrorRemind() {
if (!WorkContext.getCurrent().isLocal()) {
return;
}
String content = PluginErrorRemindHandler.pluginErrorContent();
if (StringUtils.isNotEmpty(content)) {
// 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾
// 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
}
});
}
}
/** /**
* 判断是否需要做版本验证判断依据为 * 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境 * 1选择的环境为远程环境

86
designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java

@ -0,0 +1,86 @@
package com.fr.design;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author hades
* @version 10.0
* Created by hades on 2020/12/17
*/
public class PluginClassRefreshManager {
private static final PluginClassRefreshManager INSTANCE = new PluginClassRefreshManager();
private final Set<String> context = new HashSet<>();
private final PluginEventListener pluginAfterRunEventListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
// 兼容之前版本特性
for (String tag : context) {
if (event.getContext().contain(tag)) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
return;
}
}
// 重新载入模板xml内容 到 Workbook/Form对象中
HistoryTemplateListCache.getInstance().reloadAllEditingTemplateByPlugin(event.getContext());
}
};
private final PluginEventListener beforeAllPluginActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener);
}
};
private final PluginEventListener afterAllPluginsActive = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener);
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
};
public static PluginClassRefreshManager getInstance() {
return INSTANCE;
}
public void load() {
context.add(TableDataDefineProvider.XML_TAG);
context.add(HyperlinkProvider.XML_TAG);
}
private PluginClassRefreshManager() {
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
public void removePluginListener() {
PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive);
PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive);
}
public void addPluginListener() {
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener);
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive);
}
}

6
designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions; package com.fr.design.actions;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -22,7 +22,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction {
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); this.setSmallIcon("/com/fr/design/images/m_report/allow_authority_edit");
} }
/** /**
@ -78,4 +78,4 @@ public class AllowAuthorityEditAction extends TemplateComponentAction {
} }
} }
} }

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

@ -1,6 +1,6 @@
package com.fr.design.actions; package com.fr.design.actions;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
@ -19,7 +19,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction {
public ExitAuthorityEditAction(TargetComponent t) { public ExitAuthorityEditAction(TargetComponent t) {
super(t); super(t);
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Authority_Edit_Status_Exit")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Authority_Edit_Status_Exit"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit.png")); this.setSmallIcon("/com/fr/design/images/m_report/exit_authority_edit");
} }

7
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -1,8 +1,7 @@
package com.fr.design.actions; package com.fr.design.actions;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import com.fr.base.svg.IconUtils;
import com.fr.base.BaseUtils;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.data.datapane.ReportTableDataPane; import com.fr.design.data.datapane.ReportTableDataPane;
@ -27,7 +26,7 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
this.setMenuKeySet(KeySetUtils.TEMPLATE_TABLE_DATA_SOURCE); this.setMenuKeySet(KeySetUtils.TEMPLATE_TABLE_DATA_SOURCE);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/datasource.png")); this.setSmallIcon("/com/fr/design/images/m_web/datasource");
} }
/** /**
@ -91,4 +90,4 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
public void fireDSChanged(Map<String, String> map) { public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map); DesignTableDataManager.fireDSChanged(map);
} }
} }

62
designer-base/src/main/java/com/fr/design/actions/UpdateAction.java

@ -6,6 +6,8 @@ package com.fr.design.actions;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.svg.SVGIcon;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -78,6 +80,16 @@ public abstract class UpdateAction extends ShortCut implements Action {
private String searchText = StringUtils.EMPTY; private String searchText = StringUtils.EMPTY;
/**
* 按钮在按压状态的图标key
*/
public static final String PRESSED_ICON = "pressedIcon";
/**
* 按钮在灰化状态的图标key
*/
public static final String DISABLED_ICON = "disabledIcon";
/** /**
@ -162,6 +174,25 @@ public abstract class UpdateAction extends ShortCut implements Action {
this.putValue(Action.SMALL_ICON, smallIcon); this.putValue(Action.SMALL_ICON, smallIcon);
} }
/**
* 使用传入资源url的方式设置Icon可以自动设置对应的"_normal.svg""_disabled.svg"
* 但是要保证文件名的统一例如a.png对应a_normal.svga_disabled.svg
* 如果a_disabled.svg或者a_pressed.svg缺失则不会被设置成灰化状态或者按压状态图标
* 如果a_normal.svg缺失则会读到a.png这也就不是一个SVGIcon了
* 如果连 a.png 也不存在那么这个action的图标就是空白的
*
* 如果想让这个Action没有图标可以传入""
* @param resource 图标资源路径
*/
public void setSmallIcon(String resource) {
if (StringUtils.equals(resource, StringUtils.EMPTY)) {
this.putValue(Action.SMALL_ICON, null);
return;
}
this.putValue(Action.SMALL_ICON, IconUtils.readIcon(resource));
this.putValue(UpdateAction.DISABLED_ICON, IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_DISABLED));
}
public void setSmallIcon(Icon[] smallIcon, boolean white) { public void setSmallIcon(Icon[] smallIcon, boolean white) {
this.putValue(Action.SMALL_ICON, smallIcon); this.putValue(Action.SMALL_ICON, smallIcon);
} }
@ -251,6 +282,14 @@ public abstract class UpdateAction extends ShortCut implements Action {
} }
public void setPressedIcon(Icon pressedIcon) {
this.putValue(UpdateAction.PRESSED_ICON, pressedIcon);
}
public void setDisabledIcon(Icon disabledIcon) {
this.putValue(UpdateAction.DISABLED_ICON, disabledIcon);
}
@Override @Override
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
@ -271,6 +310,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
UIMenuItem menuItem = new UIMenuItem(this); UIMenuItem menuItem = new UIMenuItem(this);
// 设置名字用作单元测 // 设置名字用作单元测
menuItem.setName(getName()); menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem; object = menuItem;
this.putValue(UIMenuItem.class.getName(), object); this.putValue(UIMenuItem.class.getName(), object);
@ -282,6 +323,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this); UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this);
// 设置名字用作单元测 // 设置名字用作单元测
menuItem.setName(getName()); menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
this.putValue(UIMenuItem.class.getName(), menuItem); this.putValue(UIMenuItem.class.getName(), menuItem);
return menuItem; return menuItem;
} }
@ -307,6 +350,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
} }
button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); button.setIcon((Icon) this.getValue(Action.SMALL_ICON));
setPressedIcon4Button(button);
setDisabledIcon4Button(button);
button.addActionListener(this); button.addActionListener(this);
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW);
@ -454,6 +499,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
object = new UseMenuItem(this); object = new UseMenuItem(this);
this.putValue(UseMenuItem.class.getName(), object); this.putValue(UseMenuItem.class.getName(), object);
} }
setPressedIcon4Button((UseMenuItem) object);
setDisabledIcon4Button((UseMenuItem) object);
return (UseMenuItem) object; return (UseMenuItem) object;
} }
@ -594,4 +641,17 @@ public abstract class UpdateAction extends ShortCut implements Action {
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
} }
} private void setPressedIcon4Button(AbstractButton button) {
Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON);
if (pressedIcon != null && pressedIcon instanceof SVGIcon) {
button.setPressedIcon(pressedIcon);
}
}
private void setDisabledIcon4Button(AbstractButton button) {
Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON);
if (disabledIcon != null && disabledIcon instanceof SVGIcon) {
button.setDisabledIcon(disabledIcon);
}
}
}

8
designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -13,15 +13,15 @@ import java.awt.event.ActionEvent;
public class BBSAction extends UpdateAction public class BBSAction extends UpdateAction
{ {
public BBSAction() public BBSAction()
{ {
this.setMenuKeySet(BBS); this.setMenuKeySet(BBS);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/bbs.png")); this.setSmallIcon("/com/fr/design/images/bbs/bbs");
} }
/** /**

9
designer-base/src/main/java/com/fr/design/actions/community/BugAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
@ -17,8 +17,7 @@ public class BugAction extends UpdateAction
{ this.setMenuKeySet(BUG); { this.setMenuKeySet(BUG);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/bug.png")); this.setSmallIcon("/com/fr/design/images/bbs/bug");
} }
@Override @Override
@ -29,7 +28,7 @@ public void actionPerformed(ActionEvent arg0)
} }
public static final MenuKeySet BUG = new MenuKeySet() { public static final MenuKeySet BUG = new MenuKeySet() {
@Override @Override
public String getMenuName() { public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bug"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bug");
@ -43,7 +42,7 @@ public void actionPerformed(ActionEvent arg0)
@Override @Override
public char getMnemonic() public char getMnemonic()
{ {
return 'U'; return 'U';
} }
}; };

4
designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.BugNeedMark; import com.fr.design.locale.impl.BugNeedMark;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -20,7 +20,7 @@ public class BugNeedAction extends UpdateAction {
this.setMenuKeySet(BugAndNeed); this.setMenuKeySet(BugAndNeed);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); this.setSmallIcon("/com/fr/design/images/bbs/need");
} }
@Override @Override

4
designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
@ -17,7 +17,7 @@ public class CenterAction extends UpAction{
this.setMenuKeySet(CENTER); this.setMenuKeySet(CENTER);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/center.png")); this.setSmallIcon("/com/fr/design/images/bbs/center");
} }

5
designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java

@ -1,10 +1,9 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.svg.IconUtils;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -14,7 +13,7 @@ public class FacebookFansAction extends UpAction {
this.setMenuKeySet(FACEBOOKFANS); this.setMenuKeySet(FACEBOOKFANS);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/facebook.png")); this.setSmallIcon("/com/fr/design/images/bbs/facebook");
} }
@Override @Override

4
designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
@ -18,7 +18,7 @@ public class NeedAction extends UpdateAction
this.setMenuKeySet(NEED); this.setMenuKeySet(NEED);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png")); this.setSmallIcon("/com/fr/design/images/bbs/need");
} }

4
designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
@ -16,7 +16,7 @@ public class QuestionAction extends UpdateAction {
this.setMenuKeySet(QUESTIONS); this.setMenuKeySet(QUESTIONS);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/question.png")); this.setSmallIcon("/com/fr/design/images/bbs/question");
} }

5
designer-base/src/main/java/com/fr/design/actions/community/SignAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -19,8 +19,7 @@ public class SignAction extends UpdateAction
this.setMenuKeySet(SIGN); this.setMenuKeySet(SIGN);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/sign.png")); this.setSmallIcon("/com/fr/design/images/bbs/sign");
} }
@Override @Override

4
designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
@ -21,7 +21,7 @@ public class TechSolutionAction extends UpdateAction{
this.setMenuKeySet(TSO); this.setMenuKeySet(TSO);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/solution.png")); this.setSmallIcon("/com/fr/design/images/bbs/solution");
} }

5
designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java

@ -1,10 +1,10 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.VideoMark; import com.fr.design.locale.impl.VideoMark;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark; import com.fr.general.locale.LocaleMark;
@ -20,8 +20,7 @@ public class VideoAction extends UpdateAction
this.setMenuKeySet(VIDEO); this.setMenuKeySet(VIDEO);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png")); this.setSmallIcon("/com/fr/design/images/bbs/video");
} }
@Override @Override

5
designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java

@ -3,7 +3,6 @@
*/ */
package com.fr.design.actions.edit; package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -22,7 +21,7 @@ public class CopyAction extends TemplateComponentAction {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy"));
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon("/com/fr/design/images/m_edit/copy");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
this.setEnabled(!DesignModeContext.isBanCopyAndCut()); this.setEnabled(!DesignModeContext.isBanCopyAndCut());
} }
@ -32,4 +31,4 @@ public class CopyAction extends TemplateComponentAction {
DesignModeContext.doCopy(getEditingComponent()); DesignModeContext.doCopy(getEditingComponent());
return false; return false;
} }
} }

5
designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java

@ -3,7 +3,6 @@
*/ */
package com.fr.design.actions.edit; package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -26,7 +25,7 @@ public class CutAction extends TemplateComponentAction {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon("/com/fr/design/images/m_edit/cut");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
this.setEnabled(!DesignModeContext.isBanCopyAndCut()); this.setEnabled(!DesignModeContext.isBanCopyAndCut());
} }
@ -35,4 +34,4 @@ public class CutAction extends TemplateComponentAction {
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
return DesignModeContext.doCut(getEditingComponent()); return DesignModeContext.doCut(getEditingComponent());
} }
} }

5
designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java

@ -3,7 +3,6 @@
*/ */
package com.fr.design.actions.edit; package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -25,7 +24,7 @@ public class PasteAction extends TemplateComponentAction {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste"));
this.setMnemonic('P'); this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); this.setSmallIcon("/com/fr/design/images/m_edit/paste");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER));
} }
@ -33,4 +32,4 @@ public class PasteAction extends TemplateComponentAction {
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
return DesignModeContext.doPaste(getEditingComponent()); return DesignModeContext.doPaste(getEditingComponent());
} }
} }

5
designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.edit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.TemplateComponentActionInterface;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -23,7 +22,7 @@ public class RedoAction extends UpdateAction implements TemplateComponentActionI
this.setMenuKeySet(KeySetUtils.REDO); this.setMenuKeySet(KeySetUtils.REDO);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/redo.png")); this.setSmallIcon("com/fr/design/images/m_edit/redo");
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
@ -56,4 +55,4 @@ public class RedoAction extends UpdateAction implements TemplateComponentActionI
} }
} }
} }

7
designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.edit;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.TemplateComponentActionInterface;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -23,10 +22,10 @@ public class UndoAction extends UpdateAction implements TemplateComponentActionI
this.setMenuKeySet(KeySetUtils.UNDO); this.setMenuKeySet(KeySetUtils.UNDO);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/undo.png")); this.setSmallIcon("/com/fr/design/images/m_edit/undo");
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
@Override @Override
public JTemplate<?, ?> getEditingComponent() { public JTemplate<?, ?> getEditingComponent() {
return t; return t;
@ -57,4 +56,4 @@ public class UndoAction extends UpdateAction implements TemplateComponentActionI
} }
} }

8
designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java

@ -5,7 +5,7 @@ package com.fr.design.actions.file;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -17,12 +17,12 @@ import com.fr.file.FILEChooserPane;
* Open Template. * Open Template.
*/ */
public class OpenTemplateAction extends UpdateAction { public class OpenTemplateAction extends UpdateAction {
public OpenTemplateAction() { public OpenTemplateAction() {
this.setMenuKeySet(KeySetUtils.OPEN_TEMPLATE); this.setMenuKeySet(KeySetUtils.OPEN_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/open.png")); this.setSmallIcon("/com/fr/design/images/buttonicon/open");
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
@ -42,4 +42,4 @@ public class OpenTemplateAction extends UpdateAction {
DesignerContext.getDesignerFrame().openTemplate(file); DesignerContext.getDesignerFrame().openTemplate(file);
} }
} }
} }

6
designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java

@ -5,7 +5,7 @@ package com.fr.design.actions.file;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -20,7 +20,7 @@ public class SaveAsTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE); this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/saveAs.png")); this.setSmallIcon("/com/fr/design/images/m_file/saveAs");
} }
/** /**
@ -45,4 +45,4 @@ public class SaveAsTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
// 另存为按钮应该一直可用使用 // 另存为按钮应该一直可用使用
this.setEnabled(true); this.setEnabled(true);
} }
} }

5
designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.file;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction; import com.fr.design.actions.JTemplateAction;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
@ -21,7 +20,7 @@ public class SaveTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
this.setMenuKeySet(KeySetUtils.SAVE_TEMPLATE); this.setMenuKeySet(KeySetUtils.SAVE_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/save.png")); this.setSmallIcon("/com/fr/design/images/m_file/save");
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }
@ -42,4 +41,4 @@ public class SaveTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
this.setEnabled(!this.getEditingComponent().isSaved()); this.setEnabled(!this.getEditingComponent().isSaved());
} }
} }

10
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -1,6 +1,6 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -21,11 +21,11 @@ public class SwitchExistEnv extends MenuDef {
initMenuDef(); initMenuDef();
} }
private void initMenuDef() { private void initMenuDef() {
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String name = nameIt.next(); String name = nameIt.next();
this.setIconPath("com/fr/design/images/m_file/switch.png"); this.setIconPath("com/fr/design/images/m_file/switch");
this.addShortCut(new GetExistEnvAction(name)); this.addShortCut(new GetExistEnvAction(name));
} }
this.addShortCut(SeparatorDef.DEFAULT); this.addShortCut(SeparatorDef.DEFAULT);
@ -42,11 +42,11 @@ public class SwitchExistEnv extends MenuDef {
DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
switch (env.getType()) { switch (env.getType()) {
case Local: { case Local: {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png")); this.setSmallIcon("com/fr/design/images/data/bind/localconnect");
break; break;
} }
case Remote: { case Remote: {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png")); this.setSmallIcon("com/fr/design/images/data/bind/distanceconnect");
break; break;
} }
} }

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

@ -1,10 +1,10 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
@ -28,7 +28,7 @@ public class TutorialAction extends UpdateAction {
this.setMenuKeySet(HELP_TUTORIAL); this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/help.png")); this.setSmallIcon("/com/fr/design/images/bbs/help");
this.setAccelerator(getMenuKeySet().getKeyStroke()); this.setAccelerator(getMenuKeySet().getKeyStroke());
} }

6
designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
@ -16,7 +16,7 @@ public class WebDemoAction extends UpdateAction {
this.setMenuKeySet(PRODUCT_DEMO); this.setMenuKeySet(PRODUCT_DEMO);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_help/demo.png")); this.setSmallIcon("/com/fr/design/images/m_help/demo");
} }
/** /**
@ -45,4 +45,4 @@ public class WebDemoAction extends UpdateAction {
} }
}; };
} }

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

@ -1,5 +1,6 @@
package com.fr.design.actions.help.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.base.svg.SVGIcon;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -8,7 +9,6 @@ import com.fr.design.dialog.DialogActionListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -21,7 +21,7 @@ public class AlphaFineAction extends UpdateAction {
this.setMenuKeySet(ALPHAFINE); this.setMenuKeySet(ALPHAFINE);
this.setName(getMenuKeySet().getMenuName()); this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); this.setSmallIcon("com/fr/design/mainframe/alphafine/images/smallsearch");
this.generateAndSetSearchText(AlphaFineConfigPane.class.getName()); this.generateAndSetSearchText(AlphaFineConfigPane.class.getName());
} }

6
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.svg.IconUtils;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionShowPane; import com.fr.design.data.datapane.connect.ConnectionShowPane;
@ -11,7 +12,6 @@ import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -26,7 +26,7 @@ public class ConnectionListAction extends UpdateAction {
this.setMenuKeySet(DEFINE_DATA_CONNECTION); this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/connection.png")); this.setSmallIcon("/com/fr/design/images/m_web/connection");
this.generateAndSetSearchText(DatabaseConnectionPane.JDBC.class.getName()); this.generateAndSetSearchText(DatabaseConnectionPane.JDBC.class.getName());
} }
@ -96,4 +96,4 @@ public class ConnectionListAction extends UpdateAction {
public void update() { public void update() {
this.setEnabled(true); this.setEnabled(true);
} }
} }

8
designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java

@ -4,6 +4,7 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.svg.IconUtils;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -12,7 +13,6 @@ import com.fr.design.formula.FunctionManagerPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.FunctionConfig; import com.fr.file.FunctionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
@ -29,7 +29,7 @@ public class FunctionManagerAction extends UpdateAction {
this.setMenuKeySet(FUNCTION_MANAGER); this.setMenuKeySet(FUNCTION_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/function.png")); this.setSmallIcon("/com/fr/design/images/m_web/function");
this.generateAndSetSearchText(FunctionManagerPane.class.getName()); this.generateAndSetSearchText(FunctionManagerPane.class.getName());
} }
@ -63,7 +63,7 @@ public class FunctionManagerAction extends UpdateAction {
functionManagerPane.populate(mirror); functionManagerPane.populate(mirror);
functionManagerDialog.setVisible(true); functionManagerDialog.setVisible(true);
} }
public void update() { public void update() {
this.setEnabled(true); this.setEnabled(true);
} }
@ -84,4 +84,4 @@ public class FunctionManagerAction extends UpdateAction {
return null; return null;
} }
}; };
} }

6
designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java

@ -3,8 +3,8 @@
*/ */
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
import com.fr.base.svg.IconUtils;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -31,7 +31,7 @@ public class GlobalParameterAction extends UpdateAction {
this.setMenuKeySet(GLOBAL_PARAMETER); this.setMenuKeySet(GLOBAL_PARAMETER);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/p.png")); this.setSmallIcon("/com/fr/design/images/m_report/p");
} }
/** /**
@ -91,4 +91,4 @@ public class GlobalParameterAction extends UpdateAction {
return null; return null;
} }
}; };
} }

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

@ -3,8 +3,8 @@
*/ */
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -40,7 +40,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
this.setMenuKeySet(SERVER_TABLEDATA); this.setMenuKeySet(SERVER_TABLEDATA);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")); this.setSmallIcon("/com/fr/design/images/data/dock/serverdatabase");
} }
public static final MenuKeySet SERVER_TABLEDATA = new MenuKeySet() { public static final MenuKeySet SERVER_TABLEDATA = new MenuKeySet() {
@ -70,7 +70,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final TableDataConfig tableDataConfig = TableDataConfig.getInstance();
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
public void complete() { public void complete() {
TableDataConfig mirror = tableDataConfig.mirror(); TableDataConfig mirror = tableDataConfig.mirror();
populate(mirror); populate(mirror);
} }
@ -166,4 +166,4 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
public void fireDSChanged(Map<String, String> map) { public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map); DesignTableDataManager.fireDSChanged(map);
} }
} }

6
designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java

@ -1,6 +1,6 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
@ -14,7 +14,7 @@ public class PlatformManagerAction extends UpdateAction {
this.setMenuKeySet(PLATEFORM_MANAGER); this.setMenuKeySet(PLATEFORM_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/platform_16_16.png")); this.setSmallIcon("/com/fr/design/images/server/platform_16_16");
} }
/** /**
@ -41,4 +41,4 @@ public class PlatformManagerAction extends UpdateAction {
return null; return null;
} }
}; };
} }

6
designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java

@ -1,9 +1,9 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.os.impl.PMDialogAction; import com.fr.design.os.impl.PMDialogAction;
import com.fr.general.IOUtils;
import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.os.support.OSSupportCenter;
@ -20,7 +20,7 @@ public class PluginManagerAction extends UpdateAction {
this.setMenuKeySet(PLUGIN_MANAGER); this.setMenuKeySet(PLUGIN_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png")); this.setSmallIcon("/com/fr/design/images/server/plugin");
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -45,4 +45,4 @@ public class PluginManagerAction extends UpdateAction {
return null; return null;
} }
}; };
} }

6
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -3,11 +3,15 @@
*/ */
package com.fr.design.constants; package com.fr.design.constants;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGIcon;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
@ -25,6 +29,7 @@ public interface UIConstants {
public static final Icon CPT_ICON = IOUtils.readIcon("/com/fr/base/images/oem/cpt.png"); public static final Icon CPT_ICON = IOUtils.readIcon("/com/fr/base/images/oem/cpt.png");
public static final Icon BLACK_ICON = IOUtils.readIcon("/com/fr/base/images/cell/blank.gif"); public static final Icon BLACK_ICON = IOUtils.readIcon("/com/fr/base/images/cell/blank.gif");
public static final String EMPTY_ICON = StringUtils.EMPTY;
public static final Image APPFIT_V0 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png"); public static final Image APPFIT_V0 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png");
public static final Image APPFIT_V1 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png"); public static final Image APPFIT_V1 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png");
@ -179,6 +184,7 @@ public interface UIConstants {
public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png"); public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png");
public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png"); public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png");
public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png"); public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png");
public static final Icon PRE_WIDGET_NORMAL_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/prewidget");
public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png"); public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png");
public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png"); public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png");
public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png"); public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png");

4
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -398,7 +398,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public PreviewTableDataAction(TableDataTree dataTree) { public PreviewTableDataAction(TableDataTree dataTree) {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"));
this.setMnemonic('p'); this.setMnemonic('p');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.PREVIEW_ICON_PATH)); this.setSmallIcon("/com/fr/design/images/m_file/preview");
this.dataTree = dataTree; this.dataTree = dataTree;
} }
@ -437,7 +437,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public ConnectionTableAction() { public ConnectionTableAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection"));
this.setMnemonic('D'); this.setMnemonic('D');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH)); this.setSmallIcon("/com/fr/design/images/m_web/connection");
} }
} }

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

@ -18,8 +18,6 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -28,7 +26,6 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
@ -97,7 +94,6 @@ public class TableDataTreePane extends BasicTableDataTreePane {
addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH);
createAddMenuDef(); createAddMenuDef();
// 创建插件监听 // 创建插件监听
createPluginListener(); createPluginListener();
@ -160,34 +156,6 @@ public class TableDataTreePane extends BasicTableDataTreePane {
return context.contain(PluginModule.ExtraDesign); return context.contain(PluginModule.ExtraDesign);
} }
}); });
//监听数据集插件
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//REPORT-25577
//如果数据集插件禁用或启用。需要清空当前模板中的缓存
reloadCurrTemplate();
}
private void reloadCurrTemplate() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (accept(jt)) {
jt.refreshResource();
}
}
private boolean accept(JTemplate<?, ?> jt) {
return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext pluginContext) {
return pluginContext.contain(TableDataDefineProvider.XML_TAG);
}
});
} }
@ -279,7 +247,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public EditAction() { public EditAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
this.setMnemonic('E'); this.setMnemonic('E');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)); this.setSmallIcon("/com/fr/design/images/control/edit");
} }
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -297,7 +265,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public RemoveAction() { public RemoveAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"));
this.setMnemonic('R'); this.setMnemonic('R');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); this.setSmallIcon("/com/fr/design/images/control/remove");
} }
@Override @Override

195
designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java

File diff suppressed because one or more lines are too long

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -41,7 +41,7 @@ import java.util.Map.Entry;
public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData> { public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData> {
private static final int MAX_LENTH_OF_DATASET = 143; //关联数据集面板最大显示的数据集长度,超出这个长度显示数据集名称+“...” private static final int MAX_LENTH_OF_DATASET = 130; //关联数据集面板最大显示的数据集长度,超出这个长度显示数据集名称+“...”
private static final int MIN_BAR_NUMBER = 10; private static final int MIN_BAR_NUMBER = 10;
private static final int SUB_LENGTH = 4; private static final int SUB_LENGTH = 4;
private JPanel centerPanel; private JPanel centerPanel;

4
designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java

@ -99,6 +99,10 @@ public class FormulaEditor extends Editor<BaseFormula> {
return formula; return formula;
} }
public UITextField getUITextField() {
return currentTextField;
}
/** /**
* Return the value of the CellEditor. * Return the value of the CellEditor.
*/ */

50
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -18,6 +18,7 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.context.PluginMarkerAdapter;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginControllerHelper; import com.fr.plugin.manage.control.PluginControllerHelper;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
@ -26,7 +27,8 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.util.List; import java.util.List;
@ -38,11 +40,23 @@ import java.util.List;
public class PluginOperateUtils { public class PluginOperateUtils {
public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) {
PluginMarker marker = updateMarker2Online(pluginMarker);
//下载插件 //下载插件
PluginTask pluginTask = PluginTask.installTask(pluginMarker); PluginTask pluginTask = PluginTask.installTask(marker);
PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback)); PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback));
} }
public static PluginMarker updateMarker2Online(PluginMarker pluginMarker) {
try {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID());
String pluginName = latestPluginInfo.getString("name");
return PluginMarkerAdapter.create(pluginMarker, pluginName);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return pluginMarker;
}
public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) { public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) {
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
} }
@ -57,10 +71,11 @@ public class PluginOperateUtils {
public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) { public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) {
try { try {
JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID()); JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID());
String latestPluginVersion = (String) latestPluginInfo.get("version"); String latestPluginVersion = latestPluginInfo.getString("version");
PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion); String pluginName = latestPluginInfo.getString("name");
PluginMarker toPluginMarker = PluginMarkerAdapter.create(pluginMarker.getPluginID(), latestPluginVersion, pluginName);
//当前已经安装的相同ID插件marker //当前已经安装的相同ID插件marker
PluginMarker currentMarker = PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()); PluginMarker currentMarker = PluginMarkerAdapter.create(PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()), pluginName);
PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker); PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker);
PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback)); PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback));
} catch (Exception e) { } catch (Exception e) {
@ -128,6 +143,10 @@ public class PluginOperateUtils {
} }
public static void dealParams(StringBuilder url, String category, String seller, String fee, String scope) { public static void dealParams(StringBuilder url, String category, String seller, String fee, String scope) {
dealParams(url, category, seller, fee, StringUtils.EMPTY);
}
public static void dealParams(StringBuilder url, String category, String seller, String fee, String scope, String language) {
if (StringUtils.isNotBlank(category)) { if (StringUtils.isNotBlank(category)) {
url.append("cid=").append(category.split("-")[1]); url.append("cid=").append(category.split("-")[1]);
} else { } else {
@ -169,6 +188,9 @@ public class PluginOperateUtils {
url.append("&scope=").append(StringUtils.EMPTY); url.append("&scope=").append(StringUtils.EMPTY);
} }
} }
if (StringUtils.isNotBlank(language)) {
url.append("&language=").append(language.split("-")[1]);
}
} }
public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) {
@ -203,16 +225,22 @@ public class PluginOperateUtils {
continue; continue;
} }
PluginMarker pluginMarker = pluginTask.getToMarker(); PluginMarker pluginMarker = pluginTask.getToMarker();
PluginContext pluginContext = PluginManager.getContext(pluginMarker); PluginContext pluginContext = PluginManager.getContext(pluginMarker.getPluginID());
if (pluginContext != null) { pluginInfo.append(getPluginName(pluginContext, pluginMarker)).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode()));
pluginInfo.append(pluginContext.getName()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode()));
} else {
pluginInfo.append(pluginMarker.getPluginID()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode()));
}
} }
return pluginInfo.toString(); return pluginInfo.toString();
} }
private static String getPluginName(PluginContext pluginContext, PluginMarker pluginMarker) {
if (pluginContext != null) {
return pluginContext.getName();
}
else if (pluginMarker instanceof PluginMarkerAdapter) {
return ((PluginMarkerAdapter) pluginMarker).getPluginName();
}
return pluginMarker == null ? StringUtils.EMPTY : pluginMarker.getPluginID();
}
public static String getSwitchedInfo(PluginTaskResult result) { public static String getSwitchedInfo(PluginTaskResult result) {
StringBuilder pluginInfo = new StringBuilder(); StringBuilder pluginInfo = new StringBuilder();
List<PluginTaskResult> pluginTaskResults = result.asList(); List<PluginTaskResult> pluginTaskResults = result.asList();

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

@ -10,6 +10,7 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.plugin.basic.version.Version; import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalType;
import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;

11
designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -21,19 +21,26 @@ public class GetPluginFromStoreExecutor implements Executor {
private String seller; private String seller;
private String fee; private String fee;
private String scope; private String scope;
private String language;
public GetPluginFromStoreExecutor(JSONObject info) { public GetPluginFromStoreExecutor(JSONObject info) {
this.category = info.optString("categories"); this.category = info.optString("categories");
this.fee = info.optString("fee"); this.fee = info.optString("fee");
this.seller = info.optString("seller"); this.seller = info.optString("seller");
this.scope = info.optString("scope"); this.scope = info.optString("scope");
this.language = info.optString("language");
} }
public GetPluginFromStoreExecutor(String category, String seller, String fee, String scope) { public GetPluginFromStoreExecutor(String category, String seller, String fee, String scope) {
this(category, seller, fee, scope, StringUtils.EMPTY);
}
public GetPluginFromStoreExecutor(String category, String seller, String fee, String scope, String language) {
this.category = category; this.category = category;
this.seller = seller; this.seller = seller;
this.fee = fee; this.fee = fee;
this.scope = scope; this.scope = scope;
this.language = language;
} }
@Override @Override
@ -53,7 +60,7 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override @Override
public void run(Process<String> process) { public void run(Process<String> process) {
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist"); String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist");
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope); boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope) & StringUtils.isEmpty(language);
if (getRecommend) { if (getRecommend) {
result = PluginOperateUtils.getRecommendPlugins(); result = PluginOperateUtils.getRecommendPlugins();
return; return;
@ -62,7 +69,7 @@ public class GetPluginFromStoreExecutor implements Executor {
if (StringUtils.isNotBlank(plistUrl)) { if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder(); StringBuilder url = new StringBuilder();
url.append(plistUrl).append("?"); url.append(plistUrl).append("?");
PluginOperateUtils.dealParams(url, category, seller, fee, scope); PluginOperateUtils.dealParams(url, category, seller, fee, scope, language);
try { try {
HttpClient httpClient = new HttpClient(url.toString()); HttpClient httpClient = new HttpClient(url.toString());
httpClient.asGet(); httpClient.asGet();

32
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -3,7 +3,7 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -12,7 +12,6 @@ import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -41,20 +40,21 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) { if (result.isSuccess()) {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result); String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo;
FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog( int rv = FineJOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, FineJOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, FineJOptionPane.INFORMATION_MESSAGE,
null, null,
FineJOptionPane.OPTION_YES_NO_CANCEL, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return; return;
} }
List<PluginTask> pluginTasks = result.getPreTasks(); List<PluginTask> pluginTasks = result.getPreTasks();
@ -64,24 +64,24 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
} }
PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback));
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog( int rv = FineJOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, FineJOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, FineJOptionPane.INFORMATION_MESSAGE,
null, null,
FineJOptionPane.OPTION_YES_NO_CANCEL, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return; return;
} }
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
} }
} }
} }

27
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -3,6 +3,7 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -11,8 +12,6 @@ import com.fr.plugin.manage.control.AbstractDealPreTaskCallback;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
/** /**
* Created by ibm on 2017/5/26. * Created by ibm on 2017/5/26.
@ -38,28 +37,30 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
if (result.isSuccess()) { if (result.isSuccess()) {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result); String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo;
FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog( int rv = FineJOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, FineJOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, FineJOptionPane.INFORMATION_MESSAGE,
null, null,
FineJOptionPane.OPTION_YES_NO_CANCEL, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
jsCallback.execute("success");
return; return;
} }
PluginMarker pluginMarker = result.getCurrentTask().getMarker(); PluginMarker pluginMarker = result.getCurrentTask().getMarker();
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
} }
} }

14
designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java

@ -2,12 +2,14 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*; import javax.swing.JOptionPane;
/** /**
* Created by ibm on 2017/5/27. * Created by ibm on 2017/5/27.
@ -22,12 +24,16 @@ public class ModifyStatusCallback implements PluginTaskCallback{
} }
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); String modifyMessage = isActive ?
pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") :
pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate");
FineLoggerFactory.getLogger().info(modifyMessage);
FineJOptionPane.showMessageDialog(null, modifyMessage); FineJOptionPane.showMessageDialog(null, modifyMessage);
} else { } else {
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

27
designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java

@ -2,7 +2,8 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -10,8 +11,6 @@ import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
/** /**
* Created by ibm on 2017/5/27. * Created by ibm on 2017/5/27.
*/ */
@ -25,29 +24,31 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success")); String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success");
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success")); FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
}else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) {
int rv = JOptionPane.showOptionDialog( int rv = FineJOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, FineJOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, FineJOptionPane.INFORMATION_MESSAGE,
null, null,
FineJOptionPane.OPTION_YES_NO_CANCEL, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return; return;
} }
PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback));
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed"));
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
} }
} }
} }

37
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -3,7 +3,7 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -12,7 +12,6 @@ import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -37,22 +36,24 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success");
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog( int rv = FineJOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, FineJOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, FineJOptionPane.INFORMATION_MESSAGE,
null, null,
FineJOptionPane.OPTION_YES_NO_CANCEL, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return; return;
} }
List<PluginTask> pluginTasks = result.getPreTasks(); List<PluginTask> pluginTasks = result.getPreTasks();
@ -62,24 +63,24 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
} }
PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback));
} else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){ } else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){
int rv = JOptionPane.showOptionDialog( int rv = FineJOptionPane.showOptionDialog(
null, null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"), Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION, FineJOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, FineJOptionPane.INFORMATION_MESSAGE,
null, null,
FineJOptionPane.OPTION_YES_NO_CANCEL, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) {
return; return;
} }
PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
} }
} }
} }

12
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

@ -3,14 +3,13 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.manage.control.AbstractDealPreTaskCallback; import com.fr.plugin.manage.control.AbstractDealPreTaskCallback;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import javax.swing.*;
/** /**
* Created by ibm on 2017/5/26. * Created by ibm on 2017/5/26.
*/ */
@ -33,12 +32,13 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result); String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success");
FineJOptionPane.showMessageDialog(null,pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); FineLoggerFactory.getLogger().info(successInfo);
FineJOptionPane.showMessageDialog(null, successInfo);
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE);
} }
} }
} }

109
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -2,15 +2,14 @@ package com.fr.design.file;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.filter.ClassFilter;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateFactory;
import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
@ -18,12 +17,14 @@ import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.StashedFILE; import com.fr.file.StashedFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.invoke.ClassHelper;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginManager;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.third.org.apache.commons.io.FilenameUtils;
import javax.swing.SwingUtilities;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -31,6 +32,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 历史模板缓存 * 历史模板缓存
@ -372,7 +374,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/ */
public void load() { public void load() {
FineLoggerFactory.getLogger().info("Env Change Template Loading..."); FineLoggerFactory.getLogger().info("Env Change Template Loading...");
JTemplate currentTemplate = null;
if (stashFILEMap != null && stashFILEMap.size() != 0) { if (stashFILEMap != null && stashFILEMap.size() != 0) {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -383,32 +384,14 @@ public class HistoryTemplateListCache implements CallbackEvent {
if (stashedFile == null) { if (stashedFile == null) {
continue; continue;
} }
JTemplate<?, ?> template = JTemplateFactory.createJTemplate(stashedFile); FineLoggerFactory.getLogger().info("{} is being reloaded", stashedFile.getName());
if (template != null) { JTemplate<?, ?> template = historyList.get(i);
historyList.set(i, template); template.refreshResource(stashedFile);
// 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件
if (isCurrentEditingFile(template.getPath())) {
currentTemplate = template;
}
} else {
// 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取
JTemplate jt = historyList.get(i);
// 另外如果该模板是正在编辑的模板,需要要激活
if (jt != null && isCurrentEditingFile(jt.getPath())) {
currentTemplate = jt;
}
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
// 最后加载当前正在编辑的模板 以保证数据集刷新正常
if (currentTemplate != null) {
loadCurrentTemplate(currentTemplate);
}
stashFILEMap.clear(); stashFILEMap.clear();
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MutilTempalteTabPane.getInstance().repaint();
} }
FineLoggerFactory.getLogger().info("Env Change Template Loaded."); FineLoggerFactory.getLogger().info("Env Change Template Loaded.");
} }
@ -422,12 +405,9 @@ public class HistoryTemplateListCache implements CallbackEvent {
/** /**
* 重新载入当前模板刷新数据/对象 * 重新载入当前模板刷新数据/对象
*/ */
@Deprecated
public void reloadCurrentTemplate() { public void reloadCurrentTemplate() {
JTemplate<?, ?> jt = getCurrentEditingTemplate(); reloadAllEditingTemplate();
boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
if (access) {
jt.refreshResource();
}
} }
/** /**
@ -441,4 +421,73 @@ public class HistoryTemplateListCache implements CallbackEvent {
} }
}); });
} }
/**
* 插件安装后/启用 重新加载模板资源
*/
private void _reloadAllEditingTemplate(PluginContext context) {
FineLoggerFactory.getLogger().info("Plugin env change reload all template started");
long start = System.currentTimeMillis();
int size = historyList.size();
for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i);
FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BaseBook target = template.getTarget();
if (target != null) {
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
target.export(outputStream);
FILE stashedFile = new StashedFILE(file, outputStream.toByteArray());
template.refreshResource(stashedFile);
}
// 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
FineLoggerFactory.getLogger().info("Plugin env change reload all template ended");
FineLoggerFactory.getLogger().info("Reload all template spend: {} ms", (System.currentTimeMillis() - start));
}
/**
* 根据具体插件来刷新模板
* @param context
*/
public void reloadAllEditingTemplateByPlugin(PluginContext context) {
_reloadAllEditingTemplate(context);
}
/**
* 直接刷新所以模板
*/
public void reloadAllEditingTemplate() {
_reloadAllEditingTemplate(null);
}
private boolean needReloadTemplate(PluginContext context, JTemplate<?, ?> template) {
BaseBook baseBook = template.getTarget();
if (baseBook != null) {
String name = template.getEditingFILE().getName();
String pluginId = context.getID();
long start = System.currentTimeMillis();
Set<ClassLoader> set = ClassHelper.getClassLoadersByFilter(baseBook, ClassFilter.getInstance());
FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start));
if (set != null) {
for (ClassLoader classLoader : set) {
if (ComparatorUtils.equals(pluginId, PluginManager.detectLeakingPlugin(classLoader))) {
return true;
}
}
} else {
// set为null说明 检测classloader 这里返回true直接刷新 兜底行为
return true;
}
}
return false;
}
} }

8
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -11,6 +11,7 @@ import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
@ -18,8 +19,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.third.javax.annotation.Nonnull; import com.fr.third.javax.annotation.Nonnull;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonModel; import javax.swing.ButtonModel;
@ -37,7 +36,6 @@ import java.awt.AlphaComposite;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint; import java.awt.GradientPaint;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -138,7 +136,7 @@ public class MutilTempalteTabPane extends JComponent {
this.addMouseMotionListener(new MultiTemplateTabMouseMotionListener()); this.addMouseMotionListener(new MultiTemplateTabMouseMotionListener());
this.setBorder(null); this.setBorder(null);
this.setForeground(new Color(58, 56, 58)); this.setForeground(new Color(58, 56, 58));
this.setFont(new Font(Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"), 0, 12)); this.setFont(DesignUtils.getDefaultGUIFont().applySize(12));
openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList(); openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
selectedIndex = openedTemplate.size() - 1; selectedIndex = openedTemplate.size() - 1;
AWTEventListener awt = new AWTEventListener() { AWTEventListener awt = new AWTEventListener() {
@ -707,7 +705,7 @@ public class MutilTempalteTabPane extends JComponent {
// 只有是环境内的文件,才执行释放锁 // 只有是环境内的文件,才执行释放锁
if (file != null && file.isEnvFile()) { if (file != null && file.isEnvFile()) {
// release lock // release lock
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); TemplateResourceManager.getResource().closeTemplate(file.getPath());
} }
} }

71
designer-base/src/main/java/com/fr/design/file/TemplateResource.java

@ -0,0 +1,71 @@
package com.fr.design.file;
import com.fr.common.annotations.Open;
import com.fr.file.FILE;
import java.io.InputStream;
import java.io.OutputStream;
/**
* 模板资源操作可操作模板及模板目录
*
* @author hades
* @version 10.0
* Created by hades on 2020/12/23
*/
@Open
public interface TemplateResource {
/**
* 读取模板
* @param path
* @return
* @throws Exception
*/
InputStream readTemplate(String path) throws Exception;
/**
* 保存模板
* @param file
* @return
* @throws Exception
*/
OutputStream saveTemplate(FILE file) throws Exception;
/**
* 删除某个目录/某个模板
* @param file
* @return
*/
boolean delete(FILE file);
/**
* 关闭模板
* @param path
* @return
*/
boolean closeTemplate(String path);
/**
* 重命名模板/目录
* @param from
* @param to
* @return
*/
boolean rename(String from, String to);
/**
* 模板/目录是否存在
* @param path
* @return
*/
boolean exist(String path);
/**
* 创建目录
* @param path
* @return
*/
boolean mkdir(String path);
}

66
designer-base/src/main/java/com/fr/design/file/TemplateResourceManager.java

@ -0,0 +1,66 @@
package com.fr.design.file;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.file.impl.DefaultTemplateResource;
import com.fr.design.fun.LocalResourceProvider;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.ui.util.UIUtil;
import com.fr.file.filetree.FileNodes;
import com.fr.file.filetree.LocalFileNodes;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.workspace.WorkContext;
import com.fr.workspace.engine.base.FineObjectPool;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/23
*/
public class TemplateResourceManager {
private static final TemplateResource DEFAULT_OPERATION = new DefaultTemplateResource();
private static TemplateResource OPERATION = DEFAULT_OPERATION;
static {
PluginFilter filter = pluginContext -> pluginContext.contain(PluginModule.ExtraDesign, LocalResourceProvider.XML_TAG);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterStop, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
registerOperation(new DefaultTemplateResource());
FineObjectPool.getInstance().getLocalPool().put(FileNodes.class, new LocalFileNodes());
UIUtil.invokeLaterIfNeeded(() -> DesignerFrameFileDealerPane.getInstance().refresh());
}
}, filter);
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
LocalResourceProvider provider = ExtraDesignClassManager.getInstance().getSingle(LocalResourceProvider.XML_TAG);
if (provider != null && WorkContext.getCurrent().isLocal()) {
registerOperation(provider.createResourceOperation());
FineObjectPool.getInstance().getLocalPool().put(FileNodes.class, provider.createFileNodes());
UIUtil.invokeLaterIfNeeded(() -> DesignerFrameFileDealerPane.getInstance().refresh());
}
}
}, filter);
}
private static void registerOperation(TemplateResource operation) {
OPERATION = operation;
}
public static TemplateResource getResource() {
if (OPERATION == null) {
return DEFAULT_OPERATION;
}
return OPERATION;
}
}

21
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -4,7 +4,9 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.TemplateTreeDefineProcessor;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
@ -23,12 +25,11 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager; import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
@ -87,6 +88,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
} }
} }
@Override
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
TemplateTreeDefineProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TemplateTreeDefineProcessor.XML_TAG);
if (processor != null) {
processor.rightClickAction(e);
}
}
}
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
if (toolBarStateChangeListener != null) { if (toolBarStateChangeListener != null) {
@ -182,7 +193,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
@Override @Override
public boolean mkdir(String path) { public boolean mkdir(String path) {
return WorkContext.getWorkResource().createDirectory(path); return TemplateResourceManager.getResource().mkdir(path);
} }
/** /**
@ -325,7 +336,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (node instanceof FileNode) { if (node instanceof FileNode) {
FileNodeFILE nodeFILE = new FileNodeFILE((FileNode) node); FileNodeFILE nodeFILE = new FileNodeFILE((FileNode) node);
if (nodeFILE.exists()) { if (nodeFILE.exists()) {
if (WorkContext.getCurrent().get(TplOperator.class).delete(nodeFILE.getPath())) { if (TemplateResourceManager.getResource().delete(nodeFILE)) {
HistoryTemplateListCache.getInstance().deleteFile(nodeFILE); HistoryTemplateListCache.getInstance().deleteFile(nodeFILE);
} else { } else {
success = false; success = false;
@ -427,7 +438,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
try { try {
// 接收的是WEB-INF下的路径 // 接收的是WEB-INF下的路径
return WorkContext.getCurrent().get(TplOperator.class).rename(from, to); return TemplateResourceManager.getResource().rename(from, to);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;

34
designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java

@ -0,0 +1,34 @@
package com.fr.design.file.filter;
import com.fr.stable.Filter;
import java.util.HashSet;
import java.util.Set;
/**
* 过滤无需遍历的jdk class
*
* @author hades
* @version 10.0
* Created by hades on 2021/1/7
*/
public class ClassFilter implements Filter<String> {
private static final Set<String> FILTER_SET = new HashSet<>();
private static final Filter<String> INSTANCE = new ClassFilter();
public static Filter<String> getInstance() {
return INSTANCE;
}
static {
FILTER_SET.add("java.awt.image.BufferedImage");
FILTER_SET.add("sun.awt.AppContext");
}
@Override
public boolean accept(String s) {
return FILTER_SET.contains(s);
}
}

19
designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java

@ -0,0 +1,19 @@
package com.fr.design.file.impl;
import com.fr.design.file.TemplateResource;
import com.fr.file.FILE;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/23
*/
public abstract class AbstractTemplateResource implements TemplateResource {
}

52
designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java

@ -0,0 +1,52 @@
package com.fr.design.file.impl;
import com.fr.file.FILE;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/23
*/
public class DefaultTemplateResource extends AbstractTemplateResource {
@Override
public InputStream readTemplate(String path) throws Exception {
return new ByteArrayInputStream(WorkContext.getCurrent().get(TplOperator.class).readAndLockFile(path));
}
@Override
public OutputStream saveTemplate(FILE file) throws Exception {
return file.asOutputStream();
}
@Override
public boolean closeTemplate(String path) {
return WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path);
}
@Override
public boolean delete(FILE file) {
return WorkContext.getCurrent().get(TplOperator.class).delete(file.getPath());
}
@Override
public boolean rename(String from, String to) {
return WorkContext.getCurrent().get(TplOperator.class).rename(from, to);
}
@Override
public boolean exist(String path) {
return WorkContext.getWorkResource().exist(path);
}
@Override
public boolean mkdir(String path) {
return WorkContext.getWorkResource().createDirectory(path);
}
}

8
designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java

@ -23,4 +23,12 @@ public interface FormWidgetOptionProvider extends ParameterWidgetOptionProvider
*/ */
<T> void paste2Container(T t); <T> void paste2Container(T t);
/**
* 往扩展容器本身中添加粘贴内容
* @param r
* @param <T> 粘贴板选中的组件
* @param <R> 容器布局适配器
*/
<T, R> void formWidgetPaste(T t, R r, int x, int y);
} }

34
designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.file.TemplateResource;
import com.fr.file.filetree.FileNodes;
import com.fr.stable.fun.mark.Immutable;
/**
* 本地资源操作插件接口
*
* @author hades
* @version 10.0
* Created by hades on 2020/12/22
*/
public interface LocalResourceProvider extends Immutable {
String XML_TAG = "LocalResourceProvider";
int CURRENT_LEVEL = 1;
/**
* eg: DefaultResourceOperation
*
* @return 目录/模板的各种操作
*/
TemplateResource createResourceOperation();
/**
* eg: LocalFileNodes
*
* @return 构建目录树的方式
*/
FileNodes createFileNodes();
}

37
designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java

@ -0,0 +1,37 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/30
*/
public interface MobileParamUIProvider extends Mutable {
String XML_TAG = "MobileParamUIProvider";
int CURRENT_LEVEL = 1;
/**
* 扩展项的参数面板样式
* @return
*/
Class<? extends MobileParamStyle> classForMobileParamStyle();
/**
* 移动端参数面板中扩展项的面板
* @return
*/
Class<? extends BasicBeanPane<? extends MobileParamStyle>> classForMobileParamAppearance();
/**
* 扩展项的名称描述
* @return
*/
String displayName();
}

19
designer-base/src/main/java/com/fr/design/fun/TemplateTreeDefineProcessor.java

@ -0,0 +1,19 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Immutable;
import java.awt.event.MouseEvent;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/14
*/
public interface TemplateTreeDefineProcessor extends Immutable {
String XML_TAG = "TemplateTreeDefineProcessor";
int CURRENT_LEVEL = 1;
void rightClickAction(MouseEvent mouseEvent);
}

5
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java

@ -30,4 +30,9 @@ public abstract class AbstractFormWidgetOptionProvider extends AbstractProvider
public <T> void paste2Container(T t) { public <T> void paste2Container(T t) {
// do nothing // do nothing
} }
@Override
public <T, R> void formWidgetPaste(T t, R r, int x, int y) {
// do nothing
}
} }

23
designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.LocalResourceProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/22
*/
@API(level = LocalResourceProvider.CURRENT_LEVEL)
public abstract class AbstractLocalResourceProvider implements LocalResourceProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileParamUIProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/30
*/
@API(level = MobileParamUIProvider.CURRENT_LEVEL)
public abstract class AbstractMobileParamUIProvider extends AbstractProvider implements MobileParamUIProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TemplateTreeDefineProcessor;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/21
*/
@API(level = TemplateTreeDefineProcessor.CURRENT_LEVEL)
public abstract class AbstractTemplateTreeDefineProcessor implements TemplateTreeDefineProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

31
designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java

@ -1,6 +1,7 @@
package com.fr.design.gui.core; package com.fr.design.gui.core;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.*; import com.fr.form.ui.*;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -127,27 +128,27 @@ public abstract class WidgetOption implements Serializable {
} }
public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"), public static final WidgetOption DATEEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Date"),
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16.png"), "/com/fr/design/images/buttonicon/widget/date_16",
DateEditor.class); DateEditor.class);
public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"), public static final WidgetOption TREE = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_View_Tree"),
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/tree_16.png"), TreeEditor.class); "/com/fr/design/images/buttonicon/widget/tree_16", TreeEditor.class);
public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/comboboxtree.png"), public static final WidgetOption TREECOMBOBOX = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Tree_ComboBox"), "/com/fr/design/images/buttonicon/widget/comboboxtree16",
TreeComboBoxEditor.class); TreeComboBoxEditor.class);
public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption CHECKBOXGROUP = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/checkbox_group_16.png"), CheckBoxGroup.class); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox_Group"), "/com/fr/design/images/buttonicon/widget/checkbox_group_16", CheckBoxGroup.class);
public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption RADIOGROUP = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_group_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Radio_Group"), "/com/fr/design/images/buttonicon/widget/button_group_16",
RadioGroup.class); RadioGroup.class);
public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption NUMBEREDITOR = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/number_field_16.png"), NumberEditor.class); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Number"), "/com/fr/design/images/buttonicon/widget/number_field_16", NumberEditor.class);
public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption LABEL = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/label_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Label"), "/com/fr/design/images/buttonicon/widget/label_16",
Label.class); Label.class);
public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass(
@ -155,23 +156,23 @@ public abstract class WidgetOption implements Serializable {
Button.class); Button.class);
public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption FREEBUTTON = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/button_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Button"), "/com/fr/design/images/buttonicon/widget/button_16",
FreeButton.class); FreeButton.class);
public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption MULTI_FILEEDITOR = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/files_up.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_File"), "/com/fr/design/images/buttonicon/widget/files_up",
MultiFileEditor.class); MultiFileEditor.class);
public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption COMBOBOX = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_box_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Box"), "/com/fr/design/images/buttonicon/widget/combo_box_16",
ComboBox.class); ComboBox.class);
public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption COMBOCHECKBOX = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/combo_check_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Combo_Checkbox"), "/com/fr/design/images/buttonicon/widget/combo_check_16",
ComboCheckBox.class); ComboCheckBox.class);
public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption CHECKBOX = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/check_box_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Checkbox"), "/com/fr/design/images/buttonicon/widget/check_box_16",
CheckBox.class); CheckBox.class);
public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass(
@ -181,16 +182,16 @@ public abstract class WidgetOption implements Serializable {
public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Text")
, BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_field_16.png"), , "/com/fr/design/images/buttonicon/widget/text_field_16",
TextEditor.class); TextEditor.class);
public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption TEXTAREA = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/text_area_16.png"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Textarea"), "/com/fr/design/images/buttonicon/widget/text_area_16",
TextArea.class); TextArea.class);
public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass( public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Type_Password"),
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/password_field_16.png"), Password.class); "/com/fr/design/images/buttonicon/widget/password_field_16", Password.class);
public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"), public static final WidgetOption IFRAMEDITOR = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Form_Iframe"), BaseUtils.readIcon("/com/fr/web/images/form/resources/iframe_16.png"),
IframeEditor.class); IframeEditor.class);

8
designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java

@ -1,6 +1,7 @@
package com.fr.design.gui.core; package com.fr.design.gui.core;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import javax.swing.*; import javax.swing.*;
@ -14,4 +15,9 @@ public class WidgetOptionFactory {
public static WidgetOption createByWidgetClass(String optionName, Icon optionIcon, Class<? extends Widget> widgetClass) { public static WidgetOption createByWidgetClass(String optionName, Icon optionIcon, Class<? extends Widget> widgetClass) {
return new CustomWidgetOption(optionName, optionIcon, widgetClass); return new CustomWidgetOption(optionName, optionIcon, widgetClass);
} }
}
public static WidgetOption createByWidgetClass(String optionName, String resource, Class<? extends Widget> widgetClass) {
Icon optionIcon = IconUtils.readIcon(resource);
return new CustomWidgetOption(optionName, optionIcon, widgetClass);
}
}

22
designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java

@ -1,12 +1,14 @@
package com.fr.design.gui.date; package com.fr.design.gui.date;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.DesignUtils;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument; import javax.swing.text.PlainDocument;
import java.awt.*; import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
@ -21,7 +23,7 @@ public class CalendarNumberField extends UINumberField {
private static final int NUM_TEN = 10; private static final int NUM_TEN = 10;
public CalendarNumberField( double maxValue) { public CalendarNumberField(double maxValue) {
super(2, 0, 0, maxValue); super(2, 0, 0, maxValue);
this.setBorderPainted(false); this.setBorderPainted(false);
addFocusListener(new FocusAdapter() { addFocusListener(new FocusAdapter() {
@ -30,12 +32,12 @@ public class CalendarNumberField extends UINumberField {
setValue(getIntValue()); setValue(getIntValue());
} }
}); });
this.setFont(new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"),0,12)); this.setFont(DesignUtils.getDefaultGUIFont());
} }
public void setValue(int value) { public void setValue(int value) {
if (value < 0) { if (value < 0) {
value = (int)getMaxValue(); value = (int) getMaxValue();
} }
if (value > getMaxValue()) { if (value > getMaxValue()) {
value = 0; value = 0;
@ -43,7 +45,7 @@ public class CalendarNumberField extends UINumberField {
this.setText(getValueText(value)); this.setText(getValueText(value));
} }
public int getIntValue () { public int getIntValue() {
if (this.getText().length() == 0) { if (this.getText().length() == 0) {
return 0; return 0;
} }
@ -61,8 +63,7 @@ public class CalendarNumberField extends UINumberField {
} }
public void setFieldDocument() {
public void setFieldDocument(){
setDocument(new NumberDocument()); setDocument(new NumberDocument());
} }
@ -89,14 +90,15 @@ public class CalendarNumberField extends UINumberField {
super.insertString(offset, s, a); super.insertString(offset, s, a);
} }
private boolean isOverMaxOrMinValue( String strNew) { private boolean isOverMaxOrMinValue(String strNew) {
return (Double.parseDouble(strNew)<getMinValue() || Double.parseDouble(strNew)>getMaxValue()); return (Double.parseDouble(strNew) < getMinValue() || Double.parseDouble(strNew) > getMaxValue());
} }
} }
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(24, 11); return new Dimension(24, 11);
} }
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }

123
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -7,8 +7,8 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -45,8 +45,8 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
public class UICalendarPanel extends JPanel { public class UICalendarPanel extends JPanel {
private static final Font FONT_SONG = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"),0,12); private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(12);
private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"),0,12); private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, 12);
private static final int WEEKDAY_COUNT = 7; private static final int WEEKDAY_COUNT = 7;
private static final int TOTAL_DAYS_COUNT = 42; private static final int TOTAL_DAYS_COUNT = 42;
@ -108,13 +108,13 @@ public class UICalendarPanel extends JPanel {
} }
// << < yyyy/MM/dd > >> // << < yyyy/MM/dd > >>
private JPanel createNorthPane () { private JPanel createNorthPane() {
JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
pNorth.setBackground(new Color(0xFFFFFF)); pNorth.setBackground(new Color(0xFFFFFF));
pNorth.setPreferredSize(new Dimension(1, 22)); pNorth.setPreferredSize(new Dimension(1, 22));
pNorth.add(Box.createHorizontalStrut(5)); pNorth.add(Box.createHorizontalStrut(5));
pNorth.add(createSkipButton(Calendar.YEAR, -1 , new Icon[] { pNorth.add(createSkipButton(Calendar.YEAR, -1, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_hover.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_hover.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_click.png") BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_click.png")
@ -130,7 +130,7 @@ public class UICalendarPanel extends JPanel {
monthLabel = new UILabel("", UILabel.CENTER); monthLabel = new UILabel("", UILabel.CENTER);
monthLabel.setBackground(new Color(0xFFFFFF)); monthLabel.setBackground(new Color(0xFFFFFF));
monthLabel.setForeground(new Color(0x000000)); monthLabel.setForeground(new Color(0x000000));
monthLabel.setFont(FONT_SONG); monthLabel.setFont(FONT_UI);
pNorth.add(Box.createHorizontalGlue()); pNorth.add(Box.createHorizontalGlue());
pNorth.add(monthLabel); pNorth.add(monthLabel);
pNorth.add(Box.createHorizontalGlue()); pNorth.add(Box.createHorizontalGlue());
@ -144,7 +144,7 @@ public class UICalendarPanel extends JPanel {
monthPlus.setHorizontalAlignment(SwingConstants.RIGHT); monthPlus.setHorizontalAlignment(SwingConstants.RIGHT);
pNorth.add(monthPlus); pNorth.add(monthPlus);
pNorth.add(Box.createHorizontalStrut(11)); pNorth.add(Box.createHorizontalStrut(11));
pNorth.add(createSkipButton(Calendar.YEAR, 1 , new Icon[] { pNorth.add(createSkipButton(Calendar.YEAR, 1, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/calender/year_add.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_add.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_add_hover.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_add_hover.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/year_add_click.png") BaseUtils.readIcon("/com/fr/design/images/calender/year_add_click.png")
@ -161,9 +161,9 @@ public class UICalendarPanel extends JPanel {
pWeeks.setPreferredSize(new Dimension(216, 22)); pWeeks.setPreferredSize(new Dimension(216, 22));
pWeeks.setBackground(new Color(0xFFFFFF)); pWeeks.setBackground(new Color(0xFFFFFF));
pWeeks.setOpaque(true); pWeeks.setOpaque(true);
String[] strWeeks = new String[] {StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"), String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat")
}; };
for (int i = 1; i <= WEEKDAY_COUNT; i++) { for (int i = 1; i <= WEEKDAY_COUNT; i++) {
UILabel label = new UILabel(); UILabel label = new UILabel();
@ -197,32 +197,32 @@ public class UICalendarPanel extends JPanel {
return pCenter; return pCenter;
} }
private JPanel createSouthPane () { private JPanel createSouthPane() {
JPanel sPane = new JPanel(); JPanel sPane = new JPanel();
sPane.setPreferredSize(new Dimension(216, 30)); sPane.setPreferredSize(new Dimension(216, 30));
sPane.setBackground(Color.WHITE); sPane.setBackground(Color.WHITE);
sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6)); sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6));
UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":"); UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":");
timeLabel.setBorder(BorderFactory.createEmptyBorder(0,9,0,5)); timeLabel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 5));
timeLabel.setFont(FONT_SONG); timeLabel.setFont(FONT_UI);
sPane.add(timeLabel); sPane.add(timeLabel);
hms = new HMSPane(); hms = new HMSPane();
sPane.add(hms); sPane.add(hms);
UILabel gap = new UILabel(); UILabel gap = new UILabel();
gap.setPreferredSize(new Dimension(26,1)); gap.setPreferredSize(new Dimension(26, 1));
sPane.add(gap); sPane.add(gap);
UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) { UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(32,18); return new Dimension(32, 18);
} }
public Insets getInsets() { public Insets getInsets() {
return new Insets(0, 0, 0, 0); return new Insets(0, 0, 0, 0);
} }
}; };
okButton.setFont(FONT_SONG); okButton.setFont(FONT_UI);
okButton.setVerticalAlignment(SwingConstants.CENTER); okButton.setVerticalAlignment(SwingConstants.CENTER);
okButton.addActionListener(new ActionListener() { okButton.addActionListener(new ActionListener() {
@ -248,11 +248,12 @@ public class UICalendarPanel extends JPanel {
/** /**
* 创建上一月,下一月,上一年,下一年"按钮" * 创建上一月,下一月,上一年,下一年"按钮"
* @param field int *
* @param field int
* @param amount int * @param amount int
* @return UILabel * @return UILabel
*/ */
protected UILabel createSkipButton(final int field, final int amount,final Icon[] icons) { protected UILabel createSkipButton(final int field, final int amount, final Icon[] icons) {
if (icons.length != 3) { if (icons.length != 3) {
return new UILabel(); return new UILabel();
} }
@ -274,11 +275,11 @@ public class UICalendarPanel extends JPanel {
} }
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
label.setIcon(icons[1]); label.setIcon(icons[1]);
} }
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
label.setIcon(icons[0]); label.setIcon(icons[0]);
} }
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
@ -311,7 +312,7 @@ public class UICalendarPanel extends JPanel {
gp.setBorder(null); gp.setBorder(null);
UIDayLabel label = new UIDayLabel(setupCalendar.getTime()); UIDayLabel label = new UIDayLabel(setupCalendar.getTime());
label.setHorizontalAlignment(SwingConstants.RIGHT); label.setHorizontalAlignment(SwingConstants.RIGHT);
label.setBorder(BorderFactory.createEmptyBorder(0,0,0,9)); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 9));
label.addMouseListener(dayBttListener); label.addMouseListener(dayBttListener);
if ("1".equals(label.getText())) { if ("1".equals(label.getText())) {
isCurrentMonth = !isCurrentMonth; isCurrentMonth = !isCurrentMonth;
@ -328,7 +329,7 @@ public class UICalendarPanel extends JPanel {
days.setSelectedIndex(i); days.setSelectedIndex(i);
this.selectedDate = label.getDate(); this.selectedDate = label.getDate();
this.calendar.setTime(this.selectedDate); this.calendar.setTime(this.selectedDate);
}else { } else {
gp.add(label, BorderLayout.CENTER); gp.add(label, BorderLayout.CENTER);
days.add(gp); days.add(gp);
} }
@ -337,7 +338,7 @@ public class UICalendarPanel extends JPanel {
} }
public void updateHMS() { public void updateHMS() {
if (hms != null){ if (hms != null) {
hms.populate(this.calendar); hms.populate(this.calendar);
hms.validate(); hms.validate();
} }
@ -388,9 +389,9 @@ public class UICalendarPanel extends JPanel {
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (isEnabled()) { if (isEnabled()) {
UIDayLabel com = (UIDayLabel) e.getComponent(); UIDayLabel com = (UIDayLabel) e.getComponent();
GradientPane gp = (GradientPane)com.getParent(); GradientPane gp = (GradientPane) com.getParent();
if (days.selectedIndex != -1) { if (days.selectedIndex != -1) {
((GradientPane)days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); ((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
} }
gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM)); gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM));
days.setSelectedIndex(gp.getIndex()); days.setSelectedIndex(gp.getIndex());
@ -413,7 +414,7 @@ public class UICalendarPanel extends JPanel {
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
if (isEnabled()) { if (isEnabled()) {
JComponent com = (JComponent) e.getComponent(); JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane)com.getParent(); GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() == days.selectedIndex) { if (gp.getIndex() == days.selectedIndex) {
return; return;
} }
@ -426,7 +427,7 @@ public class UICalendarPanel extends JPanel {
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
if (isEnabled()) { if (isEnabled()) {
JComponent com = (JComponent) e.getComponent(); JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane)com.getParent(); GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() != days.selectedIndex) { if (gp.getIndex() != days.selectedIndex) {
gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
} }
@ -489,7 +490,7 @@ public class UICalendarPanel extends JPanel {
this.isGradientBackground = isGradientBackground; this.isGradientBackground = isGradientBackground;
} }
public void paint(Graphics g){ public void paint(Graphics g) {
super.paint(g); super.paint(g);
if (isGradientBackground && gradientBackground != null) { if (isGradientBackground && gradientBackground != null) {
gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight())); gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight()));
@ -509,7 +510,7 @@ public class UICalendarPanel extends JPanel {
this.index = i; this.index = i;
} }
public int getIndex () { public int getIndex() {
return this.index; return this.index;
} }
@ -530,12 +531,12 @@ public class UICalendarPanel extends JPanel {
public DayPane() { public DayPane() {
floateIndex = -1; floateIndex = -1;
selectedIndex = -1; selectedIndex = -1;
this.setLayout(new GridLayout(6,7,1,1)); this.setLayout(new GridLayout(6, 7, 1, 1));
this.setBackground(new Color(0xFFFFFF)); this.setBackground(new Color(0xFFFFFF));
this.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(0xDADADA))); this.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(0xDADADA)));
} }
public void paint (Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);
int width = 31; int width = 31;
int height = 19; int height = 19;
@ -543,11 +544,11 @@ public class UICalendarPanel extends JPanel {
g.setColor(new Color(0xDADADA)); g.setColor(new Color(0xDADADA));
int start_x = 30; int start_x = 30;
int start_y = 19; int start_y = 19;
for (int i = 0; i < 6; i ++) { for (int i = 0; i < 6; i++) {
g.drawLine(start_x, 0, start_x, getHeight()); g.drawLine(start_x, 0, start_x, getHeight());
start_x += width; start_x += width;
} }
for (int i = 0; i < 5; i ++){ for (int i = 0; i < 5; i++) {
g.drawLine(0, start_y, getWidth(), start_y); g.drawLine(0, start_y, getWidth(), start_y);
start_y += height; start_y += height;
} }
@ -558,25 +559,25 @@ public class UICalendarPanel extends JPanel {
} }
if (selectedIndex > -1) { if (selectedIndex > -1) {
g.setColor(selectedColor); g.setColor(selectedColor);
paintChindPane(g,selectedIndex); paintChindPane(g, selectedIndex);
} }
g.setColor(oldColor); g.setColor(oldColor);
} }
private void paintChindPane(Graphics g, int index) { private void paintChindPane(Graphics g, int index) {
if (index%7 == 0 ) { if (index % 7 == 0) {
int y1 = index/7*19; int y1 = index / 7 * 19;
g.drawLine(0,y1,30,y1); g.drawLine(0, y1, 30, y1);
g.drawLine(0,y1 + 19, 30, y1 +19); g.drawLine(0, y1 + 19, 30, y1 + 19);
g.drawLine(30, y1, 30 ,y1 + 19); g.drawLine(30, y1, 30, y1 + 19);
}else if (index%7 == 6) { } else if (index % 7 == 6) {
int y1 = index/7*19; int y1 = index / 7 * 19;
g.drawLine(185,y1,216,y1); g.drawLine(185, y1, 216, y1);
g.drawLine(185,y1 + 19, 216, y1 +19); g.drawLine(185, y1 + 19, 216, y1 + 19);
g.drawLine(185, y1, 185 ,y1 + 19); g.drawLine(185, y1, 185, y1 + 19);
} else { } else {
int x1 = index%7*31 -1; int x1 = index % 7 * 31 - 1;
int y1 = index/7*19; int y1 = index / 7 * 19;
g.drawRect(x1, y1, 31, 19); g.drawRect(x1, y1, 31, 19);
} }
} }
@ -599,7 +600,7 @@ public class UICalendarPanel extends JPanel {
} }
private class HMSPane extends JPanel{ private class HMSPane extends JPanel {
private boolean isRolOver; private boolean isRolOver;
private UIButton preButton; private UIButton preButton;
private UIButton nextButton; private UIButton nextButton;
@ -608,7 +609,7 @@ public class UICalendarPanel extends JPanel {
private CalendarNumberField sField; private CalendarNumberField sField;
private CalendarNumberField selectedNumberField; private CalendarNumberField selectedNumberField;
public HMSPane () { public HMSPane() {
this.setPreferredSize(new Dimension(101, 18)); this.setPreferredSize(new Dimension(101, 18));
this.setLayout(new BorderLayout(0, 0)); this.setLayout(new BorderLayout(0, 0));
this.setBackground(null); this.setBackground(null);
@ -633,7 +634,7 @@ public class UICalendarPanel extends JPanel {
} }
private void initComponents() { private void initComponents() {
JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT,0,2)); JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2));
jp.setBackground(null); jp.setBackground(null);
jp.setBorder(null); jp.setBorder(null);
@ -649,13 +650,13 @@ public class UICalendarPanel extends JPanel {
jp.add(sField); jp.add(sField);
this.add(jp, BorderLayout.CENTER); this.add(jp, BorderLayout.CENTER);
preButton = new UIButton(UIConstants.ARROW_UP_ICON){ preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }
}; };
preButton.setRoundBorder(true, Constants.LEFT); preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON){ nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;
} }
@ -673,7 +674,7 @@ public class UICalendarPanel extends JPanel {
MouseAdapter backgroundAdapter = new MouseAdapter() { MouseAdapter backgroundAdapter = new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
HMSPane.this.selectedNumberField = (CalendarNumberField)e.getComponent(); HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent();
} }
@Override @Override
@ -710,17 +711,17 @@ public class UICalendarPanel extends JPanel {
}); });
} }
private UILabel createGapLabel () { private UILabel createGapLabel() {
UILabel uiLabel = new UILabel(":"); UILabel uiLabel = new UILabel(":");
uiLabel.setHorizontalAlignment(SwingConstants.CENTER); uiLabel.setHorizontalAlignment(SwingConstants.CENTER);
uiLabel.setBackground(null); uiLabel.setBackground(null);
uiLabel.setBorder(null); uiLabel.setBorder(null);
uiLabel.setPreferredSize(new Dimension(6,10)); uiLabel.setPreferredSize(new Dimension(6, 10));
return uiLabel; return uiLabel;
} }
public Insets getInsets() { public Insets getInsets() {
return new Insets(1,3,1,0); return new Insets(1, 3, 1, 0);
} }
public void paint(Graphics g) { public void paint(Graphics g) {
@ -729,7 +730,7 @@ public class UICalendarPanel extends JPanel {
} }
public void paintBorder(Graphics g) { public void paintBorder(Graphics g) {
Graphics2D g2d = (Graphics2D)g; Graphics2D g2d = (Graphics2D) g;
if (isRolOver) { if (isRolOver) {
Shape shape = new RoundRectangle2D.Double(1, 1, 86, 15, UIConstants.ARC, UIConstants.ARC); Shape shape = new RoundRectangle2D.Double(1, 1, 86, 15, UIConstants.ARC, UIConstants.ARC);
GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE); GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE);
@ -738,7 +739,7 @@ public class UICalendarPanel extends JPanel {
} }
} }
public void populate(Calendar calendar){ public void populate(Calendar calendar) {
this.hField.setValue(calendar.get(Calendar.HOUR_OF_DAY)); this.hField.setValue(calendar.get(Calendar.HOUR_OF_DAY));
this.mField.setValue(calendar.get(Calendar.MINUTE)); this.mField.setValue(calendar.get(Calendar.MINUTE));
this.sField.setValue(calendar.get(Calendar.SECOND)); this.sField.setValue(calendar.get(Calendar.SECOND));
@ -751,15 +752,15 @@ public class UICalendarPanel extends JPanel {
} }
} }
public static void main(String[] args){ public static void main(String[] args) {
JFrame frame = new JFrame(); JFrame frame = new JFrame();
UICalendarPanel calendarPanel = new UICalendarPanel(); UICalendarPanel calendarPanel = new UICalendarPanel();
final UITextField field = new UITextField(); final UITextField field = new UITextField();
field.setPreferredSize(new Dimension(120, 25)); field.setPreferredSize(new Dimension(120, 25));
calendarPanel.addDateChangeListener(new ChangeListener(){ calendarPanel.addDateChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e){ public void stateChanged(ChangeEvent e) {
Date selectedDate = (Date)e.getSource(); Date selectedDate = (Date) e.getSource();
SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd");
field.setText(f.format(selectedDate)); field.setText(f.format(selectedDate));
} }

7
designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java

@ -1,14 +1,13 @@
package com.fr.design.gui.date; package com.fr.design.gui.date;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
public class UIDayLabel extends UILabel { public class UIDayLabel extends UILabel {
private Date date = null; private Date date = null;
@ -28,13 +27,13 @@ public class UIDayLabel extends UILabel {
public UIDayLabel(Date date, boolean isSmallLabel) { public UIDayLabel(Date date, boolean isSmallLabel) {
setHorizontalAlignment(UILabel.CENTER); setHorizontalAlignment(UILabel.CENTER);
setFont(new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"), 0, 12)); setFont(DesignUtils.getDefaultGUIFont());
this.date = date; this.date = date;
setPreferredSize(new Dimension(30, 18)); setPreferredSize(new Dimension(30, 18));
if (isSmallLabel) { if (isSmallLabel) {
setText(dayFormat.format(date)); setText(dayFormat.format(date));
} else { } else {
setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today")+":" + dateFormat.format(new Date())); setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today") + ":" + dateFormat.format(new Date()));
} }
} }

1
designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -46,7 +46,6 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators()); refreshNameableCreator(createNameableCreators());
HistoryTemplateListCache.getInstance().reloadCurrentTemplate();
} }
}, new PluginFilter() { }, new PluginFilter() {

1
designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java

@ -142,6 +142,7 @@ public class LayerDependenceSettingPane extends JPanel implements ItemListener {
this.model.clear(); this.model.clear();
this.model.addAll(dependenceList); this.model.addAll(dependenceList);
this.model.fireTableDataChanged();
} }

11
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java

@ -3,6 +3,7 @@ package com.fr.design.gui.ibutton;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle; import com.fr.base.CellBorderStyle;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -97,6 +98,14 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
initListener(); initListener();
} }
public UIButton(String resource, boolean needSetDisabledIcon) {
super(IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_NORMAL));
if (needSetDisabledIcon) {
this.setDisabledIcon(IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_DISABLED));
}
init();
}
protected void initListener() { protected void initListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addActionListener(new ActionListener() { this.addActionListener(new ActionListener() {
@ -388,4 +397,4 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
} }

7
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -106,6 +106,13 @@ public class TableViewList extends UIList {
if (!status) { if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
} }
String[] schemas = DataCoreUtils.getDatabaseSchema(datasource);
schemas = (schemas == null || schemas.length == 0) ? new String[]{null} : schemas;
for (String schema : schemas) {
DataCoreUtils.refreshTables(datasource, TableProcedure.TABLE, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.VIEW, schema);
DataCoreUtils.refreshTables(datasource, TableProcedure.PROCEDURE, schema);
}
return processDataInAnotherThread(databaseName, searchFilter, typesFilter); return processDataInAnotherThread(databaseName, searchFilter, typesFilter);
} }

15
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -13,6 +13,8 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.HashMap;
import java.util.Map;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
@ -21,7 +23,6 @@ import javax.swing.tree.TreePath;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
/* /*
@ -199,14 +200,14 @@ public class EnvFileTree extends RefreshableJTree {
// 用FileNodeFilter过滤一下 // 用FileNodeFilter过滤一下
if (filter != null) { if (filter != null) {
java.util.List<FileNode> tList = new ArrayList<FileNode>(); Map<String, FileNode> fileNodes = new HashMap<>();
for (int i = 0; i < resFns.length; i++) { for (FileNode fileNode : resFns) {
if (filter.accept(resFns[i])) { // war包部署下会生成两份classes目录,需要去重一下
tList.add(resFns[i]); if (filter.accept(fileNode)) {
fileNodes.put(fileNode.getName(), fileNode);
} }
} }
resFns = fileNodes.values().toArray(new FileNode[fileNodes.size()]);
resFns = tList.toArray(new FileNode[tList.size()]);
} }
Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); Arrays.sort(resFns, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));

22
designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java

@ -1,16 +1,18 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.IOFileNodeFilter; import com.fr.file.filetree.IOFileNodeFilter;
import javax.swing.JPanel;
import javax.swing.*; import javax.swing.JScrollPane;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Font;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -32,7 +34,7 @@ public class ReportletPane extends BasicPane {
textPane.setEditable(false); textPane.setEditable(false);
textPane.setLineWrap(true); textPane.setLineWrap(true);
textPane.setFont(FRContext.getDefaultValues().getFRFont().deriveFont(Font.BOLD, 12)); textPane.setFont(DesignUtils.getDefaultGUIFont().applyStyle(Font.BOLD));
textPane.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Schedule_The_Selected_File_Must_Be_End_With_Filter")); textPane.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Schedule_The_Selected_File_Must_Be_End_With_Filter"));
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -41,6 +43,7 @@ public class ReportletPane extends BasicPane {
switchButton = new UIButton("switch"); switchButton = new UIButton("switch");
centerPane.add(GUICoreUtils.createBorderPane(switchButton, BorderLayout.WEST), BorderLayout.NORTH); centerPane.add(GUICoreUtils.createBorderPane(switchButton, BorderLayout.WEST), BorderLayout.NORTH);
switchButton.addActionListener(new ActionListener() { switchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
switchCardPane(t_panel.isVisible()); switchCardPane(t_panel.isVisible());
} }
@ -50,12 +53,12 @@ public class ReportletPane extends BasicPane {
centerPane.add(cardPane, BorderLayout.CENTER); centerPane.add(cardPane, BorderLayout.CENTER);
cardPane.setLayout(card = new CardLayout()); cardPane.setLayout(card = new CardLayout());
templateReportletTree = new TemplateFileTree(); templateReportletTree = new TemplateFileTree();
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class",".frm",".form"}); IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class", ".frm", ".form"});
templateReportletTree.setFileNodeFilter(filter); templateReportletTree.setFileNodeFilter(filter);
cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE"); cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE");
classReportletTree = new ClassFileTree(); classReportletTree = new ClassFileTree();
cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS"); cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS");
this.refreshEnv(); this.refreshEnv();
} }
@ -75,8 +78,9 @@ public class ReportletPane extends BasicPane {
/** /**
* 检查是否符合规范 * 检查是否符合规范
* *
* @throws Exception 抛错 * @throws Exception 抛错
*/ */
@Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
String path = this.getSelectedReportletPath(); String path = this.getSelectedReportletPath();
if (path == null) { if (path == null) {
@ -89,7 +93,7 @@ public class ReportletPane extends BasicPane {
* 刷新Env * 刷新Env
*/ */
public void refreshEnv() { public void refreshEnv() {
this.templateReportletTree.refreshEnv(); this.templateReportletTree.refreshEnv();
this.classReportletTree.refreshEnv(); this.classReportletTree.refreshEnv();
} }

2
designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java

@ -26,7 +26,7 @@ public class IconPathConstants {
public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png";
public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png";
public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png";
public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/tab/remove.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/remove.png";
public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png";
public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png";
public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png";

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

@ -17,7 +17,6 @@ import com.fr.design.file.FileToolbarStateChangeListener;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -58,7 +57,6 @@ import javax.swing.JDialog;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -318,7 +316,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public NewFolderAction() { public NewFolderAction() {
this.setName(KeySetUtils.NEW_FOLDER.getMenuKeySetName()); this.setName(KeySetUtils.NEW_FOLDER.getMenuKeySetName());
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/icon_NewFolderIcon_normal.png")); this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder");
} }
@Override @Override
@ -344,7 +342,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private class VcsAction extends UpdateAction { private class VcsAction extends UpdateAction {
public VcsAction() { public VcsAction() {
this.setSmallIcon(VcsHelper.VCS_LIST_PNG); this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list");
} }
@Override @Override
@ -426,7 +424,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public ShowInExplorerAction() { public ShowInExplorerAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_In_Containing_Folder")); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_In_Containing_Folder"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/view_folder.png")); this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder");
} }
@Override @Override
@ -443,7 +441,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public RefreshTreeAction() { public RefreshTreeAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh"));
this.setSmallIcon(UIConstants.REFRESH_ICON); this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/refresh");
} }
@Override @Override
@ -461,7 +459,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public RenameAction() { public RenameAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Rename")); this.setName(Toolkit.i18nText("Fine-Design_Basic_Rename"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/rename.png")); this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/rename");
} }
@Override @Override
@ -500,7 +498,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public DelFileAction() { public DelFileAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove")); this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png")); this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/remove");
} }
@Override @Override

74
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -15,9 +15,10 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.menu.SnapChatUtil; import com.fr.design.menu.SnapChatUtil;
import com.fr.design.notification.SnapChat; import com.fr.design.notification.SnapChat;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
@ -98,16 +99,32 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public enum PropertyMode { public enum PropertyMode {
REPORT, // 报表 REPORT, // 报表
REPORT_PARA, // 报表参数面板 REPORT_PARA_WIDGET, //报表参数面板中的控件
REPORT_PARA(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板
REPORT_FLOAT, // 报表悬浮元素 REPORT_FLOAT, // 报表悬浮元素
FORM, // 表单 FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单
FORM_REPORT, // 表单报表块 FORM_REPORT, // 表单报表块
POLY, // 聚合报表 POLY, // 聚合报表
POLY_REPORT, // 聚合报表-报表块 POLY_REPORT, // 聚合报表-报表块
POLY_CHART, // 聚合报表-图表块 POLY_CHART(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块
AUTHORITY_EDITION, // 权限编辑 AUTHORITY_EDITION, // 权限编辑
AUTHORITY_EDITION_DISABLED // 权限编辑 AUTHORITY_EDITION_DISABLED; // 权限编辑
private String title;
PropertyMode() {
this.title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings");
}
PropertyMode(String title) {
this.title = title;
}
public String getTitle() {
return this.title;
}
} }
private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板)
@ -256,27 +273,27 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap = new LinkedHashMap<>(); // 有序map propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素 // 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"),
"cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 单元格属性 // 单元格属性
PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"), PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"),
"cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 悬浮元素 // 悬浮元素
PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"), PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"),
"floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置 // 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"),
"widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
// 条件属性 // 条件属性
PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"), PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"),
"conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 超级链接 // 超级链接
PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"), PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"),
"hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 组件库 // 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"), PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"),
@ -400,6 +417,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private void updatePropertyItemMap() { private void updatePropertyItemMap() {
for (PropertyItem item : propertyItemMap.values()) { for (PropertyItem item : propertyItemMap.values()) {
item.updateStatus(); item.updateStatus();
item.updateTitle();
} }
} }
@ -684,9 +702,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix // 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix
private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/"; private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/";
private static final String ICON_SUFFIX_NORMAL = "_normal.png"; private static final String ICON_SUFFIX_NORMAL = "_normal.svg";
private static final String ICON_SUFFIX_DISABLED = "_disabled.png"; private static final String ICON_SUFFIX_DISABLED = "_disabled.svg";
private static final String ICON_SUFFIX_SELECTED = "_selected.png"; private static final String ICON_SUFFIX_SELECTED = "_selected.svg";
private static final int ICON_WIDTH = 18;
private static final int ICON_HEIGHT = 18;
private String btnIconName; private String btnIconName;
private String iconBaseDir; private String iconBaseDir;
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一 private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
@ -734,6 +754,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
} }
public void updateTitle() {
try {
if (StringUtils.equals(KEY_WIDGET_SETTINGS, name)) {
title = currentMode.getTitle();
button.setToolTipText(title);
UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST);
uiLabel.setText(title);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
public void reAddContentArea() { public void reAddContentArea() {
propertyPanel.add(contentArea, BorderLayout.CENTER); propertyPanel.add(contentArea, BorderLayout.CENTER);
} }
@ -858,7 +891,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void resetButtonIcon() { public void resetButtonIcon() {
if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) {
iconSuffix = ICON_SUFFIX_NORMAL; iconSuffix = ICON_SUFFIX_NORMAL;
button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setBackground(originBtnBackground); button.setBackground(originBtnBackground);
button.setOpaque(false); button.setOpaque(false);
} }
@ -867,7 +900,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void setTabButtonSelected() { public void setTabButtonSelected() {
resetPropertyIcons(); resetPropertyIcons();
iconSuffix = ICON_SUFFIX_SELECTED; iconSuffix = ICON_SUFFIX_SELECTED;
button.setIcon(BaseUtils.readIcon(getBtnIconUrl())); button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setBackground(selectedBtnBackground); button.setBackground(selectedBtnBackground);
button.setOpaque(true); button.setOpaque(true);
selectedItem = this; selectedItem = this;
@ -878,7 +911,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
private void initButton() { private void initButton() {
button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) { button = new UIButton(IconUtils.readIcon(getBtnIconUrl())) {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
} }
@ -891,6 +924,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} }
} }
}; };
button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED));
button.set4LargeToolbarButton(); button.set4LargeToolbarButton();
button.setUI(new UIButtonUI() { button.setUI(new UIButtonUI() {
@Override @Override
@ -1217,7 +1251,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
super.paint(g); super.paint(g);
Image button; Image button;
g.setColor(new Color(69, 135, 255)); g.setColor(new Color(69, 135, 255));
g.setFont(FRFont.getInstance().applySize(14)); g.setFont(DesignUtils.getDefaultGUIFont().applySize(14));
if (buttonType.equals(NO_BUTTON)) { if (buttonType.equals(NO_BUTTON)) {
return; return;
} }

10
designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java

@ -13,9 +13,9 @@ import com.fr.design.gui.ispinner.UISpinnerUI;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JButton; import javax.swing.JButton;
@ -37,7 +37,6 @@ import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
@ -60,7 +59,6 @@ public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45; private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20; private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50; private static final int HALF_HUNDRED = 50;
@ -194,9 +192,9 @@ public class JSliderPane extends JPanel {
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button")); selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button"));
selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); selfAdaptButton.setFont(DesignUtils.getDefaultGUIFont());
customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button")); customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button"));
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); customButton.setFont(DesignUtils.getDefaultGUIFont());
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
@ -265,7 +263,7 @@ public class JSliderPane extends JPanel {
JPanel spinnerPanel = new JPanel(new FlowLayout()); JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner); spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%"); UILabel percent = new UILabel("%");
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); percent.setFont(DesignUtils.getDefaultGUIFont());
spinnerPanel.add(percent); spinnerPanel.add(percent);
spinnerPanel.setBackground(BACK_COLOR); spinnerPanel.setBackground(BACK_COLOR);
return spinnerPanel; return spinnerPanel;

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

@ -3,7 +3,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark;
@ -24,6 +23,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.InformationWarnPane; import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateResourceManager;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
@ -49,6 +49,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.file.MemFILE; import com.fr.file.MemFILE;
@ -78,6 +79,7 @@ import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.util.ArrayList; import java.util.ArrayList;
@ -107,7 +109,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private DesignModelAdapter<T, ?> designModel; private DesignModelAdapter<T, ?> designModel;
private PreviewProvider previewType; private PreviewProvider previewType;
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer(); protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer();
public int resolution = ScreenResolution.getScreenResolution();
private PluginEventListener pluginListener; private PluginEventListener pluginListener;
@ -125,6 +126,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public JTemplate(T t, FILE file, boolean isNewFile) { public JTemplate(T t, FILE file, boolean isNewFile) {
super(t); super(t);
beforeInit();
// 判断是否切换设计器状态到禁止拷贝剪切 // 判断是否切换设计器状态到禁止拷贝剪切
if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT); DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT);
@ -301,6 +303,20 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
/**
* 模板初始化之前
*/
private void beforeInit() {
EventDispatcher.fire(JTemplateEvent.BEFORE_TEMPLATE_INIT, this);
}
/**
* 模板激活之前之前
*/
protected void beforeActive() {
EventDispatcher.fire(JTemplateEvent.BEFORE_TEMPLATE_ACTIVE, this);
}
/** /**
* 模板关闭时 * 模板关闭时
*/ */
@ -309,6 +325,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
PluginListenerRegistration.getInstance().stopListen(this.pluginListener); PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
} }
/** /**
* 刷新内部资源 * 刷新内部资源
* *
@ -316,19 +333,41 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* CenterPane 负责监听改动 * CenterPane 负责监听改动
* 所以需要同步处理 * 所以需要同步处理
*/ */
@Deprecated
public void refreshResource() { public void refreshResource() {
refreshResource(this.editingFILE);
}
try { public void refreshResource(FILE file) {
this.template = JTemplateFactory.asIOFile(this.editingFILE);
setTarget(this.template);
// 先移除旧的。
removeCenterPane(); new SwingWorker<Void, Void>() {
// 加入新的
addCenterPane(); @Override
} catch (Exception e) { protected Void doInBackground() throws Exception {
FineLoggerFactory.getLogger().error(e.getMessage(), e); setTargetByFile(file);
} return null;
}
@Override
public void done() {
try {
get();
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.execute();
}
private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
} }
private void addCenterPane() { private void addCenterPane() {
@ -797,7 +836,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false; return false;
} }
try { try {
this.getTarget().export(editingFILE.asOutputStream()); this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE);
@ -1076,6 +1115,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 激活指定的template * 激活指定的template
*/ */
public void activeJTemplate(int index, JTemplate jt) { public void activeJTemplate(int index, JTemplate jt) {
beforeActive();
DesignerContext.getDesignerFrame().activateJTemplate(this); DesignerContext.getDesignerFrame().activateJTemplate(this);
} }
@ -1083,6 +1123,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 激活已存在的模板 * 激活已存在的模板
*/ */
public void activeOldJTemplate() { public void activeOldJTemplate() {
beforeActive();
DesignerContext.getDesignerFrame().activateJTemplate(this); DesignerContext.getDesignerFrame().activateJTemplate(this);
} }
@ -1090,6 +1131,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 激活新的模板 * 激活新的模板
*/ */
public void activeNewJTemplate() { public void activeNewJTemplate() {
beforeActive();
DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); DesignerContext.getDesignerFrame().addAndActivateJTemplate(this);
} }

19
designer-base/src/main/java/com/fr/design/mainframe/JTemplateEvent.java

@ -0,0 +1,19 @@
package com.fr.design.mainframe;
import com.fr.event.Event;
/**
* Created by kerry on 2020-12-11
*/
public enum JTemplateEvent implements Event<JTemplate> {
/**
* 模板初始化之前
*/
BEFORE_TEMPLATE_INIT,
/**
* 模板激活之前
*/
BEFORE_TEMPLATE_ACTIVE
}

30
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -3,11 +3,12 @@ package com.fr.design.mainframe;
import com.fr.base.io.BaseBook; import com.fr.base.io.BaseBook;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.third.javax.annotation.Nonnull; import com.fr.stable.StringUtils;
import com.fr.third.javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class JTemplateFactory { public final class JTemplateFactory {
private static final List<App<?>> ALL_APP = new ArrayList<App<?>>(); private static final List<App<?>> ALL_APP = new ArrayList<App<?>>();
@ -21,8 +22,7 @@ public final class JTemplateFactory {
* @param file 包含了模板名称类型以及内容的文件 * @param file 包含了模板名称类型以及内容的文件
* @return 设计器编辑的模板对象 * @return 设计器编辑的模板对象
*/ */
@Nullable public static JTemplate<?, ?> createJTemplate(@NotNull FILE file) {
public static JTemplate<?, ?> createJTemplate(@Nonnull FILE file) {
String fileName = file.getName(); String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
@ -43,15 +43,19 @@ public final class JTemplateFactory {
} }
return null; return null;
} }
public static <T extends BaseBook> T asIOFile(@Nonnull FILE file) { @Nullable
public static <T extends BaseBook> T asIOFile(@NotNull FILE file, String fileNameOrSuffix) {
String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); if (StringUtils.isEmpty(fileNameOrSuffix)) {
return null;
}
int indexOfLastDot = fileNameOrSuffix.lastIndexOf(CoreConstants.DOT);
if (indexOfLastDot < 0) { if (indexOfLastDot < 0) {
return null; return null;
} }
String fileExtension = fileName.substring(indexOfLastDot + 1); String fileExtension = fileNameOrSuffix.substring(indexOfLastDot + 1);
for (App<?> app : ALL_APP) { for (App<?> app : ALL_APP) {
String[] defaultAppExtensions = app.defaultExtensions(); String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) { for (String defaultAppExtension : defaultAppExtensions) {
@ -66,6 +70,12 @@ public final class JTemplateFactory {
return null; return null;
} }
@Nullable
public static <T extends BaseBook> T asIOFile(@NotNull FILE file) {
return asIOFile(file, file.getName());
}
/** /**
* 注册app. * 注册app.

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

@ -208,6 +208,7 @@ public class JVirtualTemplate extends JTemplate {
@Override @Override
public void activeJTemplate(int index, JTemplate jt) { public void activeJTemplate(int index, JTemplate jt) {
beforeActive();
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
historyList.set(index, jt); historyList.set(index, jt);
DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt); DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt);
@ -217,11 +218,13 @@ public class JVirtualTemplate extends JTemplate {
@Override @Override
public void activeOldJTemplate() { public void activeOldJTemplate() {
beforeActive();
DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE());
} }
@Override @Override
public void activeNewJTemplate() { public void activeNewJTemplate() {
beforeActive();
DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE());
} }

19
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java

@ -19,6 +19,8 @@ import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.joda.time.DateTime; import com.fr.third.joda.time.DateTime;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -27,7 +29,7 @@ import java.util.Map;
* @version 10.0 * @version 10.0
* Created by Bjorn on 2020-02-17 * Created by Bjorn on 2020-02-17
*/ */
public class ChartInfo extends AbstractPointInfo { public class ChartInfo extends AbstractPointInfo implements Comparable<ChartInfo> {
public static final String XML_TAG = "ChartInfo"; public static final String XML_TAG = "ChartInfo";
private static final String CHART_CONSUMING_URL = CloudCenter.getInstance().acquireUrlByKind("chartinfo.consuming") + "/single"; private static final String CHART_CONSUMING_URL = CloudCenter.getInstance().acquireUrlByKind("chartinfo.consuming") + "/single";
private static final String CHART_FUNCTION_URL = CloudCenter.getInstance().acquireUrlByKind("chart.info.function") + "/single"; private static final String CHART_FUNCTION_URL = CloudCenter.getInstance().acquireUrlByKind("chart.info.function") + "/single";
@ -338,4 +340,19 @@ public class ChartInfo extends AbstractPointInfo {
chartInfo.chartConfigInfo = chartConfigInfo.clone(); chartInfo.chartConfigInfo = chartConfigInfo.clone();
return chartInfo; return chartInfo;
} }
@Override
public int compareTo(ChartInfo chartInfo) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return format.parse(this.getCompareDate()).compareTo(format.parse(chartInfo.getCompareDate()));
} catch (Exception ex) {
return 1;
}
}
private String getCompareDate() {
return StringUtils.isNotEmpty(chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME)) ?
chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME) : chartConsumingMap.get(ATTR_CHART_TYPE_TIME);
}
} }

8
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java

@ -13,7 +13,10 @@ import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.joda.time.DateTime; import com.fr.third.joda.time.DateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -269,7 +272,10 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
writer.end(); writer.end();
writer.startTAG(XML_CHART_INFO_LIST); writer.startTAG(XML_CHART_INFO_LIST);
for (ChartInfo chartInfo : pointInfoMap.values()) {
List<ChartInfo> list = new ArrayList<>(pointInfoMap.values());
Collections.sort(list);
for (ChartInfo chartInfo : list) {
chartInfo.writeXML(writer); chartInfo.writeXML(writer);
} }
writer.end(); writer.end();

33
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java

@ -0,0 +1,33 @@
package com.fr.design.mainframe.mobile.provider;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.impl.AbstractMobileParamUIProvider;
import com.fr.design.mainframe.mobile.ui.DefaultMobileParamDefinePane;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.form.ui.mobile.impl.DefaultMobileParameterStyle;
import com.fr.locale.InterProviderFactory;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class DefaultMobileParamUIProvider extends AbstractMobileParamUIProvider {
@Override
public Class<? extends MobileParamStyle> classForMobileParamStyle() {
return DefaultMobileParameterStyle.class;
}
@Override
public Class<? extends BasicBeanPane<MobileParamStyle>> classForMobileParamAppearance() {
return DefaultMobileParamDefinePane.class;
}
@Override
public String displayName() {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT");
}
}

43
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java

@ -0,0 +1,43 @@
package com.fr.design.mainframe.mobile.provider;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.impl.AbstractMobileParamUIProvider;
import com.fr.design.mainframe.mobile.ui.EmptyMobileParamDefinePane;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.EmptyMobileParamStyle;
/**
* 作为MobileParamStyleProvider接口实现兼容转换层
*
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class EmptyMobileParamUIProvider extends AbstractMobileParamUIProvider {
private MobileParamStyleProvider styleProvider;
public EmptyMobileParamUIProvider(MobileParamStyleProvider styleProvider) {
this.styleProvider = styleProvider;
}
@Override
public Class<? extends MobileParamStyle> classForMobileParamStyle() {
return EmptyMobileParamStyle.class;
}
@Override
public Class<? extends BasicBeanPane<MobileParamStyle>> classForMobileParamAppearance() {
return EmptyMobileParamDefinePane.class;
}
@Override
public String displayName() {
return styleProvider.descriptor();
}
public MobileParamStyleProvider getStyleProvider() {
return styleProvider;
}
}

42
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java

@ -0,0 +1,42 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.form.ui.mobile.impl.DefaultMobileParameterStyle;
import java.awt.BorderLayout;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class DefaultMobileParamDefinePane extends BasicBeanPane<MobileParamStyle> {
public DefaultMobileParamDefinePane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Set"));
this.add(centerPane);
}
@Override
public void populateBean(MobileParamStyle ob) {
// do nothing
}
@Override
public MobileParamStyle updateBean() {
return new DefaultMobileParameterStyle();
}
@Override
protected String title4PopupWindow() {
return null;
}
}

47
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java

@ -0,0 +1,47 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.EmptyMobileParamStyle;
import java.awt.BorderLayout;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class EmptyMobileParamDefinePane extends BasicBeanPane<MobileParamStyle> {
private final MobileParamStyleProvider styleProvider;
public EmptyMobileParamDefinePane(MobileParamStyleProvider styleProvider) {
this.styleProvider = styleProvider;
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Set"));
this.add(centerPane);
}
@Override
public void populateBean(MobileParamStyle ob) {
}
@Override
public MobileParamStyle updateBean() {
return new EmptyMobileParamStyle(styleProvider);
}
@Override
protected String title4PopupWindow() {
return null;
}
}

55
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java

@ -0,0 +1,55 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.MobileParamUIProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.ComparatorUtils;
import com.fr.invoke.Reflect;
import com.fr.report.mobile.EmptyMobileParamStyle;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class MobileParamDefinePane extends BasicBeanPane<MobileParamStyle> {
private BasicBeanPane<MobileParamStyle> customBeanPane;
public MobileParamDefinePane(MobileParamUIProvider provider) {
if (provider == null || provider.classForMobileParamAppearance() == null || provider.classForMobileParamAppearance() == null) {
return;
}
if (ComparatorUtils.equals(provider.classForMobileParamStyle(), EmptyMobileParamStyle.class)) {
EmptyMobileParamUIProvider emptyMobileParamUIProvider = (EmptyMobileParamUIProvider) provider;
this.customBeanPane = Reflect.on(provider.classForMobileParamAppearance()).create(emptyMobileParamUIProvider.getStyleProvider()).get();
} else {
this.customBeanPane = Reflect.on(provider.classForMobileParamAppearance()).create().get();
}
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(customBeanPane);
}
@Override
public void populateBean(MobileParamStyle ob) {
this.customBeanPane.populateBean(ob);
}
@Override
public MobileParamStyle updateBean() {
return this.customBeanPane.updateBean();
}
@Override
protected String title4PopupWindow() {
return "MobileParamDefinePane";
}
}

154
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java

@ -0,0 +1,154 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.MobileParamUIProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.provider.DefaultMobileParamUIProvider;
import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.ComparatorUtils;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.EmptyMobileParamStyle;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class MobileParamSettingPane extends BasicPane {
private DefaultListModel<String> listModel;
private JPanel right;
private CardLayout card;
private JList paramStyleList;
private Map<String, BasicBeanPane<MobileParamStyle>> map = new HashMap<>();
public MobileParamSettingPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
listModel = new DefaultListModel<>();
card = new CardLayout();
right = FRGUIPaneFactory.createCardLayout_S_Pane();
right.setLayout(card);
MobileParamUIProvider[] mobileParamUIProviders = getMobileParamUIProviders();
for (MobileParamUIProvider provider : mobileParamUIProviders) {
addShowPane(provider);
}
initLeftPane();
initRightPane();
}
private void initLeftPane() {
paramStyleList = new JList<>(listModel);
paramStyleList.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof MobileParamStyle) {
MobileParamStyle style = (MobileParamStyle) value;
this.setText(style.toString());
}
return this;
}
});
paramStyleList.addListSelectionListener(e -> {
String selectedValue = (String) paramStyleList.getSelectedValue();
card.show(right, selectedValue);
});
JPanel leftPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
leftPane.add(paramStyleList);
leftPane.setPreferredSize(new Dimension(100, 500));
this.add(leftPane, BorderLayout.WEST);
}
private void initRightPane() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane.setPreferredSize(new Dimension(500, 500));
attrConfPane.add(right, BorderLayout.CENTER);
centerPane.add(attrConfPane, BorderLayout.CENTER);
this.add(centerPane, BorderLayout.CENTER);
}
public void populate(MobileParamStyle mobileParamStyle) {
if (mobileParamStyle != null) {
MobileParamUIProvider[] mobileParamUIProviders = getMobileParamUIProviders();
for (int i = 0; i < mobileParamUIProviders.length; i++) {
MobileParamUIProvider provider = mobileParamUIProviders[i];
if (ComparatorUtils.equals(mobileParamStyle.disPlayName(), provider.displayName())) {
String displayName = provider.displayName();
paramStyleList.setSelectedIndex(i);
// 如果是兼容空类型 无须填充面板
if (!(mobileParamStyle instanceof EmptyMobileParamStyle)) {
map.get(displayName).populateBean(mobileParamStyle);
}
card.show(right, displayName);
return;
}
}
}
paramStyleList.setSelectedIndex(0);
}
private void addShowPane(MobileParamUIProvider provider) {
String displayName = provider.displayName();
listModel.addElement(provider.displayName());
BasicBeanPane<MobileParamStyle> paramStyleBasicBeanPane = new MobileParamDefinePane(provider);
right.add(displayName, paramStyleBasicBeanPane);
map.put(displayName, paramStyleBasicBeanPane);
}
public MobileParamStyle update() {
return map.get(paramStyleList.getSelectedValue()).updateBean();
}
@Override
protected String title4PopupWindow() {
return null;
}
private MobileParamUIProvider[] getMobileParamUIProviders() {
Set<MobileParamUIProvider> paramUIProviders = ExtraDesignClassManager.getInstance().getArray(MobileParamUIProvider.XML_TAG);
List<MobileParamUIProvider> result = new ArrayList<>();
result.add(new DefaultMobileParamUIProvider());
result.addAll(paramUIProviders);
Set<String> nameSets = paramUIProviders.stream().map(MobileParamUIProvider::displayName).collect(Collectors.toSet());
// 兼容老接口
Set<MobileParamStyleProvider> paramStyleProviders = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING);
paramStyleProviders = paramStyleProviders.stream().filter(provider -> !nameSets.contains(provider.descriptor())).collect(Collectors.toSet());
for (MobileParamStyleProvider provider : paramStyleProviders) {
result.add(new EmptyMobileParamUIProvider(provider));
}
return result.toArray(new MobileParamUIProvider[0]);
}
}

9
designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java

@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -56,20 +57,24 @@ public class BasicPropertyPane extends BasicPane {
} }
} }
}; };
widgetName.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); widgetName.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic"));
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p}; double[] rowSize = {p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}}; int[][] rowCount = {{1, 1}};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Name")), widgetName}, new Component[]{new UILabel(obtainBasicName()), widgetName},
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
public String obtainBasicName(){
return Toolkit.i18nText("Fine-Design_Basic_Component_Name");
}
public UITextField getWidgetNameField() { public UITextField getWidgetNameField() {
return widgetName; return widgetName;
} }

34
designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java

@ -0,0 +1,34 @@
package com.fr.design.mainframe.widget.wrappers;
import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
import com.fr.locale.InterProviderFactory;
import org.jetbrains.annotations.Nullable;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class MobileParamWrapper implements Encoder, Decoder {
@Nullable
@Override
public Object decode(String txt) {
return null;
}
@Override
public void validate(String txt) throws ValidationException {
// do nothing
}
@Override
public String encode(Object v) {
if (v == null) {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT");
}
return v.toString();
}
}

20
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -1,6 +1,6 @@
package com.fr.design.menu; package com.fr.design.menu;
import com.fr.base.BaseUtils; import com.fr.base.svg.IconUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.*; import com.fr.design.gui.imenu.*;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.iscrollbar.UIScrollBar;
@ -141,7 +141,7 @@ public class MenuDef extends ShortCut {
addShortCut(i); addShortCut(i);
} }
} }
public void addShortCut(ShortCut shortCut) { public void addShortCut(ShortCut shortCut) {
this.shortcutList.add(shortCut); this.shortcutList.add(shortCut);
} }
@ -166,7 +166,7 @@ public class MenuDef extends ShortCut {
public UIButton createUIButton() { public UIButton createUIButton() {
if (createdButton == null) { if (createdButton == null) {
if (iconPath != null) { if (iconPath != null) {
createdButton = new UIButton(BaseUtils.readIcon(iconPath)); createdButton = new UIButton(IconUtils.readIcon(iconPath));
createdButton.set4ToolbarButton(); createdButton.set4ToolbarButton();
} else { } else {
createdButton = new UIButton(name); createdButton = new UIButton(name);
@ -194,7 +194,7 @@ public class MenuDef extends ShortCut {
createdJMenu = createJMenu0(); createdJMenu = createJMenu0();
createdJMenu.setMnemonic(this.getMnemonic()); createdJMenu.setMnemonic(this.getMnemonic());
if (this.iconPath != null) { if (this.iconPath != null) {
createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath)); createdJMenu.setIcon(IconUtils.readIcon(iconPath));
} }
MenuListener menuListener = createMenuListener(); MenuListener menuListener = createMenuListener();
createdJMenu.addMenuListener(menuListener); createdJMenu.addMenuListener(menuListener);
@ -206,9 +206,9 @@ public class MenuDef extends ShortCut {
return createdJMenu; return createdJMenu;
} }
protected UIMenu createJMenu0() { protected UIMenu createJMenu0() {
UIMenu createdJMenu; UIMenu createdJMenu;
if (hasScrollSubMenu) { if (hasScrollSubMenu) {
createdJMenu = new UIScrollMenu(this.getName()); createdJMenu = new UIScrollMenu(this.getName());
@ -219,7 +219,7 @@ public class MenuDef extends ShortCut {
} }
return createdJMenu; return createdJMenu;
} }
protected ContainerListener getContainerListener() { protected ContainerListener getContainerListener() {
return null; return null;
} }
@ -389,9 +389,9 @@ public class MenuDef extends ShortCut {
public void intoJToolBar(JToolBar toolBar) { public void intoJToolBar(JToolBar toolBar) {
toolBar.add(this.createUIButton()); toolBar.add(this.createUIButton());
} }
protected MenuListener createMenuListener() { protected MenuListener createMenuListener() {
return menuDefListener; return menuDefListener;
} }
@ -456,4 +456,4 @@ public class MenuDef extends ShortCut {
} }
} }

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

Loading…
Cancel
Save