Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/release/10.0)

* commit 'aabaec7fab829314576eeba937a91c262193b23b': (111 commits)
  CHART-17983 仪表盘目标值默认 && CHART-18024 数据集改变,监听重复导致结果错误
  CHART-18050 使用双列网格布局代替流式布局,补充国际化
  CHART-18050 富文本弹窗界面设置为可拖拽大小
  CHART-17775 删除无用方法
  CHART-17775 像素 & 百分比控件优化
  新增字段支持部分图表类型
  调整富文本参数顺序
  适配仪表盘,清理代码
  适配饼图
  适配箱型图
  REPORT-44666 fix 无用import
  REPORT-44666 多屏情况下 部分弹窗显示在另一块屏幕
  适配甘特图
  REPORT-44666 fix 无用import
  REPORT-44666 多屏情况下 部分弹窗显示在另一块屏幕
  REPORT-43833 【10.0.14】远程设计数据连接/服务器数据集增加锁定 1. 将本地实现作为默认实现,注册起来,以兼容远程连接老版服务器的情况 2. 之前清理脏数据的逻辑有点问题,修改方式为:为LockItem对象添加一个成员变量birth,代表其创建时间,并且会为每个ClientID在对应的服务中存上一个key=clientID,value=LockItem的键值对,在用户登入时初始化,每隔30s更新创建时间,用户登出时清除,并且在轮询任务中加入检查当前各个LockItem对应的服务下这个键值对里value的birth是否超时了,如果超时,清理脏数据 3. 将之前使用的applyForService修改为applyForCleanableService,便于集群重启时清理服务数据
  适配框架图
  REPORT-43833 【10.0.14】远程设计数据连接/服务器数据集增加锁定 将通知组件的操作放到EDT中
  REPORT-43833 【10.0.14】远程设计数据连接/服务器数据集增加锁定 将弹窗关闭后解锁的操作,放到afterCommit中
  适配漏斗图
  ...
feature/big-screen
zheng 4 years ago
parent
commit
649c2eee7a
  1. 110
      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. 20
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  7. 38
      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. 106
      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. 41
      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. 49
      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. 27
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  42. 4
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  43. 47
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  44. 58
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  45. 2
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  46. 195
      designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java
  47. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  48. 25
      designer-base/src/main/java/com/fr/design/editlock/ConnectionLockChangeChecker.java
  49. 73
      designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java
  50. 25
      designer-base/src/main/java/com/fr/design/editlock/EditLockChangeEvent.java
  51. 16
      designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java
  52. 79
      designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java
  53. 23
      designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java
  54. 4
      designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java
  55. 4
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  56. 4
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  57. 34
      designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java
  58. 8
      designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java
  59. 37
      designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java
  60. 5
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java
  61. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java
  62. 2
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  63. 31
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java
  64. 8
      designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java
  65. 22
      designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java
  66. 123
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  67. 7
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  68. 24
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java
  69. 1
      designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java
  70. 11
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java
  71. 55
      designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java
  72. 7
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  73. 47
      designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java
  74. 28
      designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java
  75. 26
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  76. 15
      designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java
  77. 20
      designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java
  78. 26
      designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java
  79. 22
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  80. 114
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java
  81. 15
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  82. 22
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java
  83. 6
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  84. 2
      designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java
  85. 12
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  86. 38
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  87. 10
      designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java
  88. 27
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  89. 30
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.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. 34
      designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java
  99. 20
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  100. 14
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -0,0 +1,110 @@
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)) {
if (IOUtils.readResource(resource) != null) {
return SVGIcon.readSVGIcon(resource);
}
// 适配某些插件里是_normal.png、_selected.png的情况
String pngResource = resource.replace(ICON_SUFFIX_SVG, ICON_SUFFIX_PNG);
return IOUtils.readIcon(pngResource);
}
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;
}
}

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

@ -146,7 +146,7 @@ public class EnvChangeEntrance {
template.refreshToolArea();
}
showServiceDialog(selectedEnv);
pluginErrorRemind(selectedEnv);
pluginErrorRemind();
} catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -302,17 +302,23 @@ public class EnvChangeEntrance {
/**
* 插件启动错误信息提示
* @param selectedEnv 选择的工作环境
*/
public void pluginErrorRemind(DesignerWorkspaceInfo selectedEnv) {
if (selectedEnv.getType() == DesignerWorkspaceType.Remote) {
public void pluginErrorRemind() {
if (!WorkContext.getCurrent().isLocal()) {
return;
}
String content = PluginErrorRemindHandler.pluginErrorContent();
if (StringUtils.isNotEmpty(content)) {
PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content);
dialog.setVisible(true);
// 该操作需要在当前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);
}
});
}
}
@ -431,7 +437,7 @@ public class EnvChangeEntrance {
public void chooseEnv(final String envName) {
final EnvListPane envListPane = new EnvListPane();
final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));
final BasicDialog envListDialog = envListPane.showWindow(DesignerContext.getDesignerFrame());
envListPane.populateEnvManager(envName);
envListDialog.addDialogActionListener(new DialogActionAdapter() {

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

@ -39,6 +39,23 @@ public class PluginClassRefreshManager {
}
};
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;
@ -50,29 +67,20 @@ public class PluginClassRefreshManager {
}
private PluginClassRefreshManager() {
PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
removePluginListener();
}
});
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
addPluginListener();
if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) {
HistoryTemplateListCache.getInstance().reloadAllEditingTemplate();
}
}
});
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.menu.KeySetUtils;
@ -22,7 +22,7 @@ public class AllowAuthorityEditAction extends TemplateComponentAction {
this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.DesignModelAdapter;
@ -19,7 +19,7 @@ public class ExitAuthorityEditAction extends TemplateComponentAction {
public ExitAuthorityEditAction(TargetComponent t) {
super(t);
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;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource;
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.setName(getMenuKeySet().getMenuKeySetName() + "...");
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) {
DesignTableDataManager.fireDSChanged(map);
}
}
}

106
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.ScreenResolution;
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.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
@ -78,6 +80,16 @@ public abstract class UpdateAction extends ShortCut implements Action {
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);
}
/**
* 使用传入资源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) {
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
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
@ -271,6 +310,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
UIMenuItem menuItem = new UIMenuItem(this);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(UIMenuItem.class.getName(), object);
@ -282,6 +323,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
this.putValue(UIMenuItem.class.getName(), menuItem);
return menuItem;
}
@ -296,31 +339,37 @@ public abstract class UpdateAction extends ShortCut implements Action {
if (!(object instanceof AbstractButton)) {
UIButton button = null;
button = new UIButton();
// 添加一个名字作为自动化测试用
button.setName(getName());
button.set4ToolbarButton();
//设置属性.
Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY);
if (mnemonicInteger != null) {
button.setMnemonic((char) mnemonicInteger.intValue());
}
button.setIcon((Icon) this.getValue(Action.SMALL_ICON));
button.addActionListener(this);
object = initButton(button, UIButton.class.getName());
}
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW);
return (JComponent) object;
}
this.putValue(UIButton.class.getName(), button);
button.setText(StringUtils.EMPTY);
button.setEnabled(this.isEnabled());
protected JComponent initButton(UIButton button, String name) {
// 添加一个名字作为自动化测试用
button.setName(getName());
button.set4ToolbarButton();
//peter:产生tooltip
button.setToolTipText(getToolTipText());
object = button;
//设置属性.
Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY);
if (mnemonicInteger != null) {
button.setMnemonic((char) mnemonicInteger.intValue());
}
return (JComponent) object;
button.setIcon((Icon) this.getValue(Action.SMALL_ICON));
setPressedIcon4Button(button);
setDisabledIcon4Button(button);
button.addActionListener(this);
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW);
this.putValue(name, button);
button.setText(StringUtils.EMPTY);
button.setEnabled(this.isEnabled());
//peter:产生tooltip
button.setToolTipText(getToolTipText());
return button;
}
/**
@ -454,6 +503,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
object = new UseMenuItem(this);
this.putValue(UseMenuItem.class.getName(), object);
}
setPressedIcon4Button((UseMenuItem) object);
setDisabledIcon4Button((UseMenuItem) object);
return (UseMenuItem) object;
}
@ -594,4 +645,17 @@ public abstract class UpdateAction extends ShortCut implements Action {
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
}
}
protected void setPressedIcon4Button(AbstractButton button) {
Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON);
if (pressedIcon != null && pressedIcon instanceof SVGIcon) {
button.setPressedIcon(pressedIcon);
}
}
protected 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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
@ -13,15 +13,15 @@ import java.awt.event.ActionEvent;
public class BBSAction extends UpdateAction
{
public BBSAction()
{
this.setMenuKeySet(BBS);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
@ -17,8 +17,7 @@ public class BugAction extends UpdateAction
{ this.setMenuKeySet(BUG);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/bug.png"));
this.setSmallIcon("/com/fr/design/images/bbs/bug");
}
@Override
@ -29,7 +28,7 @@ public void actionPerformed(ActionEvent arg0)
}
public static final MenuKeySet BUG = new MenuKeySet() {
@Override
public String getMenuName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Community_Bug");
@ -43,7 +42,7 @@ public void actionPerformed(ActionEvent arg0)
@Override
public char getMnemonic()
{
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.BugNeedMark;
import com.fr.design.menu.MenuKeySet;
@ -20,7 +20,7 @@ public class BugNeedAction extends UpdateAction {
this.setMenuKeySet(BugAndNeed);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/need.png"));
this.setSmallIcon("/com/fr/design/images/bbs/need");
}
@Override

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

@ -1,6 +1,6 @@
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.utils.BrowseUtils;
import com.fr.general.CloudCenter;
@ -17,7 +17,7 @@ public class CenterAction extends UpAction{
this.setMenuKeySet(CENTER);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.svg.IconUtils;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
@ -14,7 +13,7 @@ public class FacebookFansAction extends UpAction {
this.setMenuKeySet(FACEBOOKFANS);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/facebook.png"));
this.setSmallIcon("/com/fr/design/images/bbs/facebook");
}
@Override

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

@ -1,6 +1,6 @@
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.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
@ -18,7 +18,7 @@ public class NeedAction extends UpdateAction
this.setMenuKeySet(NEED);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
@ -16,7 +16,7 @@ public class QuestionAction extends UpdateAction {
this.setMenuKeySet(QUESTIONS);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
@ -19,8 +19,7 @@ public class SignAction extends UpdateAction
this.setMenuKeySet(SIGN);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/sign.png"));
this.setSmallIcon("/com/fr/design/images/bbs/sign");
}
@Override

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

@ -1,6 +1,6 @@
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.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
@ -21,7 +21,7 @@ public class TechSolutionAction extends UpdateAction{
this.setMenuKeySet(TSO);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.locale.impl.VideoMark;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
@ -20,8 +20,7 @@ public class VideoAction extends UpdateAction
this.setMenuKeySet(VIDEO);
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png"));
this.setSmallIcon("/com/fr/design/images/bbs/video");
}
@Override

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

@ -3,7 +3,6 @@
*/
package com.fr.design.actions.edit;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext;
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.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.setEnabled(!DesignModeContext.isBanCopyAndCut());
}
@ -32,4 +31,4 @@ public class CopyAction extends TemplateComponentAction {
DesignModeContext.doCopy(getEditingComponent());
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;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext;
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.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.setEnabled(!DesignModeContext.isBanCopyAndCut());
}
@ -35,4 +34,4 @@ public class CutAction extends TemplateComponentAction {
public boolean executeActionReturnUndoRecordNeeded() {
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;
import com.fr.base.BaseUtils;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.base.mode.DesignModeContext;
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.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));
}
@ -33,4 +32,4 @@ public class PasteAction extends TemplateComponentAction {
public boolean executeActionReturnUndoRecordNeeded() {
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 com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.TemplateComponentActionInterface;
import com.fr.design.actions.UpdateAction;
@ -23,7 +22,7 @@ public class RedoAction extends UpdateAction implements TemplateComponentActionI
this.setMenuKeySet(KeySetUtils.REDO);
this.setName(getMenuKeySet().getMenuKeySetName());
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());
}
@ -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 com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.TemplateComponentActionInterface;
import com.fr.design.actions.UpdateAction;
@ -23,10 +22,10 @@ public class UndoAction extends UpdateAction implements TemplateComponentActionI
this.setMenuKeySet(KeySetUtils.UNDO);
this.setName(getMenuKeySet().getMenuKeySetName());
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());
}
@Override
public JTemplate<?, ?> getEditingComponent() {
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 com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.KeySetUtils;
@ -17,12 +17,12 @@ import com.fr.file.FILEChooserPane;
* Open Template.
*/
public class OpenTemplateAction extends UpdateAction {
public OpenTemplateAction() {
this.setMenuKeySet(KeySetUtils.OPEN_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName());
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());
}
@ -42,4 +42,4 @@ public class OpenTemplateAction extends UpdateAction {
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 com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils;
@ -20,7 +20,7 @@ public class SaveAsTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
this.setMenuKeySet(KeySetUtils.SAVE_AS_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
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);
}
}
}

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 com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils;
@ -21,7 +20,7 @@ public class SaveTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
this.setMenuKeySet(KeySetUtils.SAVE_TEMPLATE);
this.setName(getMenuKeySet().getMenuKeySetName());
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());
}
@ -42,4 +41,4 @@ public class SaveTemplateAction extends JTemplateAction<JTemplate<?, ?>> {
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.actions.UpdateAction;
@ -21,11 +21,11 @@ public class SwitchExistEnv extends MenuDef {
initMenuDef();
}
private void initMenuDef() {
private void initMenuDef() {
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator();
while (nameIt.hasNext()) {
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(SeparatorDef.DEFAULT);
@ -42,11 +42,11 @@ public class SwitchExistEnv extends MenuDef {
DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
switch (env.getType()) {
case Local: {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png"));
this.setSmallIcon("com/fr/design/images/data/bind/localconnect");
break;
}
case Remote: {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png"));
this.setSmallIcon("com/fr/design/images/data/bind/distanceconnect");
break;
}
}

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

@ -1,10 +1,10 @@
package com.fr.design.actions.help;
import com.fr.base.svg.IconUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
@ -28,7 +28,7 @@ public class TutorialAction extends UpdateAction {
this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName());
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());
}

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

@ -1,6 +1,6 @@
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.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
@ -16,7 +16,7 @@ public class WebDemoAction extends UpdateAction {
this.setMenuKeySet(PRODUCT_DEMO);
this.setName(getMenuKeySet().getMenuName());
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;
import com.fr.base.svg.SVGIcon;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
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.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
@ -21,7 +21,7 @@ public class AlphaFineAction extends UpdateAction {
this.setMenuKeySet(ALPHAFINE);
this.setName(getMenuKeySet().getMenuName());
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());
}

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

@ -5,15 +5,19 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.imenu.UILockMenuItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.menu.MenuKeySet;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.report.LockItem;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
import java.util.Map;
@ -26,7 +30,7 @@ public class ConnectionListAction extends UpdateAction {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
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());
}
@ -53,8 +57,16 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
osBasedAction.execute();
// 尝试为数据连接加锁
boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION);
if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage();
} else {
// 锁定成功,执行后续操作
OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
osBasedAction.execute();
}
}
/**
@ -96,4 +108,21 @@ public class ConnectionListAction extends UpdateAction {
public void update() {
this.setEnabled(true);
}
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UILockMenuItem.class.getName());
if (object == null && !(object instanceof UILockMenuItem)) {
UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, null, LockItem.CONNECTION);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(UILockMenuItem.class.getName(), object);
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object);
}
return (UILockMenuItem) object;
}
}

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

@ -4,6 +4,7 @@
package com.fr.design.actions.server;
import com.fr.base.svg.IconUtils;
import com.fr.config.Configuration;
import com.fr.design.actions.UpdateAction;
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.menu.MenuKeySet;
import com.fr.file.FunctionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
@ -29,7 +29,7 @@ public class FunctionManagerAction extends UpdateAction {
this.setMenuKeySet(FUNCTION_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
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());
}
@ -63,7 +63,7 @@ public class FunctionManagerAction extends UpdateAction {
functionManagerPane.populate(mirror);
functionManagerDialog.setVisible(true);
}
public void update() {
this.setEnabled(true);
}
@ -84,4 +84,4 @@ public class FunctionManagerAction extends UpdateAction {
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;
import com.fr.base.BaseUtils;
import com.fr.base.ParameterConfig;
import com.fr.base.svg.IconUtils;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
@ -31,7 +31,7 @@ public class GlobalParameterAction extends UpdateAction {
this.setMenuKeySet(GLOBAL_PARAMETER);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
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;
}
};
}
}

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

@ -3,7 +3,6 @@
*/
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
@ -13,7 +12,11 @@ import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.tabledatapane.TableDataManagerPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.editlock.ServerTableDataLockChangeChecker;
import com.fr.design.gui.NameInspector;
import com.fr.design.gui.imenu.UILockMenuItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
@ -22,9 +25,10 @@ import com.fr.file.TableDataConfig;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.report.LockItem;
import javax.swing.KeyStroke;
import java.awt.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
@ -40,7 +44,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
this.setMenuKeySet(SERVER_TABLEDATA);
this.setName(getMenuKeySet().getMenuKeySetName());
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() {
@ -66,11 +70,19 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
// 尝试为服务器数据集加锁
boolean actionLock = EditLockUtils.lock(LockItem.SERVER_TABLE_DATA);
if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage();
return;
}
// 锁定成功,执行后续操作
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final TableDataConfig tableDataConfig = TableDataConfig.getInstance();
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {
public void complete() {
TableDataConfig mirror = tableDataConfig.mirror();
populate(mirror);
}
@ -90,7 +102,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog.setDoOKSucceed(false);
return;
}
DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) {
@ -114,9 +125,18 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
// 刷新共有数据集
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
fireDSChanged(globalTableDataPane.getDsChangedNameMap());
// 关闭服务器数据集页面,为其解锁
EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA);
}
}));
}
@Override
public void doCancel() {
super.doCancel();
// 关闭服务器数据集页面,为其解锁
EditLockUtils.unlock(LockItem.SERVER_TABLE_DATA);
}
});
globalTableDataDialog.setVisible(true);
}
@ -166,4 +186,21 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map);
}
}
@Override
public UIMenuItem createMenuItem() {
Object object = this.getValue(UILockMenuItem.class.getName());
if (object == null && !(object instanceof UILockMenuItem)) {
UILockMenuItem menuItem = new UILockMenuItem(this, EditLockUtils.SERVER_TABLEDATA_LOCKED_TOOLTIPS, null, LockItem.SERVER_TABLE_DATA);
// 设置名字用作单元测
menuItem.setName(getName());
setPressedIcon4Button(menuItem);
setDisabledIcon4Button(menuItem);
object = menuItem;
this.putValue(UILockMenuItem.class.getName(), object);
ServerTableDataLockChangeChecker.getInstance().addEditLockChangeListener((UILockMenuItem)object);
}
return (UILockMenuItem) object;
}
}

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

@ -1,6 +1,6 @@
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.menu.MenuKeySet;
import com.fr.design.utils.DesignUtils;
@ -14,7 +14,7 @@ public class PlatformManagerAction extends UpdateAction {
this.setMenuKeySet(PLATEFORM_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());
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;
}
};
}
}

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

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

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

@ -3,11 +3,15 @@
*/
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.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.border.Border;
import java.awt.BasicStroke;
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 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_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 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_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_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");

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

@ -18,7 +18,10 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ibutton.UILockButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.icon.IconPathConstants;
@ -31,8 +34,11 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JTree;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
@ -398,7 +404,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public PreviewTableDataAction(TableDataTree dataTree) {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"));
this.setMnemonic('p');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.PREVIEW_ICON_PATH));
this.setSmallIcon("/com/fr/design/images/m_file/preview");
this.dataTree = dataTree;
}
@ -437,7 +443,24 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public ConnectionTableAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection"));
this.setMnemonic('D');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH));
this.setSmallIcon("/com/fr/design/images/m_web/connection");
}
@Override
public JComponent createToolBarComponent() {
Object object = this.getValue(UILockButton.class.getName());
if (!(object instanceof AbstractButton)) {
UILockButton button = new UILockButton(
EditLockUtils.CONNECTION_LOCKED_ICON,
(Icon) this.getValue(Action.SMALL_ICON),
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS,
getToolTipText()
);
initButton(button, UILockButton.class.getName());
object = button;
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton)object);
}
return (JComponent) object;
}
}

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

@ -247,7 +247,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public EditAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
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) {
@ -265,7 +265,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public RemoveAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"));
this.setMnemonic('R');
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH));
this.setSmallIcon("/com/fr/design/images/control/remove");
}
@Override

47
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.svg.IconUtils;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
@ -7,6 +8,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.ConnectionLockChangeChecker;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UILockButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils;
@ -16,8 +21,12 @@ import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import com.fr.report.LockItem;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
@ -56,6 +65,24 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
refreshItems();
}
@Override
protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) {
editButton = new UILockButton(
EditLockUtils.CONNECTION_LOCKED_ICON,
IconUtils.readIcon("/com/fr/design/images/m_web/connection"),
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS,
StringUtils.EMPTY
);
editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener((UILockButton) editButton);
return editButton;
}
/*
* 刷新ComboBox.items
*/
@ -97,6 +124,14 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
* 弹出对话框编辑Items
*/
protected void editItems() {
// 尝试为数据连接加锁
boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION);
if (!actionLock) {
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
EditLockUtils.showLockMessage();
return;
}
// 锁定成功,执行后续操作
final ConnectionListPane connectionListPane = new ConnectionListPane();
final ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
ConnectionConfig cloned = connectionConfig.mirror();
@ -109,7 +144,8 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
connectionListDialog.setDoOKSucceed(false);
return;
}
// 关闭定义数据连接页面,为其解锁
EditLockUtils.unlock(LockItem.CONNECTION);
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override
public void run() {
@ -129,6 +165,13 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
}));
}
@Override
public void doCancel() {
// 关闭定义数据连接页面,为其解锁
super.doCancel();
EditLockUtils.unlock(LockItem.CONNECTION);
}
});
connectionListDialog.setVisible(true);
refreshItems();
@ -158,4 +201,4 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
}
}
}
}
}

58
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -12,7 +12,7 @@ import java.awt.event.ActionListener;
public abstract class ItemEditableComboBoxPanel extends JPanel {
/**
*
*
*/
private static final long serialVersionUID = 1L;
@ -21,37 +21,29 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
return "";
}
};
protected UIComboBox itemComboBox;
protected UIButton editButton;
protected UIButton refreshButton;
public ItemEditableComboBoxPanel() {
super();
initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
Dimension buttonSize = new Dimension(26, 20);
itemComboBox = new UIComboBox();
itemComboBox.setEnabled(true);
this.add(itemComboBox, BorderLayout.CENTER);
editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png"));
refreshButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4 ,4);
editButton = initEditButton(editButton, buttonSize);
jPanel.add(editButton);
jPanel.add(refreshButton);
this.add(jPanel, BorderLayout.EAST);
Dimension buttonSize = new Dimension(26, 20);
editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
refreshButton.setPreferredSize(buttonSize);
refreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@ -59,32 +51,44 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
}
});
}
protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) {
editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png"));
editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
return editButton;
}
/**
* 给itemComboBox添加ActionListener
*/
public void addComboBoxActionListener(ActionListener l) {
itemComboBox.addActionListener(l);
}
/*
* 刷新itemComboBox的内容
*/
protected void refreshItems() {
// 记录原来选中的Item,重新加载后需要再次选中
Object lastSelectedItem = itemComboBox.getSelectedItem();
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeAllElements();
// 先加EMPTY,再加items
model.addElement(EMPTY);
java.util.Iterator<String> itemIt = items();
while(itemIt.hasNext()) {
model.addElement(itemIt.next());
}
// 再次选中之前选中的Item
int idx = model.getIndexOf(lastSelectedItem);
if(idx < 0) {
@ -92,16 +96,16 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
}
itemComboBox.setSelectedIndex(idx);
}
/*
* 得到其中的itemComboBox所选中的Item
*/
public String getSelectedItem() {
Object selected = itemComboBox.getSelectedItem();
return selected instanceof String ? (String)selected : null;
}
/*
* 选中name项
*/
@ -109,14 +113,14 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.setSelectedItem(name);
}
/*
* 刷新ComboBox.items
*/
protected abstract java.util.Iterator<String> items();
/*
* 弹出对话框编辑Items
*/
protected abstract void editItems();
}
}

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

@ -26,6 +26,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.function.TIME;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
@ -168,6 +169,7 @@ public class PreviewTablePane extends BasicPane {
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame());
GUICoreUtils.centerWindow(DesignerContext.getDesignerFrame(), this.dialog);
}
progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() {

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> {
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 SUB_LENGTH = 4;
private JPanel centerPanel;

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

@ -0,0 +1,25 @@
package com.fr.design.editlock;
import com.fr.report.LockItem;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
* 定义数据连接的checker
*/
public class ConnectionLockChangeChecker extends EditLockChangeChecker{
private static class Holder {
private static final ConnectionLockChangeChecker INSTANCE = new ConnectionLockChangeChecker();
}
public static ConnectionLockChangeChecker getInstance() {
return ConnectionLockChangeChecker.Holder.INSTANCE;
}
public ConnectionLockChangeChecker() {
this.lockItem = LockItem.CONNECTION;
}
}

73
designer-base/src/main/java/com/fr/design/editlock/EditLockChangeChecker.java

@ -0,0 +1,73 @@
package com.fr.design.editlock;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.editlock.EditLockOperator;
import com.fr.report.LockItem;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/19
* 判断当前设计器在远程设计服务器中的锁状态是否发生了改变
*/
public abstract class EditLockChangeChecker {
private static final int INTERVAL = 30000;
private ScheduledExecutorService scheduler;
protected LockItem lockItem;
private boolean isLocked = false;
private List<EditLockChangeListener> listeners = new ArrayList<>();
/**
* 轮询任务如果是远程设计状态每隔30s查询一次相应lockItem的锁状态是否改变
*/
public void start() {
this.scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("EditLockChangeChecker"));
this.scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
// 判断是否为远程设计环境
if (!WorkContext.getCurrent().isLocal()) {
try {
EditLockOperator operator = WorkContext.getCurrent().get(EditLockOperator.class);
boolean locked = operator.isLocked(lockItem);
if (isLocked != locked) {
isLocked = locked;
fireChange();
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}, 0, INTERVAL, TimeUnit.MILLISECONDS);
}
public void stop() {
this.scheduler.shutdown();
}
public void addEditLockChangeListener(EditLockChangeListener listener) {
this.listeners.add(listener);
}
private void fireChange() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (EditLockChangeListener listener : EditLockChangeChecker.this.listeners) {
listener.updateLockedState(new EditLockChangeEvent(isLocked));
}
}
});
}
}

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

@ -0,0 +1,25 @@
package com.fr.design.editlock;
import java.util.EventObject;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class EditLockChangeEvent extends EventObject {
private boolean isLocked;
/**
* @param source 锁状态发生了改变且当前锁状态就是source
*/
public EditLockChangeEvent(boolean source) {
super(source);
this.isLocked = source;
}
public boolean isLocked() {
return isLocked;
}
}

16
designer-base/src/main/java/com/fr/design/editlock/EditLockChangeListener.java

@ -0,0 +1,16 @@
package com.fr.design.editlock;
import java.util.EventListener;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public interface EditLockChangeListener extends EventListener {
/**
* 锁定状态改变后执行的动作
* @param event 事件
*/
void updateLockedState(EditLockChangeEvent event);
}

79
designer-base/src/main/java/com/fr/design/editlock/EditLockUtils.java

@ -0,0 +1,79 @@
package com.fr.design.editlock;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGLoader;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.editlock.EditLockOperator;
import com.fr.report.LockItem;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import java.awt.Image;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
* 关于编辑锁定的一些常量和静态方法
*/
public class EditLockUtils {
/**
* 数据连接锁定标志
*/
public static final Icon CONNECTION_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/images/m_web/connection_locked");
/**
* 小锁图片
*/
public static final @Nullable Image LOCKED_IMAGE = SVGLoader.load("/com/fr/design/images/m_web/locked_normal.svg");
/**
* 提示弹窗中的提示标志
*/
public static final Icon TOOLTIPS_ICON = IOUtils.readIcon("/com/fr/design/images/m_web/warningIcon.png");
/**
* 数据连接锁定中
*/
public static final String CONNECTION_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Data_Connection_Locked");
/**
* 服务器数据集锁定中
*/
public static final String SERVER_TABLEDATA_LOCKED_TOOLTIPS = Toolkit.i18nText("Fine_Designer_Remote_Design_Server_TableData_Locked");
/**
* 提示弹窗中的提示信息
*/
public static final String LOCKED_MESSAGE = Toolkit.i18nText("Fine_Designer_Remote_Design_Locked_Message");
/**
* 提示弹窗中的标题
*/
public static final String TOOLTIPS = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint");
/**
* 已经被锁跳出弹窗提示
*/
public static void showLockMessage() {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), EditLockUtils.LOCKED_MESSAGE, EditLockUtils.TOOLTIPS, JOptionPane.INFORMATION_MESSAGE, EditLockUtils.TOOLTIPS_ICON);
}
public static boolean lock(LockItem lockItem) {
return WorkContext.getCurrent().get(EditLockOperator.class).lock(lockItem);
}
public static boolean unlock(LockItem lockItem) {
return WorkContext.getCurrent().get(EditLockOperator.class).unlock(lockItem);
}
public static boolean isLocked(LockItem lockItem) {
return WorkContext.getCurrent().get(EditLockOperator.class).isLocked(lockItem);
}
}

23
designer-base/src/main/java/com/fr/design/editlock/ServerTableDataLockChangeChecker.java

@ -0,0 +1,23 @@
package com.fr.design.editlock;
import com.fr.report.LockItem;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
* 服务器数据集的checker
*/
public class ServerTableDataLockChangeChecker extends EditLockChangeChecker{
private static class Holder {
private static final ServerTableDataLockChangeChecker INSTANCE = new ServerTableDataLockChangeChecker();
}
public static ServerTableDataLockChangeChecker getInstance() {
return ServerTableDataLockChangeChecker.Holder.INSTANCE;
}
public ServerTableDataLockChangeChecker() {
this.lockItem = LockItem.SERVER_TABLE_DATA;
}
}

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;
}
public UITextField getUITextField() {
return currentTextField;
}
/**
* Return the value of the CellEditor.
*/

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

@ -5,11 +5,11 @@ import com.fr.base.io.BaseBook;
import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.file.filter.ClassFilter;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateFactory;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.ui.util.UIUtil;
@ -474,7 +474,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
String name = template.getEditingFILE().getName();
String pluginId = context.getID();
long start = System.currentTimeMillis();
Set<ClassLoader> set = ClassHelper.getClassLoaders(baseBook);
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) {

4
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.mainframe.DesignerContext;
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.GUIPaintUtils;
import com.fr.file.FILE;
@ -35,7 +36,6 @@ import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
@ -136,7 +136,7 @@ public class MutilTempalteTabPane extends JComponent {
this.addMouseMotionListener(new MultiTemplateTabMouseMotionListener());
this.setBorder(null);
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();
selectedIndex = openedTemplate.size() - 1;
AWTEventListener awt = new AWTEventListener() {

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);
}
}

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);
/**
* 往扩展容器本身中添加粘贴内容
* @param r
* @param <T> 粘贴板选中的组件
* @param <R> 容器布局适配器
*/
<T, R> void formWidgetPaste(T t, R r, int x, int y);
}

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();
}

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) {
// do nothing
}
@Override
public <T, R> void formWidgetPaste(T t, R r, int x, int y) {
// do nothing
}
}

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();
}
}

2
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -247,7 +247,7 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
resultPos.x = listPos.x + nameableList.getParent().getWidth();
}
// 如果右侧显示不下,可以向左移动
int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - popupEditDialog.getWidth() - EDIT_RANGE;
int maxX = frame.getLocationOnScreen().x + frame.getWidth() - popupEditDialog.getWidth() - EDIT_RANGE;
if (resultPos.x > maxX) {
resultPos.x = maxX;
}

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

@ -1,6 +1,7 @@
package com.fr.design.gui.core;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.*;
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"),
BaseUtils.readIcon("/com/fr/design/images/buttonicon/widget/date_16.png"),
"/com/fr/design/images/buttonicon/widget/date_16",
DateEditor.class);
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);
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(
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);
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(
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);
public static final WidgetOption BUTTON = WidgetOptionFactory.createByWidgetClass(
@ -155,23 +156,23 @@ public abstract class WidgetOption implements Serializable {
Button.class);
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);
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);
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);
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);
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);
public static final WidgetOption LIST = WidgetOptionFactory.createByWidgetClass(
@ -181,16 +182,16 @@ public abstract class WidgetOption implements Serializable {
public static final WidgetOption TEXTEDITOR = WidgetOptionFactory.createByWidgetClass(
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);
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);
public static final WidgetOption PASSWORD = WidgetOptionFactory.createByWidgetClass(
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"),
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;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.form.ui.Widget;
import javax.swing.*;
@ -14,4 +15,9 @@ public class WidgetOptionFactory {
public static WidgetOption createByWidgetClass(String optionName, Icon optionIcon, Class<? extends Widget> 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;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.DesignUtils;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
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.FocusEvent;
@ -21,7 +23,7 @@ public class CalendarNumberField extends UINumberField {
private static final int NUM_TEN = 10;
public CalendarNumberField( double maxValue) {
public CalendarNumberField(double maxValue) {
super(2, 0, 0, maxValue);
this.setBorderPainted(false);
addFocusListener(new FocusAdapter() {
@ -30,12 +32,12 @@ public class CalendarNumberField extends UINumberField {
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) {
if (value < 0) {
value = (int)getMaxValue();
value = (int) getMaxValue();
}
if (value > getMaxValue()) {
value = 0;
@ -43,7 +45,7 @@ public class CalendarNumberField extends UINumberField {
this.setText(getValueText(value));
}
public int getIntValue () {
public int getIntValue() {
if (this.getText().length() == 0) {
return 0;
}
@ -61,8 +63,7 @@ public class CalendarNumberField extends UINumberField {
}
public void setFieldDocument(){
public void setFieldDocument() {
setDocument(new NumberDocument());
}
@ -89,14 +90,15 @@ public class CalendarNumberField extends UINumberField {
super.insertString(offset, s, a);
}
private boolean isOverMaxOrMinValue( String strNew) {
return (Double.parseDouble(strNew)<getMinValue() || Double.parseDouble(strNew)>getMaxValue());
private boolean isOverMaxOrMinValue(String strNew) {
return (Double.parseDouble(strNew) < getMinValue() || Double.parseDouble(strNew) > getMaxValue());
}
}
public Dimension getPreferredSize() {
return new Dimension(24, 11);
}
public boolean shouldResponseChangeListener() {
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.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
@ -45,8 +45,8 @@ import java.util.Calendar;
import java.util.Date;
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_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"),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"), Font.PLAIN, 12);
private static final int WEEKDAY_COUNT = 7;
private static final int TOTAL_DAYS_COUNT = 42;
@ -108,13 +108,13 @@ public class UICalendarPanel extends JPanel {
}
// << < yyyy/MM/dd > >>
private JPanel createNorthPane () {
private JPanel createNorthPane() {
JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
pNorth.setBackground(new Color(0xFFFFFF));
pNorth.setPreferredSize(new Dimension(1, 22));
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_hover.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.setBackground(new Color(0xFFFFFF));
monthLabel.setForeground(new Color(0x000000));
monthLabel.setFont(FONT_SONG);
monthLabel.setFont(FONT_UI);
pNorth.add(Box.createHorizontalGlue());
pNorth.add(monthLabel);
pNorth.add(Box.createHorizontalGlue());
@ -144,7 +144,7 @@ public class UICalendarPanel extends JPanel {
monthPlus.setHorizontalAlignment(SwingConstants.RIGHT);
pNorth.add(monthPlus);
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_hover.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.setBackground(new Color(0xFFFFFF));
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"),
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")
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_Fri"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat")
};
for (int i = 1; i <= WEEKDAY_COUNT; i++) {
UILabel label = new UILabel();
@ -197,32 +197,32 @@ public class UICalendarPanel extends JPanel {
return pCenter;
}
private JPanel createSouthPane () {
private JPanel createSouthPane() {
JPanel sPane = new JPanel();
sPane.setPreferredSize(new Dimension(216, 30));
sPane.setBackground(Color.WHITE);
sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6));
UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":");
timeLabel.setBorder(BorderFactory.createEmptyBorder(0,9,0,5));
timeLabel.setFont(FONT_SONG);
timeLabel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 5));
timeLabel.setFont(FONT_UI);
sPane.add(timeLabel);
hms = new HMSPane();
sPane.add(hms);
UILabel gap = new UILabel();
gap.setPreferredSize(new Dimension(26,1));
gap.setPreferredSize(new Dimension(26, 1));
sPane.add(gap);
UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) {
public Dimension getPreferredSize() {
return new Dimension(32,18);
return new Dimension(32, 18);
}
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
}
};
okButton.setFont(FONT_SONG);
okButton.setFont(FONT_UI);
okButton.setVerticalAlignment(SwingConstants.CENTER);
okButton.addActionListener(new ActionListener() {
@ -248,11 +248,12 @@ public class UICalendarPanel extends JPanel {
/**
* 创建上一月,下一月,上一年,下一年"按钮"
* @param field int
*
* @param field int
* @param amount int
* @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) {
return new UILabel();
}
@ -274,11 +275,11 @@ public class UICalendarPanel extends JPanel {
}
public void mouseEntered(MouseEvent e) {
label.setIcon(icons[1]);
label.setIcon(icons[1]);
}
public void mouseExited(MouseEvent e) {
label.setIcon(icons[0]);
label.setIcon(icons[0]);
}
public void mousePressed(MouseEvent e) {
@ -311,7 +312,7 @@ public class UICalendarPanel extends JPanel {
gp.setBorder(null);
UIDayLabel label = new UIDayLabel(setupCalendar.getTime());
label.setHorizontalAlignment(SwingConstants.RIGHT);
label.setBorder(BorderFactory.createEmptyBorder(0,0,0,9));
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 9));
label.addMouseListener(dayBttListener);
if ("1".equals(label.getText())) {
isCurrentMonth = !isCurrentMonth;
@ -328,7 +329,7 @@ public class UICalendarPanel extends JPanel {
days.setSelectedIndex(i);
this.selectedDate = label.getDate();
this.calendar.setTime(this.selectedDate);
}else {
} else {
gp.add(label, BorderLayout.CENTER);
days.add(gp);
}
@ -337,7 +338,7 @@ public class UICalendarPanel extends JPanel {
}
public void updateHMS() {
if (hms != null){
if (hms != null) {
hms.populate(this.calendar);
hms.validate();
}
@ -388,9 +389,9 @@ public class UICalendarPanel extends JPanel {
public void mousePressed(MouseEvent e) {
if (isEnabled()) {
UIDayLabel com = (UIDayLabel) e.getComponent();
GradientPane gp = (GradientPane)com.getParent();
GradientPane gp = (GradientPane) com.getParent();
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));
days.setSelectedIndex(gp.getIndex());
@ -413,7 +414,7 @@ public class UICalendarPanel extends JPanel {
public void mouseEntered(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane)com.getParent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() == days.selectedIndex) {
return;
}
@ -426,7 +427,7 @@ public class UICalendarPanel extends JPanel {
public void mouseExited(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane)com.getParent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() != days.selectedIndex) {
gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
}
@ -489,7 +490,7 @@ public class UICalendarPanel extends JPanel {
this.isGradientBackground = isGradientBackground;
}
public void paint(Graphics g){
public void paint(Graphics g) {
super.paint(g);
if (isGradientBackground && gradientBackground != null) {
gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight()));
@ -509,7 +510,7 @@ public class UICalendarPanel extends JPanel {
this.index = i;
}
public int getIndex () {
public int getIndex() {
return this.index;
}
@ -530,12 +531,12 @@ public class UICalendarPanel extends JPanel {
public DayPane() {
floateIndex = -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.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(0xDADADA)));
}
public void paint (Graphics g) {
public void paint(Graphics g) {
super.paint(g);
int width = 31;
int height = 19;
@ -543,11 +544,11 @@ public class UICalendarPanel extends JPanel {
g.setColor(new Color(0xDADADA));
int start_x = 30;
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());
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);
start_y += height;
}
@ -558,25 +559,25 @@ public class UICalendarPanel extends JPanel {
}
if (selectedIndex > -1) {
g.setColor(selectedColor);
paintChindPane(g,selectedIndex);
paintChindPane(g, selectedIndex);
}
g.setColor(oldColor);
}
private void paintChindPane(Graphics g, int index) {
if (index%7 == 0 ) {
int y1 = index/7*19;
g.drawLine(0,y1,30,y1);
g.drawLine(0,y1 + 19, 30, y1 +19);
g.drawLine(30, y1, 30 ,y1 + 19);
}else if (index%7 == 6) {
int y1 = index/7*19;
g.drawLine(185,y1,216,y1);
g.drawLine(185,y1 + 19, 216, y1 +19);
g.drawLine(185, y1, 185 ,y1 + 19);
if (index % 7 == 0) {
int y1 = index / 7 * 19;
g.drawLine(0, y1, 30, y1);
g.drawLine(0, y1 + 19, 30, y1 + 19);
g.drawLine(30, y1, 30, y1 + 19);
} else if (index % 7 == 6) {
int y1 = index / 7 * 19;
g.drawLine(185, y1, 216, y1);
g.drawLine(185, y1 + 19, 216, y1 + 19);
g.drawLine(185, y1, 185, y1 + 19);
} else {
int x1 = index%7*31 -1;
int y1 = index/7*19;
int x1 = index % 7 * 31 - 1;
int y1 = index / 7 * 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 UIButton preButton;
private UIButton nextButton;
@ -608,7 +609,7 @@ public class UICalendarPanel extends JPanel {
private CalendarNumberField sField;
private CalendarNumberField selectedNumberField;
public HMSPane () {
public HMSPane() {
this.setPreferredSize(new Dimension(101, 18));
this.setLayout(new BorderLayout(0, 0));
this.setBackground(null);
@ -633,7 +634,7 @@ public class UICalendarPanel extends JPanel {
}
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.setBorder(null);
@ -649,13 +650,13 @@ public class UICalendarPanel extends JPanel {
jp.add(sField);
this.add(jp, BorderLayout.CENTER);
preButton = new UIButton(UIConstants.ARROW_UP_ICON){
preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
};
preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON){
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
@ -673,7 +674,7 @@ public class UICalendarPanel extends JPanel {
MouseAdapter backgroundAdapter = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
HMSPane.this.selectedNumberField = (CalendarNumberField)e.getComponent();
HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent();
}
@Override
@ -710,17 +711,17 @@ public class UICalendarPanel extends JPanel {
});
}
private UILabel createGapLabel () {
private UILabel createGapLabel() {
UILabel uiLabel = new UILabel(":");
uiLabel.setHorizontalAlignment(SwingConstants.CENTER);
uiLabel.setBackground(null);
uiLabel.setBorder(null);
uiLabel.setPreferredSize(new Dimension(6,10));
uiLabel.setPreferredSize(new Dimension(6, 10));
return uiLabel;
}
public Insets getInsets() {
return new Insets(1,3,1,0);
return new Insets(1, 3, 1, 0);
}
public void paint(Graphics g) {
@ -729,7 +730,7 @@ public class UICalendarPanel extends JPanel {
}
public void paintBorder(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
Graphics2D g2d = (Graphics2D) g;
if (isRolOver) {
Shape shape = new RoundRectangle2D.Double(1, 1, 86, 15, UIConstants.ARC, UIConstants.ARC);
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.mField.setValue(calendar.get(Calendar.MINUTE));
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();
UICalendarPanel calendarPanel = new UICalendarPanel();
final UITextField field = new UITextField();
field.setPreferredSize(new Dimension(120, 25));
calendarPanel.addDateChangeListener(new ChangeListener(){
public void stateChanged(ChangeEvent e){
Date selectedDate = (Date)e.getSource();
calendarPanel.addDateChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
Date selectedDate = (Date) e.getSource();
SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd");
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;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import java.awt.Dimension;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.Date;
public class UIDayLabel extends UILabel {
private Date date = null;
@ -28,13 +27,13 @@ public class UIDayLabel extends UILabel {
public UIDayLabel(Date date, boolean isSmallLabel) {
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;
setPreferredSize(new Dimension(30, 18));
if (isSmallLabel) {
setText(dayFormat.format(date));
} 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()));
}
}

24
designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPaneWithPercent.java

@ -0,0 +1,24 @@
package com.fr.design.gui.frpane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPercent;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-21
*/
public class UINumberDragPaneWithPercent extends UINumberDragPane {
public UINumberDragPaneWithPercent(double minValue, double maxValue) {
super(minValue, maxValue);
}
public UINumberDragPaneWithPercent(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta);
}
protected UISpinner createUISpinner(double minValue, double maxValue, double dierta) {
return new UISpinnerWithPercent(minValue, maxValue, dierta, minValue);
}
}

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.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.CellBorderStyle;
import com.fr.base.GraphHelper;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
@ -97,6 +98,14 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
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() {
if (shouldResponseChangeListener()) {
this.addActionListener(new ActionListener() {
@ -388,4 +397,4 @@ public class UIButton extends JButton implements UIObserver, UITextComponent {
public boolean shouldResponseChangeListener() {
return true;
}
}
}

55
designer-base/src/main/java/com/fr/design/gui/ibutton/UILockButton.java

@ -0,0 +1,55 @@
package com.fr.design.gui.ibutton;
import com.fr.design.editlock.EditLockChangeEvent;
import com.fr.design.editlock.EditLockChangeListener;
import com.fr.design.editlock.EditLockUtils;
import com.fr.report.LockItem;
import javax.swing.Icon;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class UILockButton extends UIButton implements EditLockChangeListener {
/**
* 锁定状态图标
*/
private Icon lockedIcon;
/**
* 正常状态图标
*/
private Icon normalIcon;
/**
* 锁定状态的提示信息
*/
private String lockedTooltips;
/**
* 正常状态的提示信息
*/
private String normalTooltips;
public UILockButton(Icon lockedIcon, Icon normalIcon, String lockedTooltips, String normalTooltips) {
super();
this.lockedIcon = lockedIcon;
this.normalIcon = normalIcon;
this.lockedTooltips = lockedTooltips;
this.normalTooltips = normalTooltips;
init();
}
private void init() {
boolean locked = EditLockUtils.isLocked(LockItem.CONNECTION);
this.setIcon(locked ? lockedIcon : normalIcon);
this.setToolTipText(locked ? lockedTooltips : normalTooltips);
}
@Override
public void updateLockedState(EditLockChangeEvent event) {
this.setIcon(event.isLocked() ? lockedIcon : normalIcon);
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips);
this.repaint();
}
}

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

@ -106,6 +106,13 @@ public class TableViewList extends UIList {
if (!status) {
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);
}

47
designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItem.java

@ -0,0 +1,47 @@
package com.fr.design.gui.imenu;
import com.fr.design.editlock.EditLockChangeEvent;
import com.fr.design.editlock.EditLockChangeListener;
import com.fr.report.LockItem;
import javax.swing.Action;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class UILockMenuItem extends UIMenuItem implements EditLockChangeListener {
/**
* 锁定状态的提示信息
*/
private String lockedTooltips;
/**
* 正常状态的提示信息
*/
private String normalTooltips;
/**
* 当前锁定项
*/
private LockItem lockItem;
public UILockMenuItem(Action action, String lockedTooltips, String normalTooltips, LockItem lockItem) {
super(action);
this.lockedTooltips = lockedTooltips;
this.normalTooltips = normalTooltips;
this.lockItem = lockItem;
setUI(new UILockMenuItemUI());
}
public LockItem getLockItem() {
return lockItem;
}
@Override
public void updateLockedState(EditLockChangeEvent event) {
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips);
this.repaint();
}
}

28
designer-base/src/main/java/com/fr/design/gui/imenu/UILockMenuItemUI.java

@ -0,0 +1,28 @@
package com.fr.design.gui.imenu;
import com.fr.design.editlock.EditLockUtils;
import javax.swing.JMenuItem;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
* @author Yvan
* @version 10.0
* Created by Yvan on 2021/1/20
*/
public class UILockMenuItemUI extends UIMenuItemUI{
@Override
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
super.paintText(g, menuItem, textRect, text);
// 除了绘制text之外,还需要画一下锁定图标
UILockMenuItem lockMenuItem = (UILockMenuItem) menuItem;
if (EditLockUtils.isLocked(lockMenuItem.getLockItem())) {
int width = menuItem.getWidth();
int height = menuItem.getHeight();
g.drawImage(EditLockUtils.LOCKED_IMAGE, (int) Math.round(width * 0.9), (int) Math.round(height * 0.1), 16, 16, null);
}
}
}

26
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -13,15 +13,28 @@ import com.fr.stable.CommonUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.utils.MathUtils;
import javax.swing.*;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ButtonUI;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver {
@ -46,6 +59,9 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
*/
private int numberFieldColumns;
public UISpinner() {
}
public UISpinner(double minValue, double maxValue, double dierta) {
init(minValue, maxValue, dierta);
@ -56,7 +72,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.setValue(defaultValue);
}
private void init(double minValue, double maxValue, double dierta) {
protected void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue;
this.maxValue = maxValue;
this.dierta = dierta;

15
designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPercent.java

@ -0,0 +1,15 @@
package com.fr.design.gui.ispinner.chart;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-21
*/
public class UISpinnerWithPercent extends UISpinnerWithUnit {
private static final String UNIT = "%";
public UISpinnerWithPercent(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue, UNIT);
}
}

20
designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithPx.java

@ -0,0 +1,20 @@
package com.fr.design.gui.ispinner.chart;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-21
*/
public class UISpinnerWithPx extends UISpinnerWithUnit {
private static final String UNIT = "px";
public UISpinnerWithPx(double defaultValue) {
this(0, Double.MAX_VALUE, 1, defaultValue);
}
public UISpinnerWithPx(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue, UNIT);
this.getTextField().canFillNegativeNumber(false);
}
}

26
designer-base/src/main/java/com/fr/design/gui/ispinner/chart/UISpinnerWithUnit.java

@ -0,0 +1,26 @@
package com.fr.design.gui.ispinner.chart;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UINumberFieldWithUnit;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-20
*/
public class UISpinnerWithUnit extends UISpinner {
private String unit;
public UISpinnerWithUnit(double minValue, double maxValue, double dierta, double defaultValue, String unit) {
this.unit = unit;
init(minValue, maxValue, dierta);
getTextField().setValue(defaultValue);
}
@Override
protected UINumberField initNumberField() {
return new UINumberFieldWithUnit(3, unit);
}
}

22
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java

@ -1,16 +1,15 @@
package com.fr.design.gui.itextfield;
import com.fr.base.Utils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
import java.awt.Dimension;
import java.awt.Toolkit;
/**
* Number Field.
@ -193,7 +192,6 @@ public class UINumberField extends UITextField {
if (!fillNegativeNumber && strNew.contains("-")) {
return true;
}
boolean noChange = false;
boolean isMinus = strNew.startsWith("-");
strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数
String strIntPart;
@ -207,25 +205,27 @@ public class UINumberField extends UITextField {
}
if (isOverMaxOrMinValue(strIntPart, strDecPart, strNew)) {
Toolkit.getDefaultToolkit().beep();
noChange = true;
return true;
}
return checkNumber(strNew, isMinus);
}
protected boolean checkNumber(String strValue, boolean isMinus) {
try {
if (!ComparatorUtils.equals(strNew, StringUtils.EMPTY) && !ComparatorUtils.equals(strNew, "-")) {// 控制能输入负数
double d = Double.parseDouble(strNew) * (isMinus ? -1 : 1);
if (!ComparatorUtils.equals(strValue, StringUtils.EMPTY) && !ComparatorUtils.equals(strValue, "-")) {// 控制能输入负数
double d = Double.parseDouble(strValue) * (isMinus ? -1 : 1);
if (d < minValue || d > maxValue) {
throw new Exception();
}
}
} catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
noChange = true;
return true;
}
return noChange;
return false;
}
private boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
boolean checkLength = strIntPart.length() > maxIntegerLength
|| strDecPart.length() > maxDecimalLength;
return checkLength || (strNew.length() > 1 && ComparatorUtils.equals(strNew.substring(0, 1), "0") && !ComparatorUtils.equals(strNew.substring(1, 2), "."));

114
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberFieldWithUnit.java

@ -0,0 +1,114 @@
package com.fr.design.gui.itextfield;
import com.fr.base.Utils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.awt.Toolkit;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2021-01-20
* 这个控件不会限制输入的数字大小但是同样不允许输入数字之外的字符
*/
public class UINumberFieldWithUnit extends UINumberField {
private String unit;
private List<String> unitList = new ArrayList<>();
public UINumberFieldWithUnit(int columns, String unit) {
super(columns);
this.unit = unit;
initUnitList();
}
//对单位的字符进行组合
private void initUnitList() {
char[] chars = unit.toCharArray();
Set<String> set = new LinkedHashSet<>();
initUnitList(chars, 0, StringUtils.EMPTY, set);
unitList.addAll(set);
Collections.sort(unitList, Comparator.comparing(String::length));
}
private void initUnitList(char[] chars, int index, String str, Set<String> set) {
if (index == chars.length) {
return;
}
for (int i = index; i < chars.length; i++) {
String newStr = str + chars[i];
set.add(newStr);
initUnitList(chars, i + 1, newStr, set);
}
}
public void setFieldDocument() {
setDocument(new NumberDocumentNoLimit());
}
public void setValue(double value) {
this.setText(Utils.doubleToString(value) + unit);
}
public double getValue() throws NumberFormatException {
try {
String text = this.getText();
if (StringUtils.isEmpty(text)) {
return 0;
}
return Double.parseDouble(text.replace(getEndString(text), StringUtils.EMPTY));
} catch (NumberFormatException numberFormatException) {
return UINumberField.ERROR_VALUE;
}
}
private String getEndString(String text) {
int size = unitList.size();
for (int i = size - 1; i >= 0; i--) {
String unit = unitList.get(i);
if (text.endsWith(unit)) {
return unit;
}
}
return StringUtils.EMPTY;
}
class NumberDocumentNoLimit extends NumberDocument {
public boolean checkString(int offset, String s, String str) {
return (ComparatorUtils.equals(s, "F")
|| ComparatorUtils.equals(s, "f")
|| ComparatorUtils.equals(s, "D")
|| ComparatorUtils.equals(s, "d")
|| (ComparatorUtils.equals(s, ".") && getMaxDecimalLength() == 0));
}
protected boolean isOverMaxOrMinValue(String strIntPart, String strDecPart, String strNew) {
return super.isOverMaxOrMinValue(strIntPart, strDecPart, strNew.replaceFirst(getEndString(strNew), StringUtils.EMPTY));
}
protected boolean checkNumber(String strValue, boolean isMinus) {
try {
if (ComparatorUtils.equals(strValue, StringUtils.EMPTY) || ComparatorUtils.equals(strValue, "-")) {
return false;
}
Double.parseDouble(strValue.replaceFirst(getEndString(strValue), StringUtils.EMPTY));
} catch (Exception e) {
Toolkit.getDefaultToolkit().beep();
return true;
}
return false;
}
}
}

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.workspace.WorkContext;
import java.util.HashMap;
import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
@ -21,7 +23,6 @@ import javax.swing.tree.TreePath;
import java.awt.Color;
import java.awt.Component;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
/*
@ -199,14 +200,14 @@ public class EnvFileTree extends RefreshableJTree {
// 用FileNodeFilter过滤一下
if (filter != null) {
java.util.List<FileNode> tList = new ArrayList<FileNode>();
for (int i = 0; i < resFns.length; i++) {
if (filter.accept(resFns[i])) {
tList.add(resFns[i]);
Map<String, FileNode> fileNodes = new HashMap<>();
for (FileNode fileNode : resFns) {
// war包部署下会生成两份classes目录,需要去重一下
if (filter.accept(fileNode)) {
fileNodes.put(fileNode.getName(), fileNode);
}
}
resFns = tList.toArray(new FileNode[tList.size()]);
resFns = fileNodes.values().toArray(new FileNode[fileNodes.size()]);
}
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;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.IOFileNodeFilter;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -32,7 +34,7 @@ public class ReportletPane extends BasicPane {
textPane.setEditable(false);
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"));
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -41,6 +43,7 @@ public class ReportletPane extends BasicPane {
switchButton = new UIButton("switch");
centerPane.add(GUICoreUtils.createBorderPane(switchButton, BorderLayout.WEST), BorderLayout.NORTH);
switchButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
switchCardPane(t_panel.isVisible());
}
@ -50,12 +53,12 @@ public class ReportletPane extends BasicPane {
centerPane.add(cardPane, BorderLayout.CENTER);
cardPane.setLayout(card = new CardLayout());
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);
cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE");
classReportletTree = new ClassFileTree();
cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS");
this.refreshEnv();
}
@ -75,8 +78,9 @@ public class ReportletPane extends BasicPane {
/**
* 检查是否符合规范
*
* @throws Exception 抛错
* @throws Exception 抛错
*/
@Override
public void checkValid() throws Exception {
String path = this.getSelectedReportletPath();
if (path == null) {
@ -89,7 +93,7 @@ public class ReportletPane extends BasicPane {
* 刷新Env
*/
public void refreshEnv() {
this.templateReportletTree.refreshEnv();
this.classReportletTree.refreshEnv();
}

6
designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java

@ -6,6 +6,7 @@ import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
@ -469,6 +470,11 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
globalNameListener = listener;
}
public void registerChangeListener(UIObserverListener listener) {
typeComboBox.registerChangeListener(listener);
textField.registerChangeListener(listener);
}
@Override
public boolean shouldResponseNameListener() {
return false;

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_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_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 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";

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

@ -316,7 +316,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public NewFolderAction() {
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
@ -342,7 +342,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private class VcsAction extends UpdateAction {
public VcsAction() {
this.setSmallIcon(VcsHelper.VCS_LIST_PNG);
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list");
}
@Override
@ -424,7 +424,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public ShowInExplorerAction() {
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
@ -441,7 +441,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public RefreshTreeAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh"));
this.setSmallIcon(UIConstants.REFRESH_ICON);
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/refresh");
}
@Override
@ -459,7 +459,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public RenameAction() {
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
@ -498,7 +498,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public DelFileAction() {
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

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

@ -1,7 +1,7 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -15,9 +15,9 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.menu.SnapChatUtil;
import com.fr.design.notification.SnapChat;
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.GUIPaintUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
@ -99,7 +99,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public enum PropertyMode {
REPORT, // 报表
REPORT_PARA, // 报表参数面板
REPORT_PARA_WIDGET, //报表参数面板中的控件
REPORT_PARA(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板
REPORT_FLOAT, // 报表悬浮元素
FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单
FORM_REPORT, // 表单报表块
@ -272,27 +273,27 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素
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});
// 单元格属性
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});
// 悬浮元素
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});
// 控件设置
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},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
"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.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"),
"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});
// 超级链接
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});
// 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"),
@ -701,9 +702,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
// 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix
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_DISABLED = "_disabled.png";
private static final String ICON_SUFFIX_SELECTED = "_selected.png";
private static final String ICON_SUFFIX_NORMAL = "_normal.svg";
private static final String ICON_SUFFIX_DISABLED = "_disabled.svg";
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 iconBaseDir;
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
@ -888,7 +891,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void resetButtonIcon() {
if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) {
iconSuffix = ICON_SUFFIX_NORMAL;
button.setIcon(BaseUtils.readIcon(getBtnIconUrl()));
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setBackground(originBtnBackground);
button.setOpaque(false);
}
@ -897,7 +900,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void setTabButtonSelected() {
resetPropertyIcons();
iconSuffix = ICON_SUFFIX_SELECTED;
button.setIcon(BaseUtils.readIcon(getBtnIconUrl()));
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setBackground(selectedBtnBackground);
button.setOpaque(true);
selectedItem = this;
@ -908,7 +911,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
private void initButton() {
button = new UIButton(BaseUtils.readIcon(getBtnIconUrl())) {
button = new UIButton(IconUtils.readIcon(getBtnIconUrl())) {
public Dimension getPreferredSize() {
return new Dimension(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
}
@ -921,6 +924,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
}
};
button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED));
button.set4LargeToolbarButton();
button.setUI(new UIButtonUI() {
@Override
@ -1247,7 +1251,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
super.paint(g);
Image button;
g.setColor(new Color(69, 135, 255));
g.setFont(FRFont.getInstance().applySize(14));
g.setFont(DesignUtils.getDefaultGUIFont().applySize(14));
if (buttonType.equals(NO_BUTTON)) {
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.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
@ -37,7 +37,6 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
@ -60,7 +59,6 @@ public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
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_HEIGHT = 20;
private static final int HALF_HUNDRED = 50;
@ -194,9 +192,9 @@ public class JSliderPane extends JPanel {
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
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.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
customButton.setFont(DesignUtils.getDefaultGUIFont());
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
@ -265,7 +263,7 @@ public class JSliderPane extends JPanel {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
percent.setFont(DesignUtils.getDefaultGUIFont());
spinnerPanel.add(percent);
spinnerPanel.setBackground(BACK_COLOR);
return spinnerPanel;

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

@ -340,17 +340,24 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void refreshResource(FILE file) {
try {
this.template = JTemplateFactory.asIOFile(file);
setTarget(this.template);
setTargetByFile(file);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
// 先移除旧的。
removeCenterPane();
// 加入新的
addCenterPane();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
refreshToolArea();
}
});
}
private void setTargetByFile(FILE file) {
this.template = JTemplateFactory.asIOFile(file, this.suffix());
setTarget(this.template);
}
private void addCenterPane() {

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

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.third.joda.time.DateTime;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
@ -27,7 +29,7 @@ import java.util.Map;
* @version 10.0
* 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";
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";
@ -338,4 +340,19 @@ public class ChartInfo extends AbstractPointInfo {
chartInfo.chartConfigInfo = chartConfigInfo.clone();
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.third.joda.time.DateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -269,7 +272,10 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
writer.end();
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);
}
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]);
}
}

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

14
designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java

@ -1,18 +1,17 @@
package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.ConnectionConfig;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.report.LockItem;
import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager;
/**
@ -68,9 +67,18 @@ public class DatabaseDialogAction implements OSBasedAction {
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
// 定义数据连接弹窗关闭后,解锁
EditLockUtils.unlock(LockItem.CONNECTION);
}
}));
}
@Override
public void doCancel() {
super.doCancel();
// 定义数据连接弹窗关闭后,解锁
EditLockUtils.unlock(LockItem.CONNECTION);
}
});
databaseListDialog.setVisible(true);
}

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

Loading…
Cancel
Save