diff --git a/designer-base/src/main/java/com/fr/base/svg/IconUtils.java b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java new file mode 100644 index 0000000000..119471dcee --- /dev/null +++ b/designer-base/src/main/java/com/fr/base/svg/IconUtils.java @@ -0,0 +1,105 @@ +package com.fr.base.svg; + +import com.fr.general.IOUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +/** + * 主要是用来读取svgIcon的工具类 + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/23 + */ +public class IconUtils { + + private static final String ICON_SUFFIX_SVG = ".svg"; + private static final String ICON_SUFFIX_PNG = ".png"; + private static final String ICON_SUFFIX_GIF = ".gif"; + private static final String SUFFIX_SEPARATOR = "."; + + public static final String ICON_TYPE_NORMAL= "_normal.svg"; + public static final String ICON_TYPE_DISABLED= "_disabled.svg"; + public static final String ICON_TYPE_PRESSED= "_pressed.svg"; + + + /** + * 可以读取SVG图标或者普通图标,并且可以读取不带扩展名的文件 + * 不带扩展名时以svg优先、其次png,最后gif + * @param resource 图片路径 + * @return 图标 + */ + public static Icon readIcon(String resource) { + // 判断是否有.XXX文件后缀 + if (resource.contains(SUFFIX_SEPARATOR)) { + // 判断是否以.svg结尾 + if (resource.endsWith(ICON_SUFFIX_SVG)) { + return SVGIcon.readSVGIcon(resource); + } + return IOUtils.readIcon(resource); + } + // 文件无后缀时 + return readNoSuffixResource(resource, ICON_TYPE_NORMAL); + } + + /** + * 尝试读取不带扩展名的图标,svg优先,其次png,最后gif,都没读到就打印错误日志,返回空白Icon + * @param resource 图片路径 + * @param svgIconType 针对svg来说的图标类型 + * 取值为:ICON_TYPE_NORMAL、ICON_TYPE_DISABLED、ICON_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); + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java b/designer-base/src/main/java/com/fr/base/svg/SVGIcon.java new file mode 100644 index 0000000000..aebb22ae14 --- /dev/null +++ b/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); + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java b/designer-base/src/main/java/com/fr/base/svg/SVGLoader.java new file mode 100644 index 0000000000..3c0b7a0363 --- /dev/null +++ b/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; + } + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java b/designer-base/src/main/java/com/fr/base/svg/SVGTranscoder.java new file mode 100644 index 0000000000..dd47bc5757 --- /dev/null +++ b/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 iconMaxSize = new AtomicNotNullLazyValue() { + @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 = "\n" + + " \n" + + " \n" + + " \n" + + "\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); + } +} diff --git a/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java b/designer-base/src/main/java/com/fr/base/svg/SystemScaleUtils.java new file mode 100644 index 0000000000..4b79748065 --- /dev/null +++ b/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 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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 0ddb749269..2b36bd45f1 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -1,6 +1,7 @@ package com.fr.design; import com.fr.common.report.ReportState; +import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -35,6 +36,7 @@ import com.fr.process.engine.core.FineProcessContext; import com.fr.rpc.Result; import com.fr.stable.AssistUtils; import com.fr.stable.StringUtils; +import com.fr.env.PluginErrorRemindDialog; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; @@ -144,6 +146,7 @@ public class EnvChangeEntrance { template.refreshToolArea(); } showServiceDialog(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"); @@ -297,6 +300,28 @@ public class EnvChangeEntrance { } } + /** + * 插件启动错误信息提示 + */ + public void pluginErrorRemind() { + if (!WorkContext.getCurrent().isLocal()) { + return; + } + + String content = PluginErrorRemindHandler.pluginErrorContent(); + if (StringUtils.isNotEmpty(content)) { + // 该操作需要在当前awt操作之后执行,使用SwingUtilities.invokeLater将其置于awt操作对列末尾 + // 若使用UIUtil.invokeLaterIfNeeded,会立即执行,影响其他UI操作 + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + PluginErrorRemindDialog dialog = new PluginErrorRemindDialog(DesignerContext.getDesignerFrame(), content); + dialog.setVisible(true); + } + }); + } + } + /** * 判断是否需要做版本验证,判断依据为 * 1、选择的环境为远程环境 diff --git a/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java new file mode 100644 index 0000000000..4ff6beda24 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/PluginClassRefreshManager.java @@ -0,0 +1,86 @@ +package com.fr.design; + +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.HyperlinkProvider; +import com.fr.design.fun.TableDataDefineProvider; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; +import java.util.HashSet; +import java.util.Set; + +/** + * + * @author hades + * @version 10.0 + * Created by hades on 2020/12/17 + */ +public class PluginClassRefreshManager { + + + private static final PluginClassRefreshManager INSTANCE = new PluginClassRefreshManager(); + + private final Set context = new HashSet<>(); + + private final PluginEventListener pluginAfterRunEventListener = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + // 兼容之前版本特性 + for (String tag : context) { + if (event.getContext().contain(tag)) { + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); + return; + } + } + // 重新载入模板xml内容 到 Workbook/Form对象中 + HistoryTemplateListCache.getInstance().reloadAllEditingTemplateByPlugin(event.getContext()); + } + }; + + private final PluginEventListener beforeAllPluginActive = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginListenerRegistration.getInstance().stopListen(pluginAfterRunEventListener); + } + }; + + private final PluginEventListener afterAllPluginsActive = new PluginEventListener() { + @Override + public void on(PluginEvent event) { + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, pluginAfterRunEventListener); + if (DesignerLaunchStatus.getStatus() != DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE) { + HistoryTemplateListCache.getInstance().reloadAllEditingTemplate(); + } + } + }; + + + public static PluginClassRefreshManager getInstance() { + return INSTANCE; + } + + public void load() { + context.add(TableDataDefineProvider.XML_TAG); + context.add(HyperlinkProvider.XML_TAG); + } + + private PluginClassRefreshManager() { + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive); + } + + public void removePluginListener() { + PluginListenerRegistration.getInstance().stopListen(this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().stopListen(this.beforeAllPluginActive); + PluginListenerRegistration.getInstance().stopListen(this.afterAllPluginsActive); + } + + public void addPluginListener() { + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginAfterRunEventListener); + PluginListenerRegistration.getInstance().listen(PluginEventType.BeforeAllActive, beforeAllPluginActive); + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterAllActive, afterAllPluginsActive); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java index 507632c72a..1a0509d267 100644 --- a/designer-base/src/main/java/com/fr/design/actions/AllowAuthorityEditAction.java +++ b/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 { } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java b/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java index 44bd365a25..77ae198d0f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/ExitAuthorityEditAction.java +++ b/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"); } diff --git a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java b/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java index a0ca4d9558..2903b12a12 100644 --- a/designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java +++ b/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 map) { DesignTableDataManager.fireDSChanged(map); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index 4fd7e6c42b..bb4ba4cccc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/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.svg、a_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; } @@ -307,6 +350,8 @@ public abstract class UpdateAction extends ShortCut implements Action { } 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); @@ -454,6 +499,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 +641,17 @@ public abstract class UpdateAction extends ShortCut implements Action { shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator); } -} \ No newline at end of file + private void setPressedIcon4Button(AbstractButton button) { + Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON); + if (pressedIcon != null && pressedIcon instanceof SVGIcon) { + button.setPressedIcon(pressedIcon); + } + } + + private void setDisabledIcon4Button(AbstractButton button) { + Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON); + if (disabledIcon != null && disabledIcon instanceof SVGIcon) { + button.setDisabledIcon(disabledIcon); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java b/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java index 98ad28c9c2..05a1d2b20c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java +++ b/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"); + } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java b/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java index d9c75321d6..cebaa6956b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/BugAction.java +++ b/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'; } }; diff --git a/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java b/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java index 17ee23b530..74646ef922 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/BugNeedAction.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java b/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java index 3ba97c0fc5..64288b9c91 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java +++ b/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"); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java b/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java index 9ab799bccd..192d921faf 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java b/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java index c604e51d07..61834547f8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java +++ b/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"); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java b/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java index 9a19ef4cc9..94234b1bcf 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java +++ b/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"); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java b/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java index c08619b23b..4944ecc3c1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/SignAction.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java b/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java index a099216094..740ca23871 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java +++ b/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"); } diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index f3cb21bc70..62ccf845ef 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/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 diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java index a311773745..65f1361762 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java +++ b/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; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java index c03d5d3de0..4da98d733d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java +++ b/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()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java index 6c8a9a5150..22093acb7a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java +++ b/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()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java index 2d4c99d29e..abfd9c045c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/RedoAction.java +++ b/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 } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java b/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java index d775ff9551..ff337620c9 100644 --- a/designer-base/src/main/java/com/fr/design/actions/edit/UndoAction.java +++ b/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 } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java index 091fb112a5..699119fe50 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/OpenTemplateAction.java +++ b/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); } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java index 5d2ab15705..a60b397628 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SaveAsTemplateAction.java +++ b/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> { 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> { // 另存为按钮应该一直可用使用 this.setEnabled(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java b/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java index de2cf1e427..920f5b41ae 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SaveTemplateAction.java +++ b/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> { 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> { this.setEnabled(!this.getEditingComponent().isSaved()); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 1e222dd26c..bc88f72fd0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/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 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; } } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 5de31eb311..af0ea605f3 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/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()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java b/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java index 613982abdf..53ef796b34 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/WebDemoAction.java +++ b/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 { } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java index f78d341a53..3dc951578a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java +++ b/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()); } diff --git a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java index 50ecd0ea6d..820de79e5e 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.server; +import com.fr.base.svg.IconUtils; import com.fr.data.impl.Connection; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.connect.ConnectionShowPane; @@ -11,7 +12,6 @@ import com.fr.stable.os.support.OSBasedAction; import com.fr.stable.os.support.OSSupportCenter; import com.fr.design.os.impl.DatabaseDialogAction; import com.fr.file.ConnectionConfig; -import com.fr.general.IOUtils; import javax.swing.*; import java.awt.event.ActionEvent; @@ -26,7 +26,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()); } @@ -96,4 +96,4 @@ public class ConnectionListAction extends UpdateAction { public void update() { this.setEnabled(true); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java index bbc324ffda..d7f1cdbb7a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/FunctionManagerAction.java +++ b/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; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java index c546129e95..d3f035972c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java +++ b/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; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java index 627a862fb6..468fb1f98d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java @@ -3,8 +3,8 @@ */ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; import com.fr.base.TableData; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignModelAdapter; import com.fr.design.actions.UpdateAction; import com.fr.design.data.DesignTableDataManager; @@ -40,7 +40,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() { @@ -70,7 +70,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS final TableDataConfig tableDataConfig = TableDataConfig.getInstance(); final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() { public void complete() { - + TableDataConfig mirror = tableDataConfig.mirror(); populate(mirror); } @@ -166,4 +166,4 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS public void fireDSChanged(Map map) { DesignTableDataManager.fireDSChanged(map); } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java index 5f364303a7..f62327ad9a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PlatformManagerAction.java +++ b/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; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index d000dbbbb0..bb9339568c 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/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; } }; -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 93dc57a8f4..fdc92a9371 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/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"); diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index 5ba801ca89..83740f6853 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -398,7 +398,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp public PreviewTableDataAction(TableDataTree dataTree) { 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 +437,7 @@ 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"); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index a2cc5b7d28..2298fc8333 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -18,8 +18,6 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.fun.TableDataDefineProvider; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -28,7 +26,6 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; @@ -97,7 +94,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); createAddMenuDef(); - // 创建插件监听 createPluginListener(); @@ -160,34 +156,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { return context.contain(PluginModule.ExtraDesign); } }); - - //监听数据集插件 - GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - @Override - public void on(PluginEvent event) { - //REPORT-25577 - //如果数据集插件禁用或启用。需要清空当前模板中的缓存 - reloadCurrTemplate(); - } - - private void reloadCurrTemplate() { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - if (accept(jt)) { - jt.refreshResource(); - } - } - - private boolean accept(JTemplate jt) { - - return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); - } - }, new PluginFilter() { - @Override - public boolean accept(PluginContext pluginContext) { - - return pluginContext.contain(TableDataDefineProvider.XML_TAG); - } - }); } @@ -279,7 +247,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { public EditAction() { 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) { @@ -297,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 diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java index 3241e0588b..7f5d083004 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java @@ -1 +1,194 @@ -package com.fr.design.data.datapane.sqlpane; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.ActionEvent; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-5-2 * Time: 上午11:09 */ public class SQLEditPane extends RSyntaxTextArea { public static final boolean REQUEST_DROPTARGET = true; public static final boolean UNREQUEST_DROPTARGET = false; public SQLEditPane() { this(REQUEST_DROPTARGET); } public SQLEditPane(boolean requestDroptarget) { super(); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); setAnimateBracketMatching(true); setAntiAliasingEnabled(true); setAutoIndentEnabled(true); setCodeFoldingEnabled(true); setUseSelectedTextColor(true); setCloseCurlyBraces(true); setBracketMatchingEnabled(true); setAntiAliasingEnabled(true); setCloseMarkupTags(true); setLineWrap(true); if (requestDroptarget) { new SQLPaneDropTarget(this); } } private static class SQLPaneDropTarget extends DropTargetAdapter { private TableProcedure sqlTable; public SQLPaneDropTarget(SQLEditPane sqlTextPane) { new DropTarget(sqlTextPane, this); } public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void dragOver(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void drop(DropTargetDropEvent dtde) { Point p = dtde.getLocation(); DropTargetContext dtc = dtde.getDropTargetContext(); SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); try { Transferable tr = dtde.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (!tr.isDataFlavorSupported(flavors[i])) { continue; } dtde.acceptDrop(dtde.getDropAction()); Object userObj = tr.getTransferData(flavors[i]); if (userObj instanceof TableProcedure) { this.sqlTable = (TableProcedure) userObj; JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); } else { popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); } GUICoreUtils.showPopupMenu(popupMenu, jTextPane, (int) p.getX() + 1, (int) p.getY() + 1); } dtde.dropComplete(true); } dtde.rejectDrop(); } catch (Exception e) { dtde.rejectDrop(); } } class NameAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { if (sqlTable != null) { insertStringTo(sqlTextPane, sqlTable.toString()); } } } class SelectAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("SELECT *"); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { //daniel: 添加参数 insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); } } class CallAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("CALL PROCEDURE "); this.setMnemonic('s'); this.setSmallIcon(null); } public void actionPerformed(ActionEvent evt) { StringBuffer sBuf = new StringBuffer(); sBuf.append("{call "); if (sqlTable != null) { sBuf.append(sqlTable.toString()).append("()"); } sBuf.append('}'); insertStringTo(sqlTextPane, sBuf.toString()); } } private void insertStringTo(SQLEditPane sqlTextPane, String str) { Document document = sqlTextPane.getDocument(); try { document.insertString(sqlTextPane.getCaretPosition(), str, null); } catch (BadLocationException badLocationException) { FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); } sqlTextPane.requestFocus(); } } } \ No newline at end of file +package com.fr.design.data.datapane.sqlpane; + +import com.fr.data.core.DataCoreUtils; +import com.fr.data.core.db.TableProcedure; +import com.fr.design.actions.UpdateAction; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.Icon; +import javax.swing.JPopupMenu; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import java.awt.Point; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.event.ActionEvent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 7.0.3 + * Date: 13-5-2 + * Time: 上午11:09 + */ +public class SQLEditPane extends RSyntaxTextArea { + public static final boolean REQUEST_DROPTARGET = true; + public static final boolean UNREQUEST_DROPTARGET = false; + + public SQLEditPane() { + this(REQUEST_DROPTARGET); + } + + public SQLEditPane(boolean requestDroptarget) { + super(); + + setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); + + setAnimateBracketMatching(true); + setAntiAliasingEnabled(true); + setAutoIndentEnabled(true); + setCodeFoldingEnabled(true); + setUseSelectedTextColor(true); + setCloseCurlyBraces(true); + setBracketMatchingEnabled(true); + setAntiAliasingEnabled(true); + setCloseMarkupTags(true); + setLineWrap(true); + if (requestDroptarget) { + new SQLPaneDropTarget(this); + } + + } + + + private static class SQLPaneDropTarget extends DropTargetAdapter { + private TableProcedure sqlTable; + + public SQLPaneDropTarget(SQLEditPane sqlTextPane) { + new DropTarget(sqlTextPane, this); + } + + public void dragEnter(DropTargetDragEvent dtde) { + dtde.acceptDrag(dtde.getDropAction()); + } + + public void dragOver(DropTargetDragEvent dtde) { + dtde.acceptDrag(dtde.getDropAction()); + } + + public void drop(DropTargetDropEvent dtde) { + Point p = dtde.getLocation(); + DropTargetContext dtc = dtde.getDropTargetContext(); + SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); + + try { + Transferable tr = dtde.getTransferable(); + DataFlavor[] flavors = tr.getTransferDataFlavors(); + for (int i = 0; i < flavors.length; i++) { + if (!tr.isDataFlavorSupported(flavors[i])) { + continue; + } + dtde.acceptDrop(dtde.getDropAction()); + Object userObj = tr.getTransferData(flavors[i]); + + if (userObj instanceof TableProcedure) { + this.sqlTable = (TableProcedure) userObj; + + JPopupMenu popupMenu = new JPopupMenu(); + popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); + if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { + popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); + } else { + popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); + } + + GUICoreUtils.showPopupMenu(popupMenu, jTextPane, + (int) p.getX() + 1, (int) p.getY() + 1); + } + + dtde.dropComplete(true); + } + + dtde.rejectDrop(); + } catch (Exception e) { + dtde.rejectDrop(); + } + } + + class NameAction extends UpdateAction { + private SQLEditPane sqlTextPane; + private TableProcedure sqlTable; + + public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { + this.sqlTextPane = sqlTextPane; + this.sqlTable = sqlTable; + + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); + this.setMnemonic('N'); + this.setSmallIcon(UIConstants.EMPTY_ICON); + } + + public void actionPerformed(ActionEvent evt) { + if (sqlTable != null) { + insertStringTo(sqlTextPane, sqlTable.toString()); + } + + } + } + + class SelectAction extends UpdateAction { + private SQLEditPane sqlTextPane; + private TableProcedure sqlTable; + + public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { + this.sqlTextPane = sqlTextPane; + this.sqlTable = sqlTable; + + this.setName("SELECT *"); + this.setMnemonic('s'); + this.setSmallIcon(UIConstants.EMPTY_ICON); + } + + public void actionPerformed(ActionEvent evt) { + //daniel: 添加参数 + insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); + } + } + + class CallAction extends UpdateAction { + private SQLEditPane sqlTextPane; + private TableProcedure sqlTable; + + public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { + this.sqlTextPane = sqlTextPane; + this.sqlTable = sqlTable; + + this.setName("CALL PROCEDURE "); + this.setMnemonic('s'); + this.setSmallIcon(UIConstants.EMPTY_ICON); + } + + public void actionPerformed(ActionEvent evt) { + StringBuffer sBuf = new StringBuffer(); + sBuf.append("{call "); + if (sqlTable != null) { + sBuf.append(sqlTable.toString()).append("()"); + } + sBuf.append('}'); + + insertStringTo(sqlTextPane, sBuf.toString()); + } + } + + private void insertStringTo(SQLEditPane sqlTextPane, String str) { + Document document = sqlTextPane.getDocument(); + try { + document.insertString(sqlTextPane.getCaretPosition(), str, null); + } catch (BadLocationException badLocationException) { + FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); + } + + sqlTextPane.requestFocus(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java index 571e13d447..4a153bfaac 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java +++ b/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 { - 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; diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java index 77ac976bcf..b8dc5ad8fe 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/FormulaEditor.java @@ -99,6 +99,10 @@ public class FormulaEditor extends Editor { return formula; } + public UITextField getUITextField() { + return currentTextField; + } + /** * Return the value of the CellEditor. */ diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index 801b4e369a..113815a22c 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -18,6 +18,7 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginMarker; +import com.fr.plugin.context.PluginMarkerAdapter; import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.control.PluginControllerHelper; import com.fr.plugin.manage.control.PluginTask; @@ -26,7 +27,8 @@ import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.view.PluginView; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; import java.io.File; import java.net.HttpURLConnection; import java.util.List; @@ -38,11 +40,23 @@ import java.util.List; public class PluginOperateUtils { public static void installPluginOnline(final PluginMarker pluginMarker, JSCallback jsCallback) { + PluginMarker marker = updateMarker2Online(pluginMarker); //下载插件 - PluginTask pluginTask = PluginTask.installTask(pluginMarker); + PluginTask pluginTask = PluginTask.installTask(marker); PluginControllerHelper.installOnline(pluginMarker, new InstallOnlineCallback(pluginTask, jsCallback)); } + public static PluginMarker updateMarker2Online(PluginMarker pluginMarker) { + try { + JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID()); + String pluginName = latestPluginInfo.getString("name"); + return PluginMarkerAdapter.create(pluginMarker, pluginName); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return pluginMarker; + } + public static void installPluginFromDisk(File zipFile, JSCallback jsCallback) { PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } @@ -57,10 +71,11 @@ public class PluginOperateUtils { public static void updatePluginOnline(PluginMarker pluginMarker, JSCallback jsCallback) { try { JSONObject latestPluginInfo = PluginUtils.getLatestPluginInfo(pluginMarker.getPluginID()); - String latestPluginVersion = (String) latestPluginInfo.get("version"); - PluginMarker toPluginMarker = PluginMarker.create(pluginMarker.getPluginID(), latestPluginVersion); + String latestPluginVersion = latestPluginInfo.getString("version"); + String pluginName = latestPluginInfo.getString("name"); + PluginMarker toPluginMarker = PluginMarkerAdapter.create(pluginMarker.getPluginID(), latestPluginVersion, pluginName); //当前已经安装的相同ID插件marker - PluginMarker currentMarker = PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()); + PluginMarker currentMarker = PluginMarkerAdapter.create(PluginUtils.getInstalledPluginMarkerByID(pluginMarker.getPluginID()), pluginName); PluginTask pluginTask = PluginTask.updateTask(currentMarker, toPluginMarker); PluginControllerHelper.updateOnline(currentMarker, toPluginMarker, new UpdateOnlineCallback(pluginTask, jsCallback)); } catch (Exception e) { @@ -128,6 +143,10 @@ public class PluginOperateUtils { } public static void dealParams(StringBuilder url, String category, String seller, String fee, String scope) { + dealParams(url, category, seller, fee, StringUtils.EMPTY); + } + + public static void dealParams(StringBuilder url, String category, String seller, String fee, String scope, String language) { if (StringUtils.isNotBlank(category)) { url.append("cid=").append(category.split("-")[1]); } else { @@ -169,6 +188,9 @@ public class PluginOperateUtils { url.append("&scope=").append(StringUtils.EMPTY); } } + if (StringUtils.isNotBlank(language)) { + url.append("&language=").append(language.split("-")[1]); + } } public static void getLoginInfo(JSCallback jsCallback, UILabel uiLabel) { @@ -203,16 +225,22 @@ public class PluginOperateUtils { continue; } PluginMarker pluginMarker = pluginTask.getToMarker(); - PluginContext pluginContext = PluginManager.getContext(pluginMarker); - if (pluginContext != null) { - pluginInfo.append(pluginContext.getName()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); - } else { - pluginInfo.append(pluginMarker.getPluginID()).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); - } + PluginContext pluginContext = PluginManager.getContext(pluginMarker.getPluginID()); + pluginInfo.append(getPluginName(pluginContext, pluginMarker)).append(PluginUtils.getMessageByErrorCode(pluginTaskResult.errorCode())); } return pluginInfo.toString(); } + private static String getPluginName(PluginContext pluginContext, PluginMarker pluginMarker) { + if (pluginContext != null) { + return pluginContext.getName(); + } + else if (pluginMarker instanceof PluginMarkerAdapter) { + return ((PluginMarkerAdapter) pluginMarker).getPluginName(); + } + return pluginMarker == null ? StringUtils.EMPTY : pluginMarker.getPluginID(); + } + public static String getSwitchedInfo(PluginTaskResult result) { StringBuilder pluginInfo = new StringBuilder(); List pluginTaskResults = result.asList(); diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java index bec02a200e..ed7253bad2 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java @@ -10,6 +10,7 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.PluginVerifyException; import com.fr.plugin.basic.version.Version; +import com.fr.plugin.basic.version.VersionIntervalType; import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginMarker; diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java b/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java index 3bf7b2cb32..b3d66d510e 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java @@ -21,19 +21,26 @@ public class GetPluginFromStoreExecutor implements Executor { private String seller; private String fee; private String scope; + private String language; public GetPluginFromStoreExecutor(JSONObject info) { this.category = info.optString("categories"); this.fee = info.optString("fee"); this.seller = info.optString("seller"); this.scope = info.optString("scope"); + this.language = info.optString("language"); } public GetPluginFromStoreExecutor(String category, String seller, String fee, String scope) { + this(category, seller, fee, scope, StringUtils.EMPTY); + } + + public GetPluginFromStoreExecutor(String category, String seller, String fee, String scope, String language) { this.category = category; this.seller = seller; this.fee = fee; this.scope = scope; + this.language = language; } @Override @@ -53,7 +60,7 @@ public class GetPluginFromStoreExecutor implements Executor { @Override public void run(Process process) { String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist"); - boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope); + boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope) & StringUtils.isEmpty(language); if (getRecommend) { result = PluginOperateUtils.getRecommendPlugins(); return; @@ -62,7 +69,7 @@ public class GetPluginFromStoreExecutor implements Executor { if (StringUtils.isNotBlank(plistUrl)) { StringBuilder url = new StringBuilder(); url.append(plistUrl).append("?"); - PluginOperateUtils.dealParams(url, category, seller, fee, scope); + PluginOperateUtils.dealParams(url, category, seller, fee, scope, language); try { HttpClient httpClient = new HttpClient(url.toString()); httpClient.asGet(); diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java index 19bd89ef10..81e76fa451 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java @@ -3,7 +3,7 @@ package com.fr.design.extra.exe.callback; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginOperateUtils; -import com.fr.design.extra.PluginUtils; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -12,7 +12,6 @@ import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskResult; -import javax.swing.*; import java.io.File; import java.util.List; @@ -41,20 +40,21 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback { if (result.isSuccess()) { String switchedInfo = PluginOperateUtils.getSwitchedInfo(result); jsCallback.execute("success"); - FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); - FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); + String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo; + FineLoggerFactory.getLogger().info(successInfo); + FineJOptionPane.showMessageDialog(null, successInfo); } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { - int rv = JOptionPane.showOptionDialog( + int rv = FineJOptionPane.showOptionDialog( null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Dependence"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, + FineJOptionPane.YES_NO_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE, null, FineJOptionPane.OPTION_YES_NO_CANCEL, null ); - if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { return; } List pluginTasks = result.getPreTasks(); @@ -64,24 +64,24 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback { } PluginManager.getController().install(zipFile, new InstallFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ - int rv = JOptionPane.showOptionDialog( + int rv = FineJOptionPane.showOptionDialog( null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.YES_NO_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE, null, FineJOptionPane.OPTION_YES_NO_CANCEL, null ); - if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { return; } PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); }else { jsCallback.execute("failed"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); - FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); } } } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java index f597180e87..c7059f50d5 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java @@ -3,6 +3,7 @@ package com.fr.design.extra.exe.callback; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -11,8 +12,6 @@ import com.fr.plugin.manage.control.AbstractDealPreTaskCallback; import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskResult; -import javax.swing.*; - /** * Created by ibm on 2017/5/26. @@ -38,28 +37,30 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback { if (result.isSuccess()) { String switchedInfo = PluginOperateUtils.getSwitchedInfo(result); jsCallback.execute("success"); - FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); - FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo); + String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo; + FineLoggerFactory.getLogger().info(successInfo); + FineJOptionPane.showMessageDialog(null, successInfo); } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ - int rv = JOptionPane.showOptionDialog( + int rv = FineJOptionPane.showOptionDialog( null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Install_Lower"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.YES_NO_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE, null, FineJOptionPane.OPTION_YES_NO_CANCEL, null ); - if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { + jsCallback.execute("success"); return; } PluginMarker pluginMarker = result.getCurrentTask().getMarker(); PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); - }else { + } else { jsCallback.execute("failed"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); - FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed")); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java index c48a47faeb..8015e00fbd 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java @@ -2,12 +2,14 @@ package com.fr.design.extra.exe.callback; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.extra.PluginUtils; +import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.i18n.Toolkit; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; -import javax.swing.*; +import javax.swing.JOptionPane; /** * Created by ibm on 2017/5/27. @@ -22,12 +24,16 @@ public class ModifyStatusCallback implements PluginTaskCallback{ } @Override public void done(PluginTaskResult result) { + String pluginInfo = PluginOperateUtils.getSuccessInfo(result); if (result.isSuccess()) { jsCallback.execute("success"); - String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); + String modifyMessage = isActive ? + pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : + pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); + FineLoggerFactory.getLogger().info(modifyMessage); FineJOptionPane.showMessageDialog(null, modifyMessage); } else { - FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java index b3773ef6f9..df3839427d 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java @@ -2,7 +2,8 @@ package com.fr.design.extra.exe.callback; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; -import com.fr.design.extra.PluginUtils; +import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -10,8 +11,6 @@ import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.control.PluginTaskResult; -import javax.swing.*; - /** * Created by ibm on 2017/5/27. */ @@ -25,29 +24,31 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback { @Override public void done(PluginTaskResult result) { + String pluginInfo = PluginOperateUtils.getSuccessInfo(result); if (result.isSuccess()) { jsCallback.execute("success"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success")); - FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success")); + String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"); + FineLoggerFactory.getLogger().info(successInfo); + FineJOptionPane.showMessageDialog(null, successInfo); }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { - int rv = JOptionPane.showOptionDialog( + int rv = FineJOptionPane.showOptionDialog( null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, + Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Dependence"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.YES_NO_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE, null, FineJOptionPane.OPTION_YES_NO_CANCEL, null ); - if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { return; } PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); } else { jsCallback.execute("failed"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); - FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed")); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); } } } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java index 7cced40f0b..e5396d35ce 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java @@ -3,7 +3,7 @@ package com.fr.design.extra.exe.callback; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginOperateUtils; -import com.fr.design.extra.PluginUtils; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -12,7 +12,6 @@ import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskResult; -import javax.swing.*; import java.io.File; import java.util.List; @@ -37,22 +36,24 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback { @Override public void done(PluginTaskResult result) { + String pluginInfo = PluginOperateUtils.getSuccessInfo(result); if (result.isSuccess()) { jsCallback.execute("success"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); - FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); + String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"); + FineLoggerFactory.getLogger().info(successInfo); + FineJOptionPane.showMessageDialog(null, successInfo); } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { - int rv = JOptionPane.showOptionDialog( + int rv = FineJOptionPane.showOptionDialog( null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, + Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Dependence"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.YES_NO_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE, null, FineJOptionPane.OPTION_YES_NO_CANCEL, null ); - if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { return; } List pluginTasks = result.getPreTasks(); @@ -62,24 +63,24 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback { } PluginManager.getController().update(zipFile, new UpdateFromDiskCallback(zipFile, jsCallback)); } else if(result.errorCode() == PluginErrorCode.NoPluginToUpdate){ - int rv = JOptionPane.showOptionDialog( + int rv = FineJOptionPane.showOptionDialog( null, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, + Toolkit.i18nText("Fine-Design_Basic_Plugin_No_Plugin_Update"), + Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), + FineJOptionPane.YES_NO_CANCEL_OPTION, + FineJOptionPane.INFORMATION_MESSAGE, null, FineJOptionPane.OPTION_YES_NO_CANCEL, null ); - if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { + if (rv == FineJOptionPane.NO_OPTION || rv == FineJOptionPane.CANCEL_OPTION || rv == FineJOptionPane.CLOSED_OPTION) { return; } PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); }else { jsCallback.execute("failed"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); - FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); } } } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java index 69998a3169..8dbad6a541 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java @@ -3,14 +3,13 @@ package com.fr.design.extra.exe.callback; import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.i18n.Toolkit; import com.fr.log.FineLoggerFactory; import com.fr.plugin.manage.control.AbstractDealPreTaskCallback; import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTaskResult; -import javax.swing.*; - /** * Created by ibm on 2017/5/26. */ @@ -33,12 +32,13 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback { String pluginInfo = PluginOperateUtils.getSuccessInfo(result); if (result.isSuccess()) { jsCallback.execute("success"); - FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); - FineJOptionPane.showMessageDialog(null,pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success")); + String successInfo = pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"); + FineLoggerFactory.getLogger().info(successInfo); + FineJOptionPane.showMessageDialog(null, successInfo); } else { jsCallback.execute("failed"); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); - FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed")); + FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), FineJOptionPane.ERROR_MESSAGE); } } } diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 763ffcd1ff..f6b8f07d52 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,15 +2,14 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.io.BaseBook; -import com.fr.design.DesignModelAdapter; 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; @@ -18,12 +17,14 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.StashedFILE; import com.fr.general.ComparatorUtils; +import com.fr.invoke.ClassHelper; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.manage.PluginManager; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; import com.fr.third.org.apache.commons.io.FilenameUtils; -import javax.swing.SwingUtilities; import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.Collections; @@ -31,6 +32,7 @@ import java.util.HashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.Set; /** * 历史模板缓存 @@ -372,7 +374,6 @@ public class HistoryTemplateListCache implements CallbackEvent { */ public void load() { FineLoggerFactory.getLogger().info("Env Change Template Loading..."); - JTemplate currentTemplate = null; if (stashFILEMap != null && stashFILEMap.size() != 0) { int size = historyList.size(); for (int i = 0; i < size; i++) { @@ -383,32 +384,14 @@ public class HistoryTemplateListCache implements CallbackEvent { if (stashedFile == null) { continue; } - JTemplate template = JTemplateFactory.createJTemplate(stashedFile); - if (template != null) { - historyList.set(i, template); - // 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件 - if (isCurrentEditingFile(template.getPath())) { - currentTemplate = template; - } - } else { - // 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取 - JTemplate jt = historyList.get(i); - // 另外如果该模板是正在编辑的模板,需要要激活 - if (jt != null && isCurrentEditingFile(jt.getPath())) { - currentTemplate = jt; - } - } + FineLoggerFactory.getLogger().info("{} is being reloaded", stashedFile.getName()); + JTemplate template = historyList.get(i); + template.refreshResource(stashedFile); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } - // 最后加载当前正在编辑的模板 以保证数据集刷新正常 - if (currentTemplate != null) { - loadCurrentTemplate(currentTemplate); - } stashFILEMap.clear(); - MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); - MutilTempalteTabPane.getInstance().repaint(); } FineLoggerFactory.getLogger().info("Env Change Template Loaded."); } @@ -422,12 +405,9 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 重新载入当前模板,刷新数据/对象 */ + @Deprecated public void reloadCurrentTemplate() { - JTemplate jt = getCurrentEditingTemplate(); - boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); - if (access) { - jt.refreshResource(); - } + reloadAllEditingTemplate(); } /** @@ -441,4 +421,73 @@ public class HistoryTemplateListCache implements CallbackEvent { } }); } + + /** + * 插件安装后/启用 重新加载模板资源 + */ + private void _reloadAllEditingTemplate(PluginContext context) { + FineLoggerFactory.getLogger().info("Plugin env change reload all template started"); + long start = System.currentTimeMillis(); + int size = historyList.size(); + for (int i = 0; i < size; i++) { + JTemplate template = historyList.get(i); + FILE file = template.getEditingFILE(); + boolean needReload = context == null || needReloadTemplate(context, template); + if (needReload) { + try { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + BaseBook target = template.getTarget(); + if (target != null) { + FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName()); + target.export(outputStream); + FILE stashedFile = new StashedFILE(file, outputStream.toByteArray()); + template.refreshResource(stashedFile); + } + // 如果 target == null 那么这个模板是被模板内存优化功能处理过的,不用处理 + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + FineLoggerFactory.getLogger().info("Plugin env change reload all template ended"); + FineLoggerFactory.getLogger().info("Reload all template spend: {} ms", (System.currentTimeMillis() - start)); + } + + /** + * 根据具体插件来刷新模板 + * @param context + */ + public void reloadAllEditingTemplateByPlugin(PluginContext context) { + _reloadAllEditingTemplate(context); + } + + /** + * 直接刷新所以模板 + */ + public void reloadAllEditingTemplate() { + _reloadAllEditingTemplate(null); + } + + private boolean needReloadTemplate(PluginContext context, JTemplate template) { + BaseBook baseBook = template.getTarget(); + if (baseBook != null) { + String name = template.getEditingFILE().getName(); + String pluginId = context.getID(); + long start = System.currentTimeMillis(); + Set set = ClassHelper.getClassLoadersByFilter(baseBook, ClassFilter.getInstance()); + FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); + if (set != null) { + for (ClassLoader classLoader : set) { + if (ComparatorUtils.equals(pluginId, PluginManager.detectLeakingPlugin(classLoader))) { + return true; + } + } + } else { + // set为null说明 检测classloader 这里返回true直接刷新 兜底行为 + return true; + } + } + return false; + } + } diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 69aee1b50e..99cd179169 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/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; @@ -18,8 +19,6 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.third.javax.annotation.Nonnull; -import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import javax.swing.BorderFactory; import javax.swing.ButtonModel; @@ -37,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; @@ -138,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() { @@ -707,7 +705,7 @@ public class MutilTempalteTabPane extends JComponent { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); + TemplateResourceManager.getResource().closeTemplate(file.getPath()); } } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateResource.java b/designer-base/src/main/java/com/fr/design/file/TemplateResource.java new file mode 100644 index 0000000000..f394822d6b --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/TemplateResource.java @@ -0,0 +1,71 @@ +package com.fr.design.file; + +import com.fr.common.annotations.Open; +import com.fr.file.FILE; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * 模板资源操作,可操作模板及模板目录 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/12/23 + */ +@Open +public interface TemplateResource { + + /** + * 读取模板 + * @param path + * @return + * @throws Exception + */ + InputStream readTemplate(String path) throws Exception; + + /** + * 保存模板 + * @param file + * @return + * @throws Exception + */ + OutputStream saveTemplate(FILE file) throws Exception; + + /** + * 删除某个目录/某个模板 + * @param file + * @return + */ + boolean delete(FILE file); + + /** + * 关闭模板 + * @param path + * @return + */ + boolean closeTemplate(String path); + + /** + * 重命名模板/目录 + * @param from + * @param to + * @return + */ + boolean rename(String from, String to); + + /** + * 模板/目录是否存在 + * @param path + * @return + */ + boolean exist(String path); + + /** + * 创建目录 + * @param path + * @return + */ + boolean mkdir(String path); + + +} diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateResourceManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateResourceManager.java new file mode 100644 index 0000000000..384b1a3e1e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/TemplateResourceManager.java @@ -0,0 +1,66 @@ +package com.fr.design.file; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.file.impl.DefaultTemplateResource; +import com.fr.design.fun.LocalResourceProvider; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.design.ui.util.UIUtil; +import com.fr.file.filetree.FileNodes; +import com.fr.file.filetree.LocalFileNodes; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.plugin.observer.PluginEventType; +import com.fr.plugin.observer.PluginListenerRegistration; +import com.fr.workspace.WorkContext; +import com.fr.workspace.engine.base.FineObjectPool; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/23 + */ +public class TemplateResourceManager { + + private static final TemplateResource DEFAULT_OPERATION = new DefaultTemplateResource(); + + private static TemplateResource OPERATION = DEFAULT_OPERATION; + + static { + PluginFilter filter = pluginContext -> pluginContext.contain(PluginModule.ExtraDesign, LocalResourceProvider.XML_TAG); + + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterStop, new PluginEventListener() { + @Override + public void on(PluginEvent event) { + registerOperation(new DefaultTemplateResource()); + FineObjectPool.getInstance().getLocalPool().put(FileNodes.class, new LocalFileNodes()); + UIUtil.invokeLaterIfNeeded(() -> DesignerFrameFileDealerPane.getInstance().refresh()); + } + }, filter); + + PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, new PluginEventListener() { + @Override + public void on(PluginEvent event) { + LocalResourceProvider provider = ExtraDesignClassManager.getInstance().getSingle(LocalResourceProvider.XML_TAG); + if (provider != null && WorkContext.getCurrent().isLocal()) { + registerOperation(provider.createResourceOperation()); + FineObjectPool.getInstance().getLocalPool().put(FileNodes.class, provider.createFileNodes()); + UIUtil.invokeLaterIfNeeded(() -> DesignerFrameFileDealerPane.getInstance().refresh()); + } + } + }, filter); + } + + private static void registerOperation(TemplateResource operation) { + OPERATION = operation; + } + + public static TemplateResource getResource() { + if (OPERATION == null) { + return DEFAULT_OPERATION; + } + return OPERATION; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 5041cc34a3..0fc3ca7281 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -4,7 +4,9 @@ package com.fr.design.file; import com.fr.base.FRContext; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.fun.TemplateTreeDefineProcessor; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; @@ -23,12 +25,11 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; -import com.fr.workspace.server.lock.TplOperator; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; -import javax.swing.UIManager; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; @@ -87,6 +88,16 @@ public class TemplateTreePane extends JPanel implements FileOperations { } } + @Override + public void mouseClicked(MouseEvent e) { + if (SwingUtilities.isRightMouseButton(e)) { + TemplateTreeDefineProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TemplateTreeDefineProcessor.XML_TAG); + if (processor != null) { + processor.rightClickAction(e); + } + } + } + @Override public void mouseReleased(MouseEvent e) { if (toolBarStateChangeListener != null) { @@ -182,7 +193,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { @Override public boolean mkdir(String path) { - return WorkContext.getWorkResource().createDirectory(path); + return TemplateResourceManager.getResource().mkdir(path); } /** @@ -325,7 +336,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { if (node instanceof FileNode) { FileNodeFILE nodeFILE = new FileNodeFILE((FileNode) node); if (nodeFILE.exists()) { - if (WorkContext.getCurrent().get(TplOperator.class).delete(nodeFILE.getPath())) { + if (TemplateResourceManager.getResource().delete(nodeFILE)) { HistoryTemplateListCache.getInstance().deleteFile(nodeFILE); } else { success = false; @@ -427,7 +438,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { try { // 接收的是WEB-INF下的路径 - return WorkContext.getCurrent().get(TplOperator.class).rename(from, to); + return TemplateResourceManager.getResource().rename(from, to); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; diff --git a/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java new file mode 100644 index 0000000000..d89c546a98 --- /dev/null +++ b/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 { + + + private static final Set FILTER_SET = new HashSet<>(); + + private static final Filter INSTANCE = new ClassFilter(); + + public static Filter 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); + } +} diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java new file mode 100644 index 0000000000..cb76792a13 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java @@ -0,0 +1,19 @@ +package com.fr.design.file.impl; + + +import com.fr.design.file.TemplateResource; +import com.fr.file.FILE; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/23 + */ +public abstract class AbstractTemplateResource implements TemplateResource { + +} diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java new file mode 100644 index 0000000000..8c54cc8cc3 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java @@ -0,0 +1,52 @@ +package com.fr.design.file.impl; + +import com.fr.file.FILE; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/23 + */ +public class DefaultTemplateResource extends AbstractTemplateResource { + + @Override + public InputStream readTemplate(String path) throws Exception { + return new ByteArrayInputStream(WorkContext.getCurrent().get(TplOperator.class).readAndLockFile(path)); + } + + @Override + public OutputStream saveTemplate(FILE file) throws Exception { + return file.asOutputStream(); + } + + @Override + public boolean closeTemplate(String path) { + return WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); + } + + @Override + public boolean delete(FILE file) { + return WorkContext.getCurrent().get(TplOperator.class).delete(file.getPath()); + } + + @Override + public boolean rename(String from, String to) { + return WorkContext.getCurrent().get(TplOperator.class).rename(from, to); + } + + @Override + public boolean exist(String path) { + return WorkContext.getWorkResource().exist(path); + } + + @Override + public boolean mkdir(String path) { + return WorkContext.getWorkResource().createDirectory(path); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java b/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java index 9f033d6dc6..d1b64e2bd9 100644 --- a/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java @@ -23,4 +23,12 @@ public interface FormWidgetOptionProvider extends ParameterWidgetOptionProvider */ void paste2Container(T t); + /** + * 往扩展容器本身中添加粘贴内容 + * @param r + * @param 粘贴板选中的组件 + * @param 容器布局适配器 + */ + void formWidgetPaste(T t, R r, int x, int y); + } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java b/designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java new file mode 100644 index 0000000000..56a98a2359 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/LocalResourceProvider.java @@ -0,0 +1,34 @@ +package com.fr.design.fun; + +import com.fr.design.file.TemplateResource; +import com.fr.file.filetree.FileNodes; +import com.fr.stable.fun.mark.Immutable; + +/** + * 本地资源操作插件接口 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/12/22 + */ +public interface LocalResourceProvider extends Immutable { + + String XML_TAG = "LocalResourceProvider"; + + int CURRENT_LEVEL = 1; + + /** + * eg: DefaultResourceOperation + * + * @return 目录/模板的各种操作 + */ + TemplateResource createResourceOperation(); + + /** + * eg: LocalFileNodes + * + * @return 构建目录树的方式 + */ + FileNodes createFileNodes(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java new file mode 100644 index 0000000000..e76d24209d --- /dev/null +++ b/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 classForMobileParamStyle(); + + /** + * 移动端参数面板中扩展项的面板 + * @return + */ + Class> classForMobileParamAppearance(); + + /** + * 扩展项的名称描述 + * @return + */ + String displayName(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/TemplateTreeDefineProcessor.java b/designer-base/src/main/java/com/fr/design/fun/TemplateTreeDefineProcessor.java new file mode 100644 index 0000000000..cfa5bcecbe --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/TemplateTreeDefineProcessor.java @@ -0,0 +1,19 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Immutable; +import java.awt.event.MouseEvent; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/14 + */ +public interface TemplateTreeDefineProcessor extends Immutable { + + String XML_TAG = "TemplateTreeDefineProcessor"; + + int CURRENT_LEVEL = 1; + + void rightClickAction(MouseEvent mouseEvent); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java index 537a49d018..2e0633e870 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java @@ -30,4 +30,9 @@ public abstract class AbstractFormWidgetOptionProvider extends AbstractProvider public void paste2Container(T t) { // do nothing } + + @Override + public void formWidgetPaste(T t, R r, int x, int y) { + // do nothing + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java new file mode 100644 index 0000000000..ebefc2ba69 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractLocalResourceProvider.java @@ -0,0 +1,23 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.LocalResourceProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/22 + */ +@API(level = LocalResourceProvider.CURRENT_LEVEL) +public abstract class AbstractLocalResourceProvider implements LocalResourceProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java new file mode 100644 index 0000000000..c31e74f7f5 --- /dev/null +++ b/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(); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java new file mode 100644 index 0000000000..eba101aada --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateTreeDefineProcessor.java @@ -0,0 +1,24 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.TemplateTreeDefineProcessor; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/21 + */ +@API(level = TemplateTreeDefineProcessor.CURRENT_LEVEL) +public abstract class AbstractTemplateTreeDefineProcessor implements TemplateTreeDefineProcessor { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } + +} diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java index e3bf61e9dc..71289376a0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOption.java +++ b/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); diff --git a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java b/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java index 0266d9eb97..e9ba427880 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/WidgetOptionFactory.java +++ b/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 widgetClass) { return new CustomWidgetOption(optionName, optionIcon, widgetClass); } -} \ No newline at end of file + + public static WidgetOption createByWidgetClass(String optionName, String resource, Class widgetClass) { + Icon optionIcon = IconUtils.readIcon(resource); + return new CustomWidgetOption(optionName, optionIcon, widgetClass); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java index 5a3fb62b50..1908751c6a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java +++ b/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)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; } diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index c21b740c43..fbbe38ce48 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/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)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java index 0ba64b3f64..06f30e1aef 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java +++ b/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())); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java index 8405ce09ea..0a8e4769a9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -46,7 +46,6 @@ public abstract class HyperlinkGroupPane extends UIListControlPane { @Override public void on(PluginEvent event) { refreshNameableCreator(createNameableCreators()); - HistoryTemplateListCache.getInstance().reloadCurrentTemplate(); } }, new PluginFilter() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java index 2c0612e024..b3ad1e179a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDependenceSettingPane.java +++ b/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(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java index 32f20ad563..335397d908 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButton.java +++ b/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; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java b/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java index cccf64e26d..73da78151b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java +++ b/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); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 435d5a465a..f3771a0f90 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/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 tList = new ArrayList(); - for (int i = 0; i < resFns.length; i++) { - if (filter.accept(resFns[i])) { - tList.add(resFns[i]); + Map 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())); diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java index 7d12a013ed..3f5fff689b 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java +++ b/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(); } diff --git a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java b/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java index e01aa5251a..e3802161b1 100644 --- a/designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java +++ b/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"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index 4f59032dca..d2771cd491 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -17,7 +17,6 @@ import com.fr.design.file.FileToolbarStateChangeListener; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; -import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -58,7 +57,6 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingConstants; -import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; @@ -318,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 @@ -344,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 @@ -426,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 @@ -443,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 @@ -461,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 @@ -500,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 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 0703216eba..8827d6a857 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/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,10 @@ 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; import com.fr.plugin.injectable.PluginModule; @@ -98,16 +99,32 @@ 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, // 表单 + FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 FORM_REPORT, // 表单报表块 POLY, // 聚合报表 POLY_REPORT, // 聚合报表-报表块 - POLY_CHART, // 聚合报表-图表块 + POLY_CHART(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块 AUTHORITY_EDITION, // 权限编辑 - AUTHORITY_EDITION_DISABLED // 权限编辑 + AUTHORITY_EDITION_DISABLED; // 权限编辑 + + private String title; + + PropertyMode() { + this.title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); + } + + PropertyMode(String title) { + this.title = title; + } + + public String getTitle() { + return this.title; + } } + private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板) @@ -256,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"), @@ -400,6 +417,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void updatePropertyItemMap() { for (PropertyItem item : propertyItemMap.values()) { item.updateStatus(); + item.updateTitle(); } } @@ -684,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, 三者之一 @@ -734,6 +754,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } + public void updateTitle() { + try { + if (StringUtils.equals(KEY_WIDGET_SETTINGS, name)) { + title = currentMode.getTitle(); + button.setToolTipText(title); + UILabel uiLabel = (UILabel) ((BorderLayout) popupToolPane.contentPane.getLayout()).getLayoutComponent(BorderLayout.WEST); + uiLabel.setText(title); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + } + } + public void reAddContentArea() { propertyPanel.add(contentArea, BorderLayout.CENTER); } @@ -858,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); } @@ -867,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; @@ -878,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); } @@ -891,6 +924,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } } }; + button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED)); button.set4LargeToolbarButton(); button.setUI(new UIButtonUI() { @Override @@ -1217,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; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java index 487d18a565..0c17adcd4f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java +++ b/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; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 6c6de287e6..a47a6095de 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.Parameter; -import com.fr.base.ScreenResolution; import com.fr.base.io.BaseBook; import com.fr.base.iofile.attr.DesignBanCopyAttrMark; import com.fr.base.iofile.attr.TemplateIdAttrMark; @@ -24,6 +23,7 @@ import com.fr.design.designer.TargetComponent; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.TemplateResourceManager; import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.MenuHandler; @@ -49,6 +49,7 @@ import com.fr.design.menu.ShortCut; import com.fr.design.preview.PagePreview; import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationPane; +import com.fr.event.EventDispatcher; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.MemFILE; @@ -78,6 +79,7 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JOptionPane; +import javax.swing.SwingWorker; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.undo.UndoManager; import java.util.ArrayList; @@ -107,7 +109,6 @@ public abstract class JTemplate> private DesignModelAdapter designModel; private PreviewProvider previewType; protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer(); - public int resolution = ScreenResolution.getScreenResolution(); private PluginEventListener pluginListener; @@ -125,6 +126,7 @@ public abstract class JTemplate> public JTemplate(T t, FILE file, boolean isNewFile) { super(t); + beforeInit(); // 判断是否切换设计器状态到禁止拷贝剪切 if (t.getAttrMark(DesignBanCopyAttrMark.XML_TAG) != null) { DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.BAN_COPY_AND_CUT); @@ -301,6 +303,20 @@ public abstract class JTemplate> } + /** + * 模板初始化之前 + */ + private void beforeInit() { + EventDispatcher.fire(JTemplateEvent.BEFORE_TEMPLATE_INIT, this); + } + + /** + * 模板激活之前之前 + */ + protected void beforeActive() { + EventDispatcher.fire(JTemplateEvent.BEFORE_TEMPLATE_ACTIVE, this); + } + /** * 模板关闭时 */ @@ -309,6 +325,7 @@ public abstract class JTemplate> PluginListenerRegistration.getInstance().stopListen(this.pluginListener); } + /** * 刷新内部资源 * @@ -316,19 +333,41 @@ public abstract class JTemplate> * CenterPane 负责监听改动。 * 所以需要同步处理 */ + @Deprecated public void refreshResource() { + refreshResource(this.editingFILE); + } - try { - this.template = JTemplateFactory.asIOFile(this.editingFILE); - setTarget(this.template); + public void refreshResource(FILE file) { - // 先移除旧的。 - removeCenterPane(); - // 加入新的 - addCenterPane(); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + setTargetByFile(file); + return null; + } + + @Override + public void done() { + try { + get(); + // 先移除旧的。 + removeCenterPane(); + // 加入新的 + addCenterPane(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }.execute(); + + } + + private void setTargetByFile(FILE file) { + this.template = JTemplateFactory.asIOFile(file, this.suffix()); + setTarget(this.template); } private void addCenterPane() { @@ -797,7 +836,7 @@ public abstract class JTemplate> return false; } try { - this.getTarget().export(editingFILE.asOutputStream()); + this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE)); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), "Save Error", JOptionPane.ERROR_MESSAGE); @@ -1076,6 +1115,7 @@ public abstract class JTemplate> * 激活指定的template */ public void activeJTemplate(int index, JTemplate jt) { + beforeActive(); DesignerContext.getDesignerFrame().activateJTemplate(this); } @@ -1083,6 +1123,7 @@ public abstract class JTemplate> * 激活已存在的模板 */ public void activeOldJTemplate() { + beforeActive(); DesignerContext.getDesignerFrame().activateJTemplate(this); } @@ -1090,6 +1131,7 @@ public abstract class JTemplate> * 激活新的模板 */ public void activeNewJTemplate() { + beforeActive(); DesignerContext.getDesignerFrame().addAndActivateJTemplate(this); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateEvent.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateEvent.java new file mode 100644 index 0000000000..d60d064743 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateEvent.java @@ -0,0 +1,19 @@ +package com.fr.design.mainframe; + +import com.fr.event.Event; + +/** + * Created by kerry on 2020-12-11 + */ +public enum JTemplateEvent implements Event { + /** + * 模板初始化之前 + */ + BEFORE_TEMPLATE_INIT, + + /** + * 模板激活之前 + */ + BEFORE_TEMPLATE_ACTIVE + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java index 678b9bf841..5e75cc64be 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java +++ b/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> ALL_APP = new ArrayList>(); @@ -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 asIOFile(@Nonnull FILE file) { - - String fileName = file.getName(); - int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); + + @Nullable + public static 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 asIOFile(@NotNull FILE file) { + return asIOFile(file, file.getName()); + } + + /** * 注册app. diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java index 64a10c88f2..911c0dc17a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java @@ -208,6 +208,7 @@ public class JVirtualTemplate extends JTemplate { @Override public void activeJTemplate(int index, JTemplate jt) { + beforeActive(); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); historyList.set(index, jt); DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt); @@ -217,11 +218,13 @@ public class JVirtualTemplate extends JTemplate { @Override public void activeOldJTemplate() { + beforeActive(); DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); } @Override public void activeNewJTemplate() { + beforeActive(); DesignerContext.getDesignerFrame().openTemplate(this.getEditingFILE()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java index 9025b98064..262ccc8778 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java +++ b/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 { 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); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java b/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java index cd651fc6b3..1b34722e6f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java +++ b/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 { writer.end(); writer.startTAG(XML_CHART_INFO_LIST); - for (ChartInfo chartInfo : pointInfoMap.values()) { + + List list = new ArrayList<>(pointInfoMap.values()); + Collections.sort(list); + for (ChartInfo chartInfo : list) { chartInfo.writeXML(writer); } writer.end(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java new file mode 100644 index 0000000000..3448ab202c --- /dev/null +++ b/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 classForMobileParamStyle() { + return DefaultMobileParameterStyle.class; + } + + @Override + public Class> classForMobileParamAppearance() { + return DefaultMobileParamDefinePane.class; + } + + @Override + public String displayName() { + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT"); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java new file mode 100644 index 0000000000..46ed13071f --- /dev/null +++ b/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 classForMobileParamStyle() { + return EmptyMobileParamStyle.class; + } + + @Override + public Class> classForMobileParamAppearance() { + return EmptyMobileParamDefinePane.class; + } + + @Override + public String displayName() { + return styleProvider.descriptor(); + } + + public MobileParamStyleProvider getStyleProvider() { + return styleProvider; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java new file mode 100644 index 0000000000..838e8f599e --- /dev/null +++ b/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 { + + 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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java new file mode 100644 index 0000000000..b973d599a4 --- /dev/null +++ b/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 { + + 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; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java new file mode 100644 index 0000000000..cd9ee22023 --- /dev/null +++ b/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 { + + private BasicBeanPane 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"; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java new file mode 100644 index 0000000000..7f1d270af5 --- /dev/null +++ b/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 listModel; + private JPanel right; + private CardLayout card; + private JList paramStyleList; + + + private Map> 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 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 paramUIProviders = ExtraDesignClassManager.getInstance().getArray(MobileParamUIProvider.XML_TAG); + List result = new ArrayList<>(); + result.add(new DefaultMobileParamUIProvider()); + result.addAll(paramUIProviders); + Set nameSets = paramUIProviders.stream().map(MobileParamUIProvider::displayName).collect(Collectors.toSet()); + // 兼容老接口 + Set 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]); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java index 099684a81a..23cc188edb 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -56,20 +57,24 @@ public class BasicPropertyPane extends BasicPane { } } }; - widgetName.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); + widgetName.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Name")), widgetName}, + new Component[]{new UILabel(obtainBasicName()), widgetName}, }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.add(panel, BorderLayout.NORTH); } + public String obtainBasicName(){ + return Toolkit.i18nText("Fine-Design_Basic_Component_Name"); + } + public UITextField getWidgetNameField() { return widgetName; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java new file mode 100644 index 0000000000..d4f2b8129e --- /dev/null +++ b/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(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java b/designer-base/src/main/java/com/fr/design/menu/MenuDef.java index 10f9944947..f2ed81394b 100644 --- a/designer-base/src/main/java/com/fr/design/menu/MenuDef.java +++ b/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 { } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java index 8522d67734..178779f518 100644 --- a/designer-base/src/main/java/com/fr/design/preview/FormPreview.java +++ b/designer-base/src/main/java/com/fr/design/preview/FormPreview.java @@ -1,6 +1,7 @@ package com.fr.design.preview; import com.fr.design.fun.impl.AbstractPreviewProvider; +import com.fr.design.i18n.Toolkit; /** @@ -12,7 +13,7 @@ public class FormPreview extends AbstractPreviewProvider { @Override public String nameForPopupItem() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Form_Preview"); + return Toolkit.i18nText("Fine-Design_Form_M_PC_Preview"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java index f48cb12edf..30112dc7a3 100644 --- a/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java @@ -1,6 +1,6 @@ package com.fr.design.remote.action; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -27,7 +27,7 @@ public class RemoteDesignAuthManagerAction extends UpdateAction { public RemoteDesignAuthManagerAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Authority_Manager")); // 远程设计权限管理 - this.setSmallIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x.png")); + this.setSmallIcon("com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x"); } diff --git a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java index 07ec40bfee..588e4601d0 100644 --- a/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java +++ b/designer-base/src/main/java/com/fr/design/report/WatermarkPane.java @@ -1,14 +1,16 @@ package com.fr.design.report; +import com.fr.base.BaseFormula; import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.design.dialog.BasicPane; -import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.editor.editor.FormulaEditor; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UnsignedIntUISpinner; import com.fr.design.gui.style.FRFontPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -50,7 +52,7 @@ public class WatermarkPane extends BasicPane { // 水印预览面板 private WatermarkPreviewPane watermarkPreviewPane; // 文字 - private TinyFormulaPane formulaPane; + private FormulaEditor formulaPane; // 字号 private UIComboBox fontSizeComboBox; //横向间距 @@ -119,16 +121,16 @@ public class WatermarkPane extends BasicPane { return watermark; } - public TinyFormulaPane getFormulaPane() { + public FormulaEditor getFormulaPane() { return formulaPane; } - public void setFormulaPane(TinyFormulaPane formulaPane) { + public void setFormulaPane(FormulaEditor formulaPane) { this.formulaPane = formulaPane; } protected UIScrollPane initRightPane() { - formulaPane = new TinyFormulaPane(); + formulaPane = new FormulaEditor(Toolkit.i18nText("Fine-Design_Report_Parameter_Formula")); fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); fontSizeComboBox.setEditable(true); horizontalGapSpinner = new UnsignedIntUISpinner(100, Integer.MAX_VALUE, 1, 200); @@ -228,7 +230,7 @@ public class WatermarkPane extends BasicPane { } private void populateFourmula(String formula) { - this.formulaPane.populateBean(formula); + this.formulaPane.setValue(BaseFormula.createFormulaBuilder().build(formula)); this.formulaPane.getUITextField().getDocument() .addDocumentListener(new DocumentListener() { @Override diff --git a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java index c24125059c..ae0cfd2b65 100644 --- a/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java +++ b/designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java @@ -1,13 +1,14 @@ package com.fr.design.report.fit.menupane; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.JTemplateAction; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.UIDialog; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuKeySet; -import com.fr.general.IOUtils; import com.fr.report.fit.FitProvider; import com.fr.report.fit.ReportFitAttr; @@ -26,7 +27,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Template"); + return Toolkit.i18nText("Fine-Designer_PC_Fit_Attr"); } @Override @@ -42,7 +43,7 @@ public class ReportFitAttrAction extends JTemplateAction { @Override public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Elementcase"); + return Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr"); } @Override @@ -65,7 +66,7 @@ public class ReportFitAttrAction extends JTemplateAction { } this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/reportfit/fit.png")); + this.setSmallIcon("/com/fr/design/images/reportfit/fit"); } /** diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 65f66290ec..f393b1a09c 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -181,7 +181,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo } private void initbuttonGroup() { - + Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; String[] textArray = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FS_Name")}; buttonGroup = new UIHeadGroup(iconArray, textArray) { @@ -254,7 +254,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo public RefreshAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh")); - this.setSmallIcon(UIConstants.REFRESH_ICON); + this.setSmallIcon("/com/fr/design/images/buttonicon/refresh"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java index 9066b4a901..9a8640f627 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java @@ -3,7 +3,8 @@ */ package com.fr.design.style.color; -import com.fr.base.BaseUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; @@ -34,7 +35,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi private UIObserverListener uiObserverListener; public UIToolbarColorButton(Icon icon) { - super(new UIColorButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); + super(new UIColorButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup"))); getLeftButton().setEventBanned(true); getRightButton().addFocusListener(new FocusListener() { @@ -244,4 +245,4 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi public boolean shouldResponseChangeListener() { return true; } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java index d65d8fec58..2b768d995b 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java @@ -1,6 +1,6 @@ package com.fr.design.update.actions; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.os.impl.UpdateDialogAction; import com.fr.stable.os.support.OSBasedAction; @@ -15,7 +15,7 @@ public class SoftwareUpdateAction extends UpdateAction { public SoftwareUpdateAction() { setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); - setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png")); + setSmallIcon("/com/fr/design/images/update/update_new"); } diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java b/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java index d27b6721a4..e97a5826a1 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java @@ -3,6 +3,7 @@ package com.fr.design.upm; import com.fr.common.annotations.Negative; import com.fr.config.ServerPreferenceConfig; import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.stable.StringUtils; import java.util.ArrayList; @@ -31,6 +32,7 @@ public class UpmUtils { Map map4Tpl = new HashMap<>(); map4Tpl.put("version", ServerPreferenceConfig.getInstance().getOptimizedUPMVersion()); map4Tpl.put("new_version", fetchLatestVersion()); + map4Tpl.put("language", GeneralContext.getLocale().toString()); return map4Tpl; } diff --git a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java index c4c840227c..9b6e7b5c83 100644 --- a/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/widget/WidgetBoundsPaneFactory.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; @@ -18,6 +19,30 @@ import java.awt.Component; * Created by plough on 2017/8/7. */ public class WidgetBoundsPaneFactory { + + public enum NameAttribute { + //默认的名称 + DEFAULT(Toolkit.i18nText("Fine-Design_Basic_Component_Position"), Toolkit.i18nText("Fine-Design_Basic_Component_Size")), + //控件对应的名称 + WIDGET(Toolkit.i18nText("Fine-Design_Basic_Widget_Position"), Toolkit.i18nText("Fine-Design_Basic_Widget_Size")); + + private String positionName; + private String sizeName; + + NameAttribute(String positionName, String sizeName) { + this.positionName = positionName; + this.sizeName = sizeName; + } + + public String getPositionName() { + return positionName; + } + + public String getSizeName() { + return sizeName; + } + } + private static final int RIGHT_PANE_WIDTH = 145; public static UIExpandablePane createBoundsPane(UISpinner width, UISpinner height) { @@ -25,8 +50,8 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, + new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; double[] columnSize = {f, RIGHT_PANE_WIDTH}; @@ -34,9 +59,10 @@ public class WidgetBoundsPaneFactory { final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W5, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } - public static JPanel createRightPane(Component com1, Component com2){ + + public static JPanel createRightPane(Component com1, Component com2) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; @@ -48,17 +74,17 @@ public class WidgetBoundsPaneFactory { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L6, IntervalConstants.INTERVAL_L1); } - public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height, NameAttribute nameAttribute) { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] northComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Position")), createRightPane(x, y)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getPositionName()), createRightPane(x, y)}, + new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_X_Coordinate"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Y_Coordinate"), SwingConstants.CENTER))}, }; Component[][] centerComponents = new Component[][]{ - new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), createRightPane(width, height)}, - new Component[]{null, createRightPane(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, + new Component[]{FRWidgetFactory.createLineWrapLabel(nameAttribute.getSizeName()), createRightPane(width, height)}, + new Component[]{null, createRightPane(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Width"), SwingConstants.CENTER), new UILabel(Toolkit.i18nText("Fine-Design_Basic_Tree_Height"), SwingConstants.CENTER))}, }; double[] rowSize = {p, p}; double[] columnSize = {f, RIGHT_PANE_WIDTH}; @@ -70,7 +96,11 @@ public class WidgetBoundsPaneFactory { centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); boundsPane.add(northPanel, BorderLayout.NORTH); boundsPane.add(centerPanel, BorderLayout.CENTER); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 230, 24, boundsPane); + } + + public static UIExpandablePane createAbsoluteBoundsPane(UISpinner x, UISpinner y, UISpinner width, UISpinner height) { + return createAbsoluteBoundsPane(x, y, width, height, NameAttribute.DEFAULT); } @@ -79,7 +109,7 @@ public class WidgetBoundsPaneFactory { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Component_Size")), width}, }; double[] rowSize = {p}; double[] columnSize = {p, f}; @@ -87,6 +117,6 @@ public class WidgetBoundsPaneFactory { final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L6); panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); boundsPane.add(panel); - return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); + return new UIExpandablePane(Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"), 280, 24, boundsPane); } } diff --git a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java index 72a199a5b2..d77e1e9000 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -150,6 +150,7 @@ public class NumberEditorValidatePane extends JPanel { setMaxListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + refreshErrorMsgTip(); if (setMaxValueCheckBox.isSelected()) { maxValueSpinner.setEnabled(true); Double value = (double) 0; @@ -171,6 +172,7 @@ public class NumberEditorValidatePane extends JPanel { setMinListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + refreshErrorMsgTip(); if (setMinValueCheckBox.isSelected()) { minValueSpinner.setEnabled(true); Double value = (double) 0; @@ -218,6 +220,14 @@ public class NumberEditorValidatePane extends JPanel { }; } + private void refreshErrorMsgTip() { + boolean visible = setMaxValueCheckBox.isSelected() || setMinValueCheckBox.isSelected(); + errorMsgTextFieldPane.setVisible(visible); + if (!visible) { + errorMsgTextField.setText(StringUtils.EMPTY); + } + } + public void populate(NumberEditor e) { allowDecimalsCheckBox.setSelected(e.isAllowDecimals()); if (e.isAllowDecimals()) { diff --git a/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java new file mode 100644 index 0000000000..42dae0fa19 --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/PluginErrorRemindDialog.java @@ -0,0 +1,120 @@ +package com.fr.env; + +import com.fr.design.actions.server.PluginManagerAction; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; +import com.fr.general.IOUtils; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextPane; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * 插件启动失败提示窗 + */ +public class PluginErrorRemindDialog extends JDialog implements ActionListener { + + private static final String SIM_HEI = "SimHei"; + + public PluginErrorRemindDialog(Frame parent, String text) { + super(parent, true); + //上面的标签面板 + JPanel topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + JPanel imagePanel = new JPanel(); + Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/icon_WarningIcon_normal.png"); + + JLabel imageLabel = new JLabel(); + imageLabel.setIcon(icon); + imagePanel.add(imageLabel); + imagePanel.setPreferredSize(new Dimension(48, 48)); + + JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); + + JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Title")); + label.setFont(FRFont.getInstance().applySize(16).applyName(SIM_HEI)); + label.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20)); + + verticalPanel.add(label); + + topPanel.add(imagePanel, BorderLayout.WEST); + topPanel.add(verticalPanel, BorderLayout.CENTER); + topPanel.setPreferredSize(new Dimension(600, 73)); + topPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 0, 20)); + + //中间的文本域面板 + JPanel centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + centerPanel.setPreferredSize(new Dimension(580, 269)); + + JTextPane textPane = new JTextPane(); + + SimpleAttributeSet attributeSet = new SimpleAttributeSet(); + StyleConstants.setFontFamily(attributeSet, SIM_HEI); + StyleConstants.setLineSpacing(attributeSet, 0.5f); + textPane.setParagraphAttributes(attributeSet, true); + + textPane.setEditable(false); + textPane.setMargin(new Insets(10, 10, 10, 10)); + textPane.setText(text); + centerPanel.add(textPane, BorderLayout.CENTER); + + UIButton cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Not_Deal_With")); + UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Plugin_Error_Remind_Deal_With")); + + cancelButton.addActionListener(this); + okButton.addActionListener(new PluginManagerActionAdapter(this)); + + // 按钮 + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); + buttonPanel.add(cancelButton); + buttonPanel.add(okButton); + + + this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")); + this.setResizable(false); + + this.add(topPanel, BorderLayout.NORTH); + this.add(centerPanel, BorderLayout.CENTER); + this.add(buttonPanel, BorderLayout.SOUTH); + this.setSize(new Dimension(600, 400)); + + GUICoreUtils.centerWindow(this); + } + + @Override + public void actionPerformed(ActionEvent e) { + this.dispose(); + } + + private static class PluginManagerActionAdapter extends PluginManagerAction { + + private JDialog jDialog; + + public PluginManagerActionAdapter(JDialog jDialog) { + this.jDialog = jDialog; + } + + @Override + public void actionPerformed(ActionEvent e) { + this.jDialog.dispose(); + super.actionPerformed(e); + } + } + +} diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index b033d229b9..d096faf8a7 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -2,6 +2,7 @@ package com.fr.file; import com.fr.base.BaseUtils; import com.fr.base.FRContext; +import com.fr.design.file.TemplateResourceManager; import com.fr.io.FineEncryptUtils; import com.fr.base.io.XMLEncryptUtils; import com.fr.design.file.NodeAuthProcessor; @@ -22,10 +23,8 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.resource.WorkResourceTempRenameStream; -import com.fr.workspace.server.lock.TplOperator; import javax.swing.*; -import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; @@ -324,7 +323,7 @@ public class FileNodeFILE implements FILE { } try { - return WorkContext.getWorkResource().exist(node.getEnvPath()); + return TemplateResourceManager.getResource().exist(node.getEnvPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; @@ -379,14 +378,11 @@ public class FileNodeFILE implements FILE { if (!envPath.startsWith(ProjectConstants.REPORTLETS_NAME)) { return null; } - InputStream in = new ByteArrayInputStream( - WorkContext.getCurrent().get(TplOperator.class).readAndLockFile( - StableUtils.pathJoin( - ProjectConstants.REPORTLETS_NAME, - envPath.substring(ProjectConstants.REPORTLETS_NAME.length() + 1) - ) - ) - ); + InputStream in = TemplateResourceManager.getResource().readTemplate( + StableUtils.pathJoin( + ProjectConstants.REPORTLETS_NAME, + envPath.substring(ProjectConstants.REPORTLETS_NAME.length() + 1) + )); return envPath.endsWith(".cpt") || envPath.endsWith(".frm") ? XMLEncryptUtils.decodeInputStream(EncryptUtils.decodeInputStream(FineEncryptUtils.decode(in))) : in; diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder.png new file mode 100644 index 0000000000..9ea75fc6d8 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg new file mode 100644 index 0000000000..f3936e1539 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg @@ -0,0 +1,8 @@ + + + icon_NewFolderIcon_disable + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg new file mode 100644 index 0000000000..85f41e26a7 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg @@ -0,0 +1,8 @@ + + + icon_NewFolderIcon_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh.png new file mode 100644 index 0000000000..37df066470 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg new file mode 100644 index 0000000000..4e3fd9c147 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg @@ -0,0 +1,7 @@ + + + icon_刷新_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove.png new file mode 100644 index 0000000000..6fb2baac51 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg new file mode 100644 index 0000000000..1245fbd4e3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg @@ -0,0 +1,7 @@ + + + icon_删除_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg new file mode 100644 index 0000000000..69a3011faf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg @@ -0,0 +1,7 @@ + + + icon_删除_normal copy + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename.png new file mode 100644 index 0000000000..5c244dd5d4 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg new file mode 100644 index 0000000000..953e12eaa9 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重命名_disable + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg new file mode 100644 index 0000000000..a2c287789d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg @@ -0,0 +1,7 @@ + + + icon_重命名_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list.png new file mode 100644 index 0000000000..df6cd02de6 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg new file mode 100644 index 0000000000..b88ee0998e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg @@ -0,0 +1,7 @@ + + + icon_版本管理_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg new file mode 100644 index 0000000000..ebfca43899 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg @@ -0,0 +1,7 @@ + + + icon_版本管理_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder.png b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder.png new file mode 100644 index 0000000000..4d16dc7aea Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg new file mode 100644 index 0000000000..376d372d41 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg @@ -0,0 +1,7 @@ + + + icon_打开文件_disable + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg new file mode 100644 index 0000000000..42ae6cbd3d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg @@ -0,0 +1,7 @@ + + + icon_所在文件夹_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg new file mode 100644 index 0000000000..ae72bfa4db --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/bbs_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/首页_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg new file mode 100644 index 0000000000..5212ea9b91 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/bug_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/bug反馈_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg new file mode 100644 index 0000000000..659f84062a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/center_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/活动中心_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg new file mode 100644 index 0000000000..3e229e01ae --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/facebook_normal.svg @@ -0,0 +1,9 @@ + + + icon_facebook粉丝圈_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg new file mode 100644 index 0000000000..56473312bf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/help_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/帮助文档_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg new file mode 100644 index 0000000000..04bccffda3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/need_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/需求反馈_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg new file mode 100644 index 0000000000..27005769cc --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/question_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/问题求助_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg new file mode 100644 index 0000000000..4054250809 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/sign_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/报表工程师认证_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg new file mode 100644 index 0000000000..ce4e0789bb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/solution_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/技术方案_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg b/designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg new file mode 100644 index 0000000000..659581e0dc --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/bbs/video_normal.svg @@ -0,0 +1,7 @@ + + + icon/社区/视频教程_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg new file mode 100644 index 0000000000..55c093fb42 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/absolute_layout_normal.svg @@ -0,0 +1,7 @@ + + + icon_绝对画薄块_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg new file mode 100644 index 0000000000..95104065fb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/card_layout_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_tab块_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form3_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form3_normal.svg new file mode 100644 index 0000000000..41fa6afa64 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/new_form3_normal.svg @@ -0,0 +1,8 @@ + + + icon_新建表单_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg new file mode 100644 index 0000000000..587d4963b5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/newcpts_normal.svg @@ -0,0 +1,11 @@ + + + icon_标签栏_工作簿_normal + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg new file mode 100644 index 0000000000..68f2cb3d14 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/open_normal.svg @@ -0,0 +1,7 @@ + + + icon_导入文件_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg new file mode 100644 index 0000000000..7df1acf348 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_disabled.svg @@ -0,0 +1,8 @@ + + + icon_属性_权限编辑_disabled + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg new file mode 100644 index 0000000000..b7000e6f96 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_权限编辑_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg new file mode 100644 index 0000000000..e70df0a896 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/authorityedit_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_权限编辑_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg new file mode 100644 index 0000000000..bf79dfdbf6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格属性_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg new file mode 100644 index 0000000000..ca05aca236 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格属性_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg new file mode 100644 index 0000000000..bf0af1df1a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellattr_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格属性_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg new file mode 100644 index 0000000000..f839505353 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg new file mode 100644 index 0000000000..32256c90fb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg new file mode 100644 index 0000000000..e5c0423676 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/cellelement_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg new file mode 100644 index 0000000000..a7d31cd63e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg new file mode 100644 index 0000000000..48655aa194 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg new file mode 100644 index 0000000000..8d8e798466 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/conditionattr_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg new file mode 100644 index 0000000000..61a2c84fea --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_配置角色_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg new file mode 100644 index 0000000000..972f102b1d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_配置角色_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg new file mode 100644 index 0000000000..74eef28bb3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/configuredroles_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_配置角色_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg new file mode 100644 index 0000000000..edf86bce7d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_悬浮元素_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg new file mode 100644 index 0000000000..c98ec8852e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_悬浮元素_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg new file mode 100644 index 0000000000..517c3c1aa3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/floatelement_selected.svg @@ -0,0 +1,8 @@ + + + icon_属性_悬浮元素_selected + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg new file mode 100644 index 0000000000..56c05df4cf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg new file mode 100644 index 0000000000..9d50a6616d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg new file mode 100644 index 0000000000..1c3dd78f7f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/hyperlink_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg new file mode 100644 index 0000000000..4e5ad7a64d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_组件库_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg new file mode 100644 index 0000000000..a5848ed13c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_组件库_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg new file mode 100644 index 0000000000..48dc61a997 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetlib_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_组件库_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg new file mode 100644 index 0000000000..e461edef65 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_disabled.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg new file mode 100644 index 0000000000..9f7c629ad1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg new file mode 100644 index 0000000000..fe17b80623 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/propertiestab/widgetsettings_selected.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg new file mode 100644 index 0000000000..ae600230cd --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重做_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg new file mode 100644 index 0000000000..8c26e8925f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/redo_normal.svg @@ -0,0 +1,7 @@ + + + icon_重做_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg new file mode 100644 index 0000000000..2fef231c44 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/report_16_normal.svg @@ -0,0 +1,10 @@ + + + icon_报表块_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg new file mode 100644 index 0000000000..99087a805b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_disabled.svg @@ -0,0 +1,12 @@ + + + icon_保存_disabled + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg new file mode 100644 index 0000000000..f1caf5d1e7 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/save_normal.svg @@ -0,0 +1,12 @@ + + + icon_保存_normal + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg new file mode 100644 index 0000000000..24c5cd7c93 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_撤销_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg new file mode 100644 index 0000000000..d36032371a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/undo_normal.svg @@ -0,0 +1,7 @@ + + + icon_撤销_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg new file mode 100644 index 0000000000..0075e9b27d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_按钮_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg new file mode 100644 index 0000000000..847399b276 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/button_group_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_单选框组_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg new file mode 100644 index 0000000000..9018cbd653 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/check_box_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_复选框_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg new file mode 100644 index 0000000000..18cdfb342d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_复选框组_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg new file mode 100644 index 0000000000..cbb7c39068 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_下拉框_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg new file mode 100644 index 0000000000..3c5cf474c3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_下拉复选框_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg new file mode 100644 index 0000000000..8c32ce6a68 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_下拉树_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg new file mode 100644 index 0000000000..0c77109219 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/date_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_日期_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg new file mode 100644 index 0000000000..eab538ae95 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/label_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_标签_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg new file mode 100644 index 0000000000..171842baa8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/number_field_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_数字_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg new file mode 100644 index 0000000000..6a0c47b4b3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/password_field_16_normal.svg @@ -0,0 +1,8 @@ + + + icon_控件_密码_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg new file mode 100644 index 0000000000..b576394acf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_area_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_文本域_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg new file mode 100644 index 0000000000..04d51b5b2d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/text_field_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_文本框_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg new file mode 100644 index 0000000000..342e0fa963 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/widget/tree_16_normal.svg @@ -0,0 +1,7 @@ + + + icon_控件_目录树_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg b/designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg new file mode 100644 index 0000000000..a58a7e161d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/chart/ChartType_normal.svg @@ -0,0 +1,9 @@ + + + icon_图表预定义配色_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/data/bind/distanceconnect_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/bind/distanceconnect_normal.svg new file mode 100644 index 0000000000..93bcbdb40c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/bind/distanceconnect_normal.svg @@ -0,0 +1,10 @@ + + + icon_distanceconnect_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/data/bind/localconnect_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/bind/localconnect_normal.svg new file mode 100644 index 0000000000..d5a4717d24 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/bind/localconnect_normal.svg @@ -0,0 +1,8 @@ + + + icon_HomeFolderIcon_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg new file mode 100644 index 0000000000..5822e894e7 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/dock/serverdatabase_normal.svg @@ -0,0 +1,13 @@ + + + icon_服务器数据集_normal + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg b/designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg new file mode 100644 index 0000000000..7885f3e34b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/data/source/dataDictionary_normal.svg @@ -0,0 +1,7 @@ + + + icon_形态_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg new file mode 100644 index 0000000000..ae600230cd --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/redo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重做_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg new file mode 100644 index 0000000000..b15749b41d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/redo_normal.svg @@ -0,0 +1,7 @@ + + + icon_重做_下拉列表用 + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg new file mode 100644 index 0000000000..24c5cd7c93 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/undo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_撤销_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg new file mode 100644 index 0000000000..0e49c799e6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/edit/undo_normal.svg @@ -0,0 +1,7 @@ + + + icon_撤销_下拉列表用 + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg new file mode 100644 index 0000000000..fb0a350ddb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/expand/cellAttr_normal.svg @@ -0,0 +1,7 @@ + + + icon_扩展_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg new file mode 100644 index 0000000000..577e8bd8a0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/gui/color/background_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本背景色_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg new file mode 100644 index 0000000000..0eaa40e93a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/gui/color/foreground_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本前景色_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg b/designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg new file mode 100644 index 0000000000..6d64eb7a70 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/gui/popup_normal.svg @@ -0,0 +1,7 @@ + + + icon_组件分隔_箭头下_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg new file mode 100644 index 0000000000..05585d3abd --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_disabled.svg @@ -0,0 +1,7 @@ + + + icon_复制_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg new file mode 100644 index 0000000000..7e45e69356 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/copy_normal.svg @@ -0,0 +1,10 @@ + + + icon_复制_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg new file mode 100644 index 0000000000..6f469f8e63 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_disabled.svg @@ -0,0 +1,9 @@ + + + icon_剪切_disabled + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg new file mode 100644 index 0000000000..485201206b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/cut_normal.svg @@ -0,0 +1,10 @@ + + + icon_剪切_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg new file mode 100644 index 0000000000..f02c9cb616 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/formatBrush_normal.svg @@ -0,0 +1,9 @@ + + + icon_格式刷_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg new file mode 100644 index 0000000000..a54f56a5bc --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_disabled.svg @@ -0,0 +1,11 @@ + + + icon_合并单元格_disabled + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg new file mode 100644 index 0000000000..ad75844975 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/merge_normal.svg @@ -0,0 +1,11 @@ + + + icon_合并单元格_normal + + + + a + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg new file mode 100644 index 0000000000..778257c33d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_disabled.svg @@ -0,0 +1,10 @@ + + + icon_粘贴_disabled + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg new file mode 100644 index 0000000000..3a2f314044 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/paste_normal.svg @@ -0,0 +1,11 @@ + + + icon_粘贴_normal + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg new file mode 100644 index 0000000000..ae600230cd --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重做_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg new file mode 100644 index 0000000000..b15749b41d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/redo_normal.svg @@ -0,0 +1,7 @@ + + + icon_重做_下拉列表用 + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg new file mode 100644 index 0000000000..24c5cd7c93 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_disabled.svg @@ -0,0 +1,7 @@ + + + icon_撤销_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg new file mode 100644 index 0000000000..0e49c799e6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/undo_normal.svg @@ -0,0 +1,7 @@ + + + icon_撤销_下拉列表用 + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg new file mode 100644 index 0000000000..bb9f7a22f6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_disabled.svg @@ -0,0 +1,10 @@ + + + icon_拆分单元格_disabled + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg new file mode 100644 index 0000000000..3af2c0ff3d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_edit/unmerge_normal.svg @@ -0,0 +1,8 @@ + + + icon_拆分单元格_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg new file mode 100644 index 0000000000..8b0d7ba9d1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/export_normal.svg @@ -0,0 +1,8 @@ + + + icon_服务器工具栏_输出_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg new file mode 100644 index 0000000000..7f28a5105b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/formExport_normal.svg @@ -0,0 +1,11 @@ + + + icon_新建聚合报表_normal + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg new file mode 100644 index 0000000000..f09c3aeadb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/pageSetup_normal.svg @@ -0,0 +1,7 @@ + + + icon_页面设置_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg new file mode 100644 index 0000000000..116063de60 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/repeatAndFrozen_normal.svg @@ -0,0 +1,7 @@ + + + icon_重复与冻结设置_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg new file mode 100644 index 0000000000..8b50d562fe --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/saveAs_normal.svg @@ -0,0 +1,7 @@ + + + icon_另存为_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg new file mode 100644 index 0000000000..c5f6ea3a2a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/save_disabled.svg @@ -0,0 +1,11 @@ + + + icon_save_disable + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg new file mode 100644 index 0000000000..03da5de8f6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/save_normal.svg @@ -0,0 +1,11 @@ + + + icon_save_normal + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg new file mode 100644 index 0000000000..17d5d0dda3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_file/switch_normal.svg @@ -0,0 +1,7 @@ + + + icon_切换工作目录_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg new file mode 100644 index 0000000000..8348b9703a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellAttr_normal.svg @@ -0,0 +1,7 @@ + + + icon_其他属性_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg new file mode 100644 index 0000000000..fa9d660221 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_加粗_nomal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg new file mode 100644 index 0000000000..638fadc32c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/bold_selected.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_加粗_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg new file mode 100644 index 0000000000..46c7848030 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_normal.svg @@ -0,0 +1,7 @@ + + + icon_对齐 居中对齐_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg new file mode 100644 index 0000000000..ca87172041 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_center_selected.svg @@ -0,0 +1,7 @@ + + + icon_对齐 居中对齐_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg new file mode 100644 index 0000000000..480e12e8c1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_normal.svg @@ -0,0 +1,7 @@ + + + icon_对齐 左对齐_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg new file mode 100644 index 0000000000..b859a9ac96 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_left_selected.svg @@ -0,0 +1,7 @@ + + + icon_对齐 左对齐_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg new file mode 100644 index 0000000000..9707e270d9 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_normal.svg @@ -0,0 +1,7 @@ + + + icon_对齐 右对齐_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg new file mode 100644 index 0000000000..f2ca4708cb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/h_right_selected.svg @@ -0,0 +1,7 @@ + + + icon_对齐 右对齐_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg new file mode 100644 index 0000000000..97ed4dd1ae --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_normal.svg @@ -0,0 +1,9 @@ + + + icon_文本工具_斜体_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg new file mode 100644 index 0000000000..1a84fd6da9 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/italic_selected.svg @@ -0,0 +1,9 @@ + + + icon_文本工具_斜体_selected + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg new file mode 100644 index 0000000000..51a6fd7837 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_normal.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_下划线_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg new file mode 100644 index 0000000000..ccaafc40a6 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/cellstyle/underline_selected.svg @@ -0,0 +1,7 @@ + + + icon_文本工具_下划线_selected + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg new file mode 100644 index 0000000000..48655aa194 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/highlight_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_条件属性_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg new file mode 100644 index 0000000000..57f397dabf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/modified_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_控件设置_下拉列表用_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg new file mode 100644 index 0000000000..4f583e6967 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_format/noborder_normal.svg @@ -0,0 +1,7 @@ + + + icon_边框_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg new file mode 100644 index 0000000000..b9755a908d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_help/demo_normal.svg @@ -0,0 +1,7 @@ + + + icon_产品演示_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg new file mode 100644 index 0000000000..bc8c7ac44d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_disabled.svg @@ -0,0 +1,7 @@ + + + icon_斜线_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg new file mode 100644 index 0000000000..e20ec42eb0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bias_normal.svg @@ -0,0 +1,7 @@ + + + icon_斜线_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg new file mode 100644 index 0000000000..6c80b82afb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_disabled.svg @@ -0,0 +1,7 @@ + + + icon_插入数据列_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg new file mode 100644 index 0000000000..ea35ccb27f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/bindColumn_normal.svg @@ -0,0 +1,7 @@ + + + icon_插入数据列_nomal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg new file mode 100644 index 0000000000..a2d91db47d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/cell_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_单元格元素_下拉列表用_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg new file mode 100644 index 0000000000..b2b724c64c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_disabled.svg @@ -0,0 +1,7 @@ + + + icon_图表_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg new file mode 100644 index 0000000000..59fc97567f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/chart_normal.svg @@ -0,0 +1,7 @@ + + + icon_图表_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg new file mode 100644 index 0000000000..95806104dc --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/floatPop_normal.svg @@ -0,0 +1,9 @@ + + + icon_悬浮元素&三角_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg new file mode 100644 index 0000000000..b2204b711e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/float_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_悬浮元素_下拉列表用_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg new file mode 100644 index 0000000000..18eb078e73 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_disabled.svg @@ -0,0 +1,7 @@ + + + icon_公式_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg new file mode 100644 index 0000000000..981ec11b45 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/formula_normal.svg @@ -0,0 +1,7 @@ + + + icon_公式_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg new file mode 100644 index 0000000000..9d50a6616d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/hyperLink_normal.svg @@ -0,0 +1,7 @@ + + + icon_属性_超级链接_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg new file mode 100644 index 0000000000..b18058f59c --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_disabled.svg @@ -0,0 +1,12 @@ + + + icon_图片__disabled + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg new file mode 100644 index 0000000000..19eb761998 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/image_normal.svg @@ -0,0 +1,10 @@ + + + icon_图片_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg new file mode 100644 index 0000000000..a1b3065268 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertColumn_normal.svg @@ -0,0 +1,13 @@ + + + icon_列_normal + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg new file mode 100644 index 0000000000..9a2e37e271 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/insertRow_normal.svg @@ -0,0 +1,14 @@ + + + icon_行_normal + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg new file mode 100644 index 0000000000..916c433033 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_disabled.svg @@ -0,0 +1,7 @@ + + + icon_富文本_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg new file mode 100644 index 0000000000..3665dd01e1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/richtext_normal.svg @@ -0,0 +1,7 @@ + + + icon_富文本_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg new file mode 100644 index 0000000000..14ee3f16c3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_disabled.svg @@ -0,0 +1,12 @@ + + + icon_子报表_disabled + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg new file mode 100644 index 0000000000..d06985a528 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/subReport_normal.svg @@ -0,0 +1,10 @@ + + + icon_子报表_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg new file mode 100644 index 0000000000..a25d12a706 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_disabled.svg @@ -0,0 +1,7 @@ + + + icon_普通文本_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg new file mode 100644 index 0000000000..bf3b0c6879 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_insert/text_normal.svg @@ -0,0 +1,7 @@ + + + icon_普通文本_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg new file mode 100644 index 0000000000..ac662cd61f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/allow_authority_edit_normal.svg @@ -0,0 +1,8 @@ + + + icon_进入权限编辑_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg new file mode 100644 index 0000000000..aa95ad94f0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/background_normal.svg @@ -0,0 +1,10 @@ + + + icon_纸张背景_normal + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg new file mode 100644 index 0000000000..fa76d8b95b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_disabled.svg @@ -0,0 +1,7 @@ + + + icon_关闭_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg new file mode 100644 index 0000000000..74ff5ab385 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/delete_normal.svg @@ -0,0 +1,7 @@ + + + icon_关闭_red + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg new file mode 100644 index 0000000000..a3d57dde95 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/exit_authority_edit_normal.svg @@ -0,0 +1,7 @@ + + + icon_退出权限编辑_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg new file mode 100644 index 0000000000..32d3e1553b --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/footer_normal.svg @@ -0,0 +1,7 @@ + + + icon_页脚_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg new file mode 100644 index 0000000000..c51df52e8f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/header_normal.svg @@ -0,0 +1,7 @@ + + + icon_页眉_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/linearAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/linearAttr_normal.svg new file mode 100644 index 0000000000..2f04689766 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/linearAttr_normal.svg @@ -0,0 +1,7 @@ + + + icon_报表分栏_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg new file mode 100644 index 0000000000..6b21d092b3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/mobile_normal.svg @@ -0,0 +1,7 @@ + + + icon_移动端属性_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/p_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/p_normal.svg new file mode 100644 index 0000000000..11f81ebe39 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/p_normal.svg @@ -0,0 +1,7 @@ + + + icon_参数 模板参数_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/reportEngineAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/reportEngineAttr_normal.svg new file mode 100644 index 0000000000..6490eb9c3e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/reportEngineAttr_normal.svg @@ -0,0 +1,14 @@ + + + icon_报表引擎属性_normal + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/reportWriteAttr_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/reportWriteAttr_normal.svg new file mode 100644 index 0000000000..4e7443f778 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/reportWriteAttr_normal.svg @@ -0,0 +1,11 @@ + + + icon_报表填报属性_normal + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg new file mode 100644 index 0000000000..a3c0cf5154 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/watermark_normal.svg @@ -0,0 +1,7 @@ + + + icon_水印_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_report/webreportattribute_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_report/webreportattribute_normal.svg new file mode 100644 index 0000000000..ed6b252af1 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_report/webreportattribute_normal.svg @@ -0,0 +1,8 @@ + + + icon_模板web属性_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg new file mode 100644 index 0000000000..7c865b45e0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/connection_normal.svg @@ -0,0 +1,11 @@ + + + icon_定义数据连接_normal备份 + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg new file mode 100644 index 0000000000..1e16b5ecfc --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/datasource_normal.svg @@ -0,0 +1,9 @@ + + + icon_模板数据集_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg new file mode 100644 index 0000000000..b3f329e95f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/edit_normal.svg @@ -0,0 +1,8 @@ + + + icon_服务器配置_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg new file mode 100644 index 0000000000..f8bdbd3835 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/function_normal.svg @@ -0,0 +1,7 @@ + + + icon_函数管理器_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg b/designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg new file mode 100644 index 0000000000..9e20fc208d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/m_web/style_normal.svg @@ -0,0 +1,7 @@ + + + icon_样式_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg b/designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg new file mode 100644 index 0000000000..bc44c9dc2f --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/reportfit/fit_normal.svg @@ -0,0 +1,7 @@ + + + icon_模板自适应属性_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg b/designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg new file mode 100644 index 0000000000..f691c42deb --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/server/platform_16_16_normal.svg @@ -0,0 +1,8 @@ + + + icon_报表平台管理_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg b/designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg new file mode 100644 index 0000000000..8b5cd823b5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/server/plugin_normal.svg @@ -0,0 +1,8 @@ + + + icon_插件管理_normal + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg new file mode 100644 index 0000000000..adf5ee4131 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/add_polysheet_normal.svg @@ -0,0 +1,16 @@ + + + icon_sheet_添加数据集_normal + + + + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg new file mode 100644 index 0000000000..2b3f4621da --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_disabled.svg @@ -0,0 +1,7 @@ + + + icon_sheet_下一页_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg new file mode 100644 index 0000000000..588a01a499 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/next_page_normal.svg @@ -0,0 +1,7 @@ + + + icon_sheet_下一页_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg new file mode 100644 index 0000000000..85674ff032 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/polysheet_normal.svg @@ -0,0 +1,9 @@ + + + icon_sheet_normal + + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg new file mode 100644 index 0000000000..6be01cb530 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_disabled.svg @@ -0,0 +1,7 @@ + + + icon_sheet_上一页_disabled + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg new file mode 100644 index 0000000000..9a04977d79 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/sheet/pre_page_normal.svg @@ -0,0 +1,7 @@ + + + icon_sheet_上一页_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg b/designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg new file mode 100644 index 0000000000..1ebd7fc6f0 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/update/update_new_normal.svg @@ -0,0 +1,7 @@ + + + icon_更新升级_normal + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png new file mode 100644 index 0000000000..37dbe939b6 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png new file mode 100644 index 0000000000..756a456566 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/warnings/icon_WarningIcon_normal@2x.png differ diff --git a/designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg b/designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg new file mode 100644 index 0000000000..879af48ed8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/remote/images/icon_Remote_Design_Auth_Manager_normal@1x_normal.svg @@ -0,0 +1,9 @@ + + + icon_远程设计权限管理_normal + + + + + + diff --git a/designer-base/src/test/java/com/fr/base/ClassHelperTest.java b/designer-base/src/test/java/com/fr/base/ClassHelperTest.java new file mode 100644 index 0000000000..c77bb7b67c --- /dev/null +++ b/designer-base/src/test/java/com/fr/base/ClassHelperTest.java @@ -0,0 +1,29 @@ +package com.fr.base; + +import com.fr.form.main.Form; +import com.fr.invoke.ClassHelper; +import com.fr.main.impl.WorkBook; +import java.util.Set; +import junit.framework.TestCase; +import org.junit.Assert; + + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/12/28 + */ +public class ClassHelperTest extends TestCase { + + + public void testGetClassLoaders() { + WorkBook workBook = new WorkBook(); + Set set = ClassHelper.getClassLoaders(workBook); + Assert.assertFalse(set.isEmpty()); + Form form = new Form(); + Set set1 = ClassHelper.getClassLoaders(form); + Assert.assertFalse(set1.isEmpty()); + + } + +} \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java b/designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java new file mode 100644 index 0000000000..a1979db1dc --- /dev/null +++ b/designer-base/src/test/java/com/fr/base/svg/IconUtilsTest.java @@ -0,0 +1,41 @@ +package com.fr.base.svg; + +import com.fr.cert.token.lang.Assert; +import junit.framework.TestCase; + +import javax.swing.Icon; +import javax.swing.ImageIcon; + +/** + * @author Yvan + * @version 10.0 + * Created by Yvan on 2020/12/25 + */ +public class IconUtilsTest extends TestCase { + + public void testReadIcon() { + String resource = "com/fr/design/images/m_edit/copy.png"; + + Icon pngIcon = IconUtils.readIcon(resource); + assertTrue(pngIcon instanceof ImageIcon); + + resource = "com/fr/design/images/m_edit/copy_normal.svg"; + Icon suffixIcon = IconUtils.readIcon(resource); + assertTrue(suffixIcon instanceof SVGIcon); + + resource = "com/fr/design/images/m_edit/copy"; + Icon noSuffixIcon = IconUtils.readIcon(resource); + assertTrue(noSuffixIcon instanceof SVGIcon); + } + + public void testReadSVGIcon() { + String resource = "com/fr/design/images/m_edit/copy.png"; + + Icon suffixIcon = IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_NORMAL); + assertTrue(suffixIcon instanceof SVGIcon); + + resource = "com/fr/design/images/m_edit/copy"; + Icon noSuffixIcon = IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_NORMAL); + assertTrue(noSuffixIcon instanceof SVGIcon); + } +} diff --git a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java index d9d6e44844..07a1d54f84 100644 --- a/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java +++ b/designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java @@ -1,11 +1,15 @@ package com.fr.design; +import com.fr.decision.webservice.v10.plugin.helper.PluginErrorRemindHandler; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.env.CheckServiceDialog; +import com.fr.env.PluginErrorRemindDialog; import com.fr.invoke.Reflect; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import org.easymock.EasyMock; @@ -16,13 +20,20 @@ import org.powermock.api.easymock.PowerMock; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import java.awt.Frame; + /** * @author: Maksim * @Date: Created in 2020/3/5 * @Description: */ @RunWith(PowerMockRunner.class) -@PrepareForTest({FunctionalHttpRequest.class,EnvChangeEntrance.class,CheckServiceDialog.class, DesignerEnvManager.class}) +@PrepareForTest({FunctionalHttpRequest.class, + EnvChangeEntrance.class, + CheckServiceDialog.class, + DesignerEnvManager.class, + PluginErrorRemindHandler.class, + WorkContext.class}) public class EnvChangeEntranceTest { @Test @@ -44,17 +55,15 @@ public class EnvChangeEntranceTest { EasyMock.expect(request.getServerBranch()).andReturn(remoteBranch); CheckServiceDialog dialog = EasyMock.mock(CheckServiceDialog.class); - PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject()).andReturn(dialog); + PowerMock.expectNew(CheckServiceDialog.class, EasyMock.anyObject(Frame.class), EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyString()).andReturn(dialog); - EasyMock.replay(request); - EasyMock.replay(selectedEnv); - EasyMock.replay(connectionInfo); + EasyMock.replay(request, selectedEnv, connectionInfo); PowerMock.replayAll(); entrance.showServiceDialog(selectedEnv); - Assert.assertTrue(true); + }catch (Exception e){ - Assert.assertTrue(false); + Assert.fail(); } } @@ -94,10 +103,38 @@ public class EnvChangeEntranceTest { DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path"); DesignerWorkspaceInfo info4 = null; - Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info1).get()); - Assert.assertTrue((boolean) Reflect.on(entrance).call("isNotRememberPwd", info2).get()); - Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info3).get()); - Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info4).get()); + Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info1).get()); + Assert.assertTrue(Reflect.on(entrance).call("isNotRememberPwd", info2).get()); + Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info3).get()); + Assert.assertFalse(Reflect.on(entrance).call("isNotRememberPwd", info4).get()); } + @Test + public void testPluginErrorRemind() { + + try { + + Workspace workspace = EasyMock.mock(Workspace.class); + EasyMock.expect(workspace.isLocal()).andReturn(false).once(); + EasyMock.expect(workspace.isLocal()).andReturn(true).once(); + PowerMock.mockStatic(WorkContext.class); + EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); + + PowerMock.mockStatic(PluginErrorRemindHandler.class); + EasyMock.expect(PluginErrorRemindHandler.pluginErrorContent()).andReturn("").once(); + + EasyMock.replay(workspace); + PowerMock.replayAll(); + + EnvChangeEntrance entrance = EnvChangeEntrance.getInstance(); + + entrance.pluginErrorRemind(); + entrance.pluginErrorRemind(); + + EasyMock.verify(workspace); + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + } } \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java new file mode 100644 index 0000000000..bc81cb2c36 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/extra/PluginOperateUtilsTest.java @@ -0,0 +1,155 @@ +package com.fr.design.extra; + +import com.fr.invoke.Reflect; +import com.fr.json.JSONObject; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.context.PluginMarker; +import com.fr.plugin.context.PluginMarkerAdapter; +import com.fr.plugin.error.PluginErrorCode; +import com.fr.plugin.manage.PluginManager; +import com.fr.plugin.manage.control.PluginTask; +import com.fr.plugin.manage.control.PluginTaskResult; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2020/12/17 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({PluginManager.class, PluginUtils.class}) +public class PluginOperateUtilsTest { + + @Test + public void testGetSuccessInfo() { + PluginTaskResult pluginTaskResult = EasyMock.mock(PluginTaskResult.class); + PluginTaskResult pluginTaskResult1 = EasyMock.mock(PluginTaskResult.class); + PluginTaskResult pluginTaskResult2 = EasyMock.mock(PluginTaskResult.class); + + List pluginTaskResults1 = new ArrayList<>(); + pluginTaskResults1.add(pluginTaskResult1); + List pluginTaskResults2 = new ArrayList<>(); + pluginTaskResults2.add(pluginTaskResult1); + pluginTaskResults2.add(pluginTaskResult2); + + PluginMarker pluginMarker1 = PluginMarker.create("plugin-1", "1.0"); + PluginMarker pluginMarker2 = PluginMarkerAdapter.create("plugin-2", "2.0", "name-2"); + PluginTask pluginTask1 = PluginTask.installTask(pluginMarker1); + PluginTask pluginTask2 = PluginTask.installTask(pluginMarker2); + + EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults1).times(2); + EasyMock.expect(pluginTaskResult.asList()).andReturn(pluginTaskResults2).times(2); + EasyMock.expect(pluginTaskResult1.getCurrentTask()).andReturn(pluginTask1).anyTimes(); + EasyMock.expect(pluginTaskResult2.getCurrentTask()).andReturn(pluginTask2).anyTimes(); + + EasyMock.expect(pluginTaskResult1.errorCode()).andReturn(PluginErrorCode.BelowSystem).anyTimes(); + EasyMock.expect(pluginTaskResult2.errorCode()).andReturn(PluginErrorCode.BeyondSystem).anyTimes(); + + PluginContext plugin1 = EasyMock.mock(PluginContext.class); + PluginContext plugin2 = EasyMock.mock(PluginContext.class); + EasyMock.expect(plugin1.getName()).andReturn("context-1").anyTimes(); + EasyMock.expect(plugin2.getName()).andReturn("context-2").anyTimes(); + PowerMock.mockStatic(PluginManager.class); + EasyMock.expect(PluginManager.getContext(pluginMarker1.getPluginID())) + .andReturn(plugin1).once().andReturn(null).once().andReturn(plugin1).once().andReturn(null).once(); + EasyMock.expect(PluginManager.getContext(pluginMarker2.getPluginID())) + .andReturn(plugin2).once().andReturn(null).once(); + + EasyMock.replay(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); + PowerMock.replayAll(); + + // 1个 + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem"); + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem"); + + + // 2个 + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "context-1Fine-Core_Plugin_Error_BelowSystem\ncontext-2Fine-Core_Plugin_Error_BeyondSystem"); + Assert.assertEquals(PluginOperateUtils.getSuccessInfo(pluginTaskResult), "plugin-1Fine-Core_Plugin_Error_BelowSystem\nname-2Fine-Core_Plugin_Error_BeyondSystem"); + + EasyMock.verify(pluginTaskResult, pluginTaskResult1, pluginTaskResult2, plugin1, plugin2); + PowerMock.verifyAll(); + + } + + + @Test + public void testGetPluginName() { + PluginContext pluginContext = EasyMock.mock(PluginContext.class); + EasyMock.expect(pluginContext.getName()).andReturn("pluginContext").once(); + + PluginMarker pluginMarker1 = PluginMarker.create("id-1", "1"); + PluginMarker pluginMarker2 = PluginMarkerAdapter.create("id-2", "2", "name-2"); + + EasyMock.replay(pluginContext); + + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, null).get(), ""); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", pluginContext, pluginMarker1).get(), "pluginContext"); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker1).get(), "id-1"); + Assert.assertEquals(Reflect.on(PluginOperateUtils.class).call("getPluginName", null, pluginMarker2).get(), "name-2"); + + EasyMock.verify(pluginContext); + } + + @Test + public void testUpdateMarker2Online() { + + try { + PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); + String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; + JSONObject object = new JSONObject(pluginJson); + + PowerMock.mockStatic(PluginUtils.class); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andThrow(new NullPointerException()).once(); + + PowerMock.replayAll(); + + PluginMarker marker1 = PluginOperateUtils.updateMarker2Online(pluginMarker); + PluginMarker marker2 = PluginOperateUtils.updateMarker2Online(pluginMarker); + + Assert.assertTrue(marker1 instanceof PluginMarkerAdapter); + Assert.assertEquals(marker1.getPluginID(), "plugin-1"); + Assert.assertEquals(marker1.getVersion(), "1.0"); + Assert.assertEquals(((PluginMarkerAdapter) marker1).getPluginName(), "图表(新特性)"); + Assert.assertEquals(marker2, pluginMarker); + + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + + } + + + @Test + public void testUpdatePluginOnline() { + try { + PluginMarker pluginMarker = PluginMarker.create("plugin-1", "1.0"); + String pluginJson = "{\"id\": plugin-1,\"name\": \"图表(新特性)\",\"version\": \"8.6.16\"}"; + JSONObject object = new JSONObject(pluginJson); + + PowerMock.mockStatic(PluginUtils.class); + EasyMock.expect(PluginUtils.getLatestPluginInfo("plugin-1")).andReturn(object).once(); + EasyMock.expect(PluginUtils.getInstalledPluginMarkerByID("plugin-1")).andReturn(pluginMarker).once(); + + PowerMock.replayAll(); + + PluginOperateUtils.updatePluginOnline(pluginMarker, null); + + PowerMock.verifyAll(); + } catch (Exception e) { + Assert.fail(); + } + } + +} diff --git a/designer-base/src/test/java/com/fr/design/extra/PluginUtilsTest.java b/designer-base/src/test/java/com/fr/design/extra/PluginUtilsTest.java new file mode 100644 index 0000000000..bbb809ebfe --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/extra/PluginUtilsTest.java @@ -0,0 +1,23 @@ +package com.fr.design.extra; + +import com.fr.invoke.Reflect; +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2020/12/18 + */ +public class PluginUtilsTest { + + @Test + public void testIsCompatibleCurrentEnv() { + Assert.assertFalse(Reflect.on(PluginUtils.class).call("isCompatibleCurrentEnv", "~9.0").get()); + Assert.assertTrue(Reflect.on(PluginUtils.class).call("isCompatibleCurrentEnv", "9.0").get()); + Assert.assertTrue(Reflect.on(PluginUtils.class).call("isCompatibleCurrentEnv", "9~").get()); + Assert.assertTrue(Reflect.on(PluginUtils.class).call("isCompatibleCurrentEnv", "10").get()); + Assert.assertFalse(Reflect.on(PluginUtils.class).call("isCompatibleCurrentEnv", "11").get()); + } + +} diff --git a/designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java b/designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java new file mode 100644 index 0000000000..31119d049c --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/upm/UpmUtilsTest.java @@ -0,0 +1,57 @@ +package com.fr.design.upm; + +import com.fr.config.ServerPreferenceConfig; +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.Locale; +import java.util.Map; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/1/5 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({ServerPreferenceConfig.class, CloudCenter.class}) +@SuppressStaticInitializationFor("com.fr.general.CloudCenter") +public class UpmUtilsTest { + + @Test + public void testRenderMap() { + + ServerPreferenceConfig serverPreferenceConfig = EasyMock.mock(ServerPreferenceConfig.class); + EasyMock.expect(serverPreferenceConfig.getOptimizedUPMVersion()).andReturn("1.0").anyTimes(); + PowerMock.mockStatic(ServerPreferenceConfig.class); + EasyMock.expect(ServerPreferenceConfig.getInstance()).andReturn(serverPreferenceConfig).anyTimes(); + + CloudCenter cloudCenter = EasyMock.mock(CloudCenter.class); + EasyMock.expect(cloudCenter.acquireUrlByKind("upm.script.version")).andReturn("2.0").anyTimes(); + PowerMock.mockStatic(CloudCenter.class); + EasyMock.expect(CloudCenter.getInstance()).andReturn(cloudCenter).anyTimes(); + + EasyMock.replay(serverPreferenceConfig, cloudCenter); + PowerMock.replayAll(); + + GeneralContext.setLocale(Locale.CHINA); + + Map map4Tpl = UpmUtils.renderMap(); + Assert.assertEquals(map4Tpl.size(), 3); + Assert.assertEquals(map4Tpl.get("version"), "1.0"); + Assert.assertEquals(map4Tpl.get("new_version"), "2.0"); + Assert.assertEquals(map4Tpl.get("language"), "zh_CN"); + + + EasyMock.verify(serverPreferenceConfig, cloudCenter); + PowerMock.verifyAll(); + + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java b/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java index b5b0576913..41e1753f7b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartSwingUtils.java @@ -31,7 +31,7 @@ public class ChartSwingUtils { }); textField.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { - if(box.isSelected()) { + if(box.isSelected() && !e.isControlDown()) { e.consume(); showFormulaPane(textField, null); } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java index 1102f7a64e..8c62d6e725 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/data/drillMap/DrillMapLayerPane.java @@ -14,7 +14,7 @@ import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; -import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; +import com.fr.van.chart.map.designer.type.MapStatusPane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -154,7 +154,7 @@ public class DrillMapLayerPane extends BasicBeanPane { rowSize[i + 1] = p; int d = i + 1; UILabel label = new UILabel(String.format("%s%d%s", Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); - UIComboBox level = new UIComboBox(VanChartMapSourceChoosePane.ZOOM_LEVELS); + UIComboBox level = new UIComboBox(MapStatusPane.ZOOM_LEVELS); level.setEnabled(i != 0); UIComboBox type = new UIComboBox(items); detailComps[i + 1] = new Component[]{label, level, type}; diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index 5d7a9e67d7..61b9a8c4f5 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -1,6 +1,7 @@ package com.fr.design.module; import com.fr.base.ChartPreStyleConfig; +import com.fr.base.svg.IconUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; @@ -8,7 +9,6 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.general.IOUtils; import com.fr.module.ModuleContext; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; @@ -33,7 +33,7 @@ public class ChartPreStyleAction extends UpdateAction { this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/chart/ChartType.png")); + this.setSmallIcon("com/fr/design/images/chart/ChartType"); this.generateAndSetSearchText(ChartPreStyleManagerPane.class.getName()); } @@ -101,4 +101,4 @@ public class ChartPreStyleAction extends UpdateAction { return null; } }; -} \ No newline at end of file +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java index ec15e4cf98..47e6488fd6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.plugin.chart.custom.VanChartCustomPlot; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -19,6 +20,12 @@ public class VanChartCustomDataPane extends ChartDataPane { super(listener); } + protected void initContentPane() { + leftContentPane = createContentPane(); + leftContentPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, original)); + this.add(leftContentPane, BorderLayout.CENTER); + } + @Override protected JPanel createContentPane() { JPanel content = new JPanel(new BorderLayout()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java index 6d7d24bf96..30d23c1873 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java @@ -12,11 +12,13 @@ import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.van.chart.custom.component.VanChartCustomPlotTabPane; import com.fr.van.chart.custom.component.VanChartDataPane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.awt.BorderLayout; /** * Created by Fangjie on 2016/4/29. @@ -37,6 +39,20 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab this.supportCellData = supportCellData; } + @Override + protected void initLayout() { + JPanel tabPanel = new JPanel(new BorderLayout()); + if (NameArray.length > 1) { + tabPanel.setBorder(BorderFactory.createMatteBorder(10, 0, 0, 0, getBackground())); + } else { + tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); + } + tabPanel.add(tabPane, BorderLayout.CENTER); + this.setLayout(new BorderLayout(0, 0)); + this.add(tabPanel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + } + @Override protected void initTabTitle() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index 46126d277a..0f9db09fab 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -35,6 +35,7 @@ import com.fr.van.chart.designer.style.VanChartRangeLegendPane; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanLegendPaneWidthOutHighlight; import com.fr.van.chart.designer.style.label.VanChartGaugePlotLabelPane; +import com.fr.van.chart.designer.style.label.VanChartPiePlotLabelPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; @@ -165,6 +166,12 @@ public class PlotFactory { tooltipContentMap.put(VanChartStructurePlot.class, VanChartStructureTooltipContentPane.class); } + private static Map, Class> labelMap = new HashMap<>(); + + static { + labelMap.put(PiePlot4VanChart.class, VanChartPiePlotLabelPane.class); + labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); + } /** * 监控刷新 自动数据点提示Map @@ -207,8 +214,15 @@ public class PlotFactory { } public static VanChartPlotLabelPane createPlotLabelPane(Plot plot, VanChartStylePane stylePane, boolean inCondition) { - if (plot instanceof VanChartGaugePlot) { - return new VanChartGaugePlotLabelPane(plot, stylePane); + Class key = plot.getClass(); + if (labelMap.containsKey(key)) { + try { + Class cl = labelMap.get(key); + Constructor constructor = cl.getConstructor(Plot.class, VanChartStylePane.class, boolean.class); + return constructor.newInstance(plot, stylePane, inCondition); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } } return new VanChartPlotLabelPane(plot, stylePane, inCondition); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java index f764c9baab..f40a51f123 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java @@ -46,6 +46,10 @@ public class VanChartBorderWithShapePane extends BasicPane { createBorderPane(); } + public LineComboBox getLineTypeBox() { + return lineTypeBox; + } + private void initComponents() { lineTypeBox = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); lineColorButton = new UIButtonGroup<>(new String[]{ @@ -106,7 +110,7 @@ public class VanChartBorderWithShapePane extends BasicPane { borderRadius.setEnabled(borderShape.getSelectedIndex() == RECTANGULAR_INDEX || borderShape.getSelectedIndex() == DIALOG_INDEX); } - private JPanel createLineTypePane() { + protected JPanel createLineTypePane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithCheckBox.java new file mode 100644 index 0000000000..8d088827f0 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.van.chart.designer.component.format; + +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-10 + */ +public class SummaryValueFormatPaneWithCheckBox extends VanChartFormatPaneWithCheckBox { + + public SummaryValueFormatPaneWithCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + @Override + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value"); + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithoutCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithoutCheckBox.java new file mode 100644 index 0000000000..400af6b7f8 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/SummaryValueFormatPaneWithoutCheckBox.java @@ -0,0 +1,23 @@ +package com.fr.van.chart.designer.component.format; + +import com.fr.design.i18n.Toolkit; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-10 + */ +public class SummaryValueFormatPaneWithoutCheckBox extends VanChartFormatPaneWithoutCheckBox { + + public SummaryValueFormatPaneWithoutCheckBox(VanChartStylePane parent, JPanel showOnPane) { + super(parent, showOnPane); + } + + protected String getCheckBoxText() { + return Toolkit.i18nText("Fine-Design_Chart_Use_Summary_Value"); + } +} + diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java index 9bc21a0446..5861bb0c22 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java @@ -25,8 +25,8 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { private VanChartPlotLabelDetailPane gaugeValueLabelPane; - public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) { - super(plot, parent); + public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); } protected void createLabelPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java new file mode 100644 index 0000000000..4c28c78b08 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieCategoryLabelDetailPane.java @@ -0,0 +1,64 @@ +package com.fr.van.chart.designer.style.label; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.stable.Constants; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.pie.style.VanChartPieCategoryLabelContentPane; + +import javax.swing.JPanel; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-09 + */ +public class VanChartPieCategoryLabelDetailPane extends VanChartPlotLabelDetailPane { + + public VanChartPieCategoryLabelDetailPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); + } + + protected void initToolTipContentPane(Plot plot) { + setDataLabelContentPane(new VanChartPieCategoryLabelContentPane(getParentPane(), this, isInCondition())); + } + + protected JPanel createLabelPositionPane(String title, Plot plot) { + String[] positionName = new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom"), + Toolkit.i18nText("Fine-Design_Form_Center"), + Toolkit.i18nText("Fine-Design_Chart_Axis_Top") + }; + + Integer[] positionValue = new Integer[]{Constants.BOTTOM, Constants.CENTER, Constants.TOP}; + + UIButtonGroup position = new UIButtonGroup<>(positionName, positionValue); + setPosition(position); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = {p, p}; + double[] col = {f, e}; + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), position}, + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + } + + protected void checkPositionPane(String title) { + + } + + protected JPanel createBorderAndBackgroundPane() { + return null; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java new file mode 100644 index 0000000000..ac24b99510 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPiePlotLabelPane.java @@ -0,0 +1,61 @@ +package com.fr.van.chart.designer.style.label; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrLabelDetail; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-09 + */ +public class VanChartPiePlotLabelPane extends VanChartPlotLabelPane { + + private VanChartPlotLabelDetailPane pieCategoryLabelPane; + + public VanChartPiePlotLabelPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); + } + + protected void createLabelPane() { + setLabelPane(new JPanel(new BorderLayout(0, 4))); + setLabelDetailPane(new VanChartPieValueLabelDetailPane(getPlot(), getParentPane(), isInCondition())); + JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Value_Label"), getLabelDetailPane()); + getLabelPane().add(valuePane, BorderLayout.NORTH); + + if (!isInCondition()) { + pieCategoryLabelPane = new VanChartPieCategoryLabelDetailPane(getPlot(), getParentPane(), isInCondition()); + JPanel categoryPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category_Label"), pieCategoryLabelPane); + getLabelPane().add(categoryPane, BorderLayout.CENTER); + } + } + + public void populate(AttrLabel attrLabel) { + if (attrLabel == null) { + attrLabel = ((VanChartPlot) this.getPlot()).getDefaultAttrLabel(); + } + super.populate(attrLabel); + if (pieCategoryLabelPane != null) { + AttrLabelDetail labelDetail = attrLabel.getSecondLabelDetail(); + pieCategoryLabelPane.populate(labelDetail); + } + } + + public AttrLabel update() { + AttrLabel attrLabel = super.update(); + if (pieCategoryLabelPane != null) { + AttrLabelDetail labelDetail = attrLabel.getSecondLabelDetail(); + pieCategoryLabelPane.update(labelDetail); + } else { + attrLabel.setSecondLabelDetail(null); + } + return attrLabel; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java new file mode 100644 index 0000000000..43f6da1e94 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java @@ -0,0 +1,93 @@ +package com.fr.van.chart.designer.style.label; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; +import com.fr.van.chart.designer.component.border.VanChartBorderWithShapePane; +import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.pie.style.VanChartPieValueLabelContentPane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-09 + */ +public class VanChartPieValueLabelDetailPane extends VanChartPlotLabelDetailPane { + + public VanChartPieValueLabelDetailPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); + } + + protected void initToolTipContentPane(Plot plot) { + setDataLabelContentPane(new VanChartPieValueLabelContentPane(getParentPane(), this, isInCondition())); + } + + protected JPanel getLabelLayoutPane(JPanel panel, String title) { + return panel; + } + + protected JPanel createBorderAndBackgroundPane() { + JPanel jPanel = new JPanel(); + jPanel.setLayout(new BorderLayout(0, 10)); + jPanel.add(createLabelBorderPane(), BorderLayout.NORTH); + jPanel.add(createLabelBackgroundPane(), BorderLayout.CENTER); + return jPanel; + } + + protected JPanel createLabelBorderPane() { + VanChartBorderWithShapePane borderPane = new VanChartBorderWithShapePane() { + @Override + protected JPanel createLineTypePane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + + double[] columnSize = {f, e}; + double[] rowSize = {p}; + + Component[][] components = new Component[][]{ + new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Border")), + UIComponentUtils.wrapWithBorderLayoutPane(getLineTypeBox())}}; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + } + }; + setBorderPane(borderPane); + return borderPane; + } + + protected JPanel createLabelBackgroundPane() { + VanChartBackgroundWithOutImagePane backgroundPane = new VanChartBackgroundWithOutImagePane() { + + @Override + protected JPanel initContentPanel() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p}; + return TableLayout4VanChartHelper.createGapTableLayoutPane(getPaneComponents(), rowSize, columnSize); + } + + @Override + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Utils_Background")), typeComboBox}, + new Component[]{null, centerPane}, + new Component[]{getTransparentLabel(), transparent}, + }; + } + }; + setBackgroundPane(backgroundPane); + return backgroundPane; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 5466489634..0467fe3f5e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -23,6 +23,7 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutI import com.fr.van.chart.designer.component.border.VanChartBorderWithShapePane; import com.fr.van.chart.designer.style.VanChartStylePane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; @@ -83,6 +84,19 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return parent; } + public void setPosition(UIButtonGroup position) { + this.position = position; + } + + public void setBorderPane(VanChartBorderWithShapePane borderPane) { + this.borderPane = borderPane; + } + + public void setBackgroundPane(VanChartBackgroundWithOutImagePane backgroundPane) { + this.backgroundPane = backgroundPane; + } + + protected void initLabelDetailPane(Plot plot) { this.setLayout(new BorderLayout()); initToolTipContentPane(plot); @@ -137,7 +151,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { }; } - private JPanel createBorderAndBackgroundPane() { + protected JPanel createBorderAndBackgroundPane() { JPanel jPanel = new JPanel(); jPanel.setLayout(new BorderLayout(0, 5)); jPanel.add(createLabelBorderPane(), BorderLayout.NORTH); @@ -145,14 +159,14 @@ public class VanChartPlotLabelDetailPane extends BasicPane { return jPanel; } - private JPanel createLabelBorderPane() { + protected JPanel createLabelBorderPane() { borderPane = new VanChartBorderWithShapePane(); borderPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane); return borderPaneWithTitle; } - private JPanel createLabelBackgroundPane() { + protected JPanel createLabelBackgroundPane() { backgroundPane = new VanChartBackgroundWithOutImagePane() { protected Component[][] getPaneComponents() { @@ -229,6 +243,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if (plot.isSupportLeadLine()) { tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("", tractionLine); + tractionLinePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); panel.add(tractionLinePane, BorderLayout.SOUTH); initPositionListener(); } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { @@ -337,7 +352,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } private void checkPosition() { - tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE); + tractionLine.setSelected(position.getSelectedItem() != null && position.getSelectedItem() == Constants.OUTSIDE); checkPositionEnabled(); } @@ -351,7 +366,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } private void checkPositionEnabled() { - tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); + tractionLinePane.setVisible(position.getSelectedItem() != null && position.getSelectedItem() == Constants.OUTSIDE); } protected void checkPane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java index 71ad599fda..4aed8c30a9 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java @@ -44,6 +44,10 @@ public class VanChartPlotLabelPane extends BasicPane { addComponents(); } + public boolean isInCondition() { + return inCondition; + } + public VanChartPlotLabelDetailPane getLabelDetailPane() { return labelDetailPane; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java index 0c6fcc1e4c..7497559916 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java @@ -14,7 +14,7 @@ import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; +import com.fr.van.chart.map.designer.type.MapStatusPane; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -105,7 +105,7 @@ public class DrillMapLayerPane extends BasicScrollPane { rowSize[i + 1] = p; int d = i + 1; UILabel label = new UILabel(String.format("%s%d%s", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); - UIComboBox level = new UIComboBox(VanChartMapSourceChoosePane.ZOOM_LEVELS); + UIComboBox level = new UIComboBox(MapStatusPane.ZOOM_LEVELS); level.setEnabled(i != 0); UIComboBox type = new UIComboBox(TEMP.get(oldMapType)); detailComps[i + 1] = new Component[]{label, level, type}; diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java index c4a803134b..48f8b2434c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/type/VanChartDrillMapPlotPane.java @@ -8,11 +8,14 @@ import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.drillmap.DrillMapIndependentVanChart; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.van.chart.map.designer.type.GeoUrlPane; import com.fr.van.chart.map.designer.type.VanChartMapPlotPane; import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; +import javax.swing.tree.TreeNode; import java.util.ArrayList; /** @@ -30,10 +33,15 @@ public class VanChartDrillMapPlotPane extends VanChartMapPlotPane { @Override protected VanChartMapSourceChoosePane createSourceChoosePane() { - return new VanChartMapSourceChoosePane(){ + return new VanChartMapSourceChoosePane() { @Override - protected boolean supportParam(){ - return false; + protected void initGeoUrlPane() { + setGeoUrlPane(new GeoUrlPane() { + @Override + protected TreeNode getRootNode() { + return GEOJSONTreeHelper.getInstance().getRootNodeWithoutPara(); + } + }); } }; } @@ -59,7 +67,7 @@ public class VanChartDrillMapPlotPane extends VanChartMapPlotPane { protected void resetAttr(Plot plot) { super.resetAttr(plot); - if(plot instanceof VanChartDrillMapPlot) { + if (plot instanceof VanChartDrillMapPlot) { resetLayerTypeAndZoomLevel((VanChartDrillMapPlot) plot); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java deleted file mode 100644 index 3eaec5f59d..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapSourceChoosePane.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.fr.van.chart.heatmap.designer.type; - -import com.fr.design.gui.ilable.UILabel; - -import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; - -/** - * Created by Mitisky on 16/10/20. - */ -public class VanChartHeatMapSourceChoosePane extends VanChartMapSourceChoosePane { - @Override - protected UILabel createSourceTitleLabel() { - return new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); - } -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java index 8f4a72de2a..32529591eb 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/type/VanChartHeatMapTypePane.java @@ -3,6 +3,8 @@ package com.fr.van.chart.heatmap.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chartx.data.ChartDataDefinitionProvider; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -11,6 +13,7 @@ import com.fr.plugin.chart.heatmap.HeatMapIndependentVanChart; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.map.designer.type.GeoUrlPane; import com.fr.van.chart.map.designer.type.VanChartMapPlotPane; import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; @@ -27,18 +30,27 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane { @Override protected VanChartMapSourceChoosePane createSourceChoosePane() { - return new VanChartHeatMapSourceChoosePane(); + return new VanChartMapSourceChoosePane() { + @Override + protected void initGeoUrlPane() { + setGeoUrlPane(new GeoUrlPane() { + @Override + protected UILabel createSourceTitleLabel() { + return new UILabel(Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); + } + }); + } + }; } //适用一种图表只有一种类型的 public void populateBean(VanChart chart) { typeDemo.get(0).isPressing = true; - VanChartHeatMapPlot plot = (VanChartHeatMapPlot)chart.getPlot(); + VanChartHeatMapPlot plot = (VanChartHeatMapPlot) chart.getPlot(); populateSourcePane(plot); boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(plot.getGeoUrl()); GUICoreUtils.setEnabled(this.getTypePane(), enabled); - GUICoreUtils.setEnabled(this.getSourceChoosePane().getSourceComboBox(), enabled); checkDemosBackground(); } @@ -53,13 +65,13 @@ public class VanChartHeatMapTypePane extends VanChartMapPlotPane { return tools; } - protected Plot getSelectedClonedPlot(){ + protected Plot getSelectedClonedPlot() { Chart chart = getDefaultChart(); - VanChartHeatMapPlot newPlot = (VanChartHeatMapPlot)chart.getPlot(); + VanChartHeatMapPlot newPlot = (VanChartHeatMapPlot) chart.getPlot(); Plot cloned = null; try { - cloned = (Plot)newPlot.clone(); + cloned = (Plot) newPlot.clone(); } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index 00a847e2ec..8f5a3d1783 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java @@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.base.AttrBorderWithAlpha; import com.fr.plugin.chart.base.AttrEffect; @@ -30,6 +31,7 @@ import com.fr.plugin.chart.map.line.condition.AttrCurve; import com.fr.plugin.chart.map.line.condition.AttrLineEffect; import com.fr.plugin.chart.type.MapMarkerType; import com.fr.plugin.chart.type.MapType; +import com.fr.stable.StringUtils; import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane; @@ -37,6 +39,7 @@ import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartEffectPane; +import com.fr.van.chart.map.designer.style.series.VanChartMapAnchorMarkerPane; import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; import com.fr.van.chart.map.line.VanChartCurvePane; import com.fr.van.chart.map.line.VanChartLineMapEffectPane; @@ -61,16 +64,24 @@ import java.awt.event.ItemListener; * 地图-系列界面 */ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { - private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region"); - private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point"); - private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow"); + private static final String AREA_STRING = Toolkit.i18nText("Fine-Design_Chart_Region"); + private static final String POINT_STRING = Toolkit.i18nText("Fine-Design_Chart_Point"); + private static final String LINE_STRING = Toolkit.i18nText("Fine-Design_Chart_Flow"); - private static final String[] MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), + private static final String[] MARKER_TYPES = new String[]{MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()}; - private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), + private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString()}; + private static final String[] COMPATIBLE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), + MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(), + MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()}; + + private static final String[] COMPATIBLE_LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), + MapMarkerType.ANCHOR.toLocalString(), MapMarkerType.COMMON.toLocalString(), + MapMarkerType.BUBBLE.toLocalString()}; + //custom private UIButtonGroup areaPointAndLineGroup; @@ -85,9 +96,15 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { //point private UIComboBox markerTypeCom; + + private VanChartMapAnchorMarkerPane anchorMarkerPane; private VanChartMapScatterMarkerPane commonMarkerPane; private VanChartBubblePane bubblePane; private VanChartImageMarkerPane imageMarkerPane; + + private CardLayout markerTypeLayout; + private JPanel markerContentPane; + private UINumberDragPane pointAlphaPane; private VanChartEffectPane pointEffectPane; @@ -147,7 +164,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { checkLineMapLarge(); } }); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Large_Model"), lineMapLargeDataModelGroup); return createLargeDataModelPane(panel); } @@ -158,18 +175,26 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } private void checkPointCompsEnabledWithLarge(Plot plot) { + checkPointEffectPane(plot); + + if (markerTypeCom == null) { + return; + } + + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; boolean largeModel = largeModel(plot); - if (pointEffectPane != null) { - GUICoreUtils.setEnabled(pointEffectPane, !largeModel); + refreshMarkerComboboxModel(mapPlot); + if (largeModel) { + checkLargeModelPlotSelectedItem(mapPlot); } - if (markerTypeCom != null) { - Object selectedItem = markerTypeCom.getSelectedItem(); - markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES)); - if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) { - markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); - } else { - markerTypeCom.setSelectedItem(selectedItem); - } + } + + private void checkPointEffectPane(Plot plot) { + if (pointEffectPane != null) { + boolean largeModel = largeModel(plot); + boolean imageMark = markerTypeCom == null ? false : + StringUtils.equals(MapMarkerType.IMAGE.toLocalString(), GeneralUtils.objectToString(markerTypeCom.getSelectedItem())); + GUICoreUtils.setEnabled(pointEffectPane, !largeModel && !imageMark); } } @@ -182,6 +207,56 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } } + private void checkLargeModelPlotSelectedItem(VanChartMapPlot plot) { + String selected = plot.getMapMarkerType().toLocalString(); + + if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selected)) { + markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString()); + } else { + markerTypeCom.setSelectedItem(selected); + } + } + + private boolean shouldRefreshComboboxModel(VanChartMapPlot plot) { + if (markerTypeCom == null) { + return false; + } + + MapMarkerType selectedType = plot.getMapMarkerType(); + DefaultComboBoxModel model = (DefaultComboBoxModel) markerTypeCom.getModel(); + + if (selectedType == MapMarkerType.DEFAULT) { + return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) < 0; + } + + return model.getIndexOf(MapMarkerType.DEFAULT.toLocalString()) > -1; + } + + private void refreshMarkerComboboxModel(VanChartMapPlot plot) { + if (largeModel(plot)) { + + if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) { + markerTypeCom.setModel(new DefaultComboBoxModel<>(COMPATIBLE_LARGE_MARKER_TYPES)); + } else { + markerTypeCom.setModel(new DefaultComboBoxModel<>(LARGE_MARKER_TYPES)); + } + } else { + + if (plot.getMapMarkerType() == MapMarkerType.DEFAULT) { + markerTypeCom.setModel(new DefaultComboBoxModel<>(COMPATIBLE_MARKER_TYPES)); + } else { + markerTypeCom.setModel(new DefaultComboBoxModel<>(MARKER_TYPES)); + } + } + + String selected = plot.getMapMarkerType().toLocalString(); + + markerTypeCom.setSelectedItem(selected); + if (markerTypeLayout != null && markerContentPane != null) { + markerTypeLayout.show(markerContentPane, selected); + } + } + @Override protected JPanel getContentPane(boolean custom) { JPanel panel = new JPanel(new BorderLayout()); @@ -272,7 +347,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { Component[][] components = new Component[][]{ new Component[]{getColorPane(MapType.AREA)}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderWithAlphaPane)}, }; return TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -357,28 +432,29 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { private Component createCurvePane() { curvePane = new VanChartCurvePane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Curve"), curvePane); } private Component createAnimationPane() { lineMapEffectPane = new VanChartLineMapEffectPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), lineMapEffectPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Animation"), lineMapEffectPane); } //不透明度 private JPanel createPointAlphaPane() { pointAlphaPane = new UINumberDragPane(0, 100); - return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); + return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Report_Alpha"), pointAlphaPane); } private JPanel createPointEffectPane() { pointEffectPane = new VanChartEffectPane(); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Animation"), pointEffectPane); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Animation"), pointEffectPane); } private JPanel createMarkerComPane() { - markerTypeCom = new UIComboBox(MARKER_TYPES); + markerTypeCom = new UIComboBox(COMPATIBLE_MARKER_TYPES); + anchorMarkerPane = new VanChartMapAnchorMarkerPane(); commonMarkerPane = new VanChartMapScatterMarkerPane(); commonMarkerPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); bubblePane = new VanChartBubblePane() { @@ -396,31 +472,35 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { }; imageMarkerPane = new VanChartImageMarkerPane(); - final JPanel[] panes = new JPanel[]{new JPanel(), commonMarkerPane, bubblePane, imageMarkerPane}; - final CardLayout cardLayout = new CardLayout(); - final JPanel cardPane = new JPanel(cardLayout) { + final JPanel[] panes = new JPanel[]{new JPanel(), anchorMarkerPane, commonMarkerPane, bubblePane, imageMarkerPane}; + + markerTypeLayout = new CardLayout(); + markerContentPane = new JPanel(markerTypeLayout) { @Override public Dimension getPreferredSize() { - return panes[markerTypeCom.getSelectedIndex()].getPreferredSize(); + int index = MapMarkerType.parse((String) markerTypeCom.getSelectedItem()).ordinal(); + + return panes[index].getPreferredSize(); } }; - for (int i = 0, len = MARKER_TYPES.length; i < len; i++) { - cardPane.add(panes[i], MARKER_TYPES[i]); + for (int i = 0, len = COMPATIBLE_MARKER_TYPES.length; i < len; i++) { + markerContentPane.add(panes[i], COMPATIBLE_MARKER_TYPES[i]); } markerTypeCom.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - cardLayout.show(cardPane, MARKER_TYPES[markerTypeCom.getSelectedIndex()]); + markerTypeLayout.show(markerContentPane, (String) markerTypeCom.getSelectedItem()); + checkPointEffectPane(plot); } }); - JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point_Style"), markerTypeCom); + JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Point_Style"), markerTypeCom); JPanel markerPane = new JPanel(new BorderLayout(0, 6)); markerPane.add(northPane, BorderLayout.NORTH); - markerPane.add(cardPane, BorderLayout.CENTER); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); + markerPane.add(markerContentPane, BorderLayout.CENTER); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Marker"), markerPane); } private JPanel createCustomPane(Plot plot) { @@ -500,9 +580,16 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } public void populateBean(Plot plot) { - if (plot != null && plot instanceof VanChartMapPlot) { + if (plot instanceof VanChartMapPlot) { + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + if (markerTypeCom != null) { - markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString()); + + if (shouldRefreshComboboxModel(mapPlot)) { + refreshMarkerComboboxModel(mapPlot); + } + + markerTypeCom.setSelectedItem(mapPlot.getMapMarkerType().toLocalString()); } if (nullValueColorBox != null) { //TODO Bjorn 地图空值背景自动 @@ -513,29 +600,35 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); checkNullValueButton();*/ - nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); + nullValueColorBox.setSelectObject(mapPlot.getNullValueColor()); } //大数据模式 恢复用注释。下面3行删除。 if (lineMapLargeDataModelGroup != null) { - lineMapLargeDataModelGroup.setSelectedItem(((VanChartMapPlot) plot).getLineMapDataProcessor()); + lineMapLargeDataModelGroup.setSelectedItem(mapPlot.getLineMapDataProcessor()); } } super.populateBean(plot); } public void updateBean(Plot plot) { - if (plot != null && plot instanceof VanChartMapPlot) { + if (plot instanceof VanChartMapPlot) { + VanChartMapPlot mapPlot = (VanChartMapPlot) plot; + if (markerTypeCom != null) { - ((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex())); + mapPlot.setMapMarkerType(MapMarkerType.parse((String) markerTypeCom.getSelectedItem())); + + if (shouldRefreshComboboxModel(mapPlot)) { + refreshMarkerComboboxModel(mapPlot); + } } if (nullValueColorBox != null) { //TODO Bjorn 地图空值背景自动 //((VanChartMapPlot) plot).setAutoNullValue(nullValueAuto.getSelectedIndex() == 0); - ((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject()); + mapPlot.setNullValueColor(nullValueColorBox.getSelectObject()); } //大数据模式 恢复用注释。下面3行删除。 if (lineMapLargeDataModelGroup != null) { - ((VanChartMapPlot) plot).setLineMapDataProcessor(lineMapLargeDataModelGroup.getSelectedItem()); + mapPlot.setLineMapDataProcessor(lineMapLargeDataModelGroup.getSelectedItem()); } } super.updateBean(plot); @@ -587,6 +680,10 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } VanChartAttrMarker attrMarker = defaultAttr.getExisted(VanChartAttrMarker.class); + + if (anchorMarkerPane != null) { + anchorMarkerPane.populateBean(attrMarker); + } if (commonMarkerPane != null) { commonMarkerPane.populateBean(attrMarker); } @@ -669,11 +766,16 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { VanChartAttrBubble attrBubble = defaultAttr.getExisted(VanChartAttrBubble.class); defaultAttr.remove(attrBubble); if (markerTypeCom != null) { - if (markerTypeCom.getSelectedIndex() == 1) { + String selected = (String) markerTypeCom.getSelectedItem(); + MapMarkerType markerType = MapMarkerType.parse(selected); + + if (markerType == MapMarkerType.ANCHOR) { + defaultAttr.addDataSeriesCondition(anchorMarkerPane.updateBean()); + } else if (markerType == MapMarkerType.COMMON) { defaultAttr.addDataSeriesCondition(commonMarkerPane.updateBean()); - } else if (markerTypeCom.getSelectedIndex() == 2) { + } else if (markerType == MapMarkerType.BUBBLE) { defaultAttr.addDataSeriesCondition(bubblePane.updateBean()); - } else if (markerTypeCom.getSelectedIndex() == 3) { + } else if (markerType == MapMarkerType.IMAGE) { defaultAttr.addDataSeriesCondition(imageMarkerPane.updateBean()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapConditionAttrContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapConditionAttrContentPane.java index a29a6dd03f..b659aee193 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapConditionAttrContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapConditionAttrContentPane.java @@ -9,6 +9,7 @@ import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.designer.other.VanChartConditionAttrContentPane; import com.fr.van.chart.map.designer.VanMapAreaAndPointGroupPane; import com.fr.van.chart.map.designer.VanMapAreaPointAndLineGroupPane; +import com.fr.van.chart.map.designer.other.condition.pane.VanChartAnchorPointMapConditionPane; import com.fr.van.chart.map.designer.other.condition.pane.VanChartBubblePointMapConditionPane; import com.fr.van.chart.map.designer.other.condition.pane.VanChartCommonPointMapConditionPane; import com.fr.van.chart.map.designer.other.condition.pane.VanChartDefaultPointMapConditionPane; @@ -99,6 +100,8 @@ public class VanChartMapConditionAttrContentPane extends VanChartConditionAttrCo private Class getPointMapConditionClassPane(VanChartMapPlot plot) { MapMarkerType mapMarkerType = plot.getMapMarkerType(); switch (mapMarkerType){ + case ANCHOR: + return VanChartAnchorPointMapConditionPane.class; case COMMON: return VanChartCommonPointMapConditionPane.class; case BUBBLE: diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartAnchorMarkerConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartAnchorMarkerConditionPane.java new file mode 100644 index 0000000000..fd8dc9669d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/item/VanChartAnchorMarkerConditionPane.java @@ -0,0 +1,42 @@ +package com.fr.van.chart.map.designer.other.condition.item; + +import com.fr.chart.base.DataSeriesCondition; +import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.i18n.Toolkit; +import com.fr.plugin.chart.base.VanChartAttrMarker; +import com.fr.van.chart.designer.other.condition.item.AbstractNormalMultiLineConditionPane; +import com.fr.van.chart.map.designer.style.series.VanChartMapAnchorMarkerPane; + +import javax.swing.JPanel; + +public class VanChartAnchorMarkerConditionPane extends AbstractNormalMultiLineConditionPane { + private VanChartMapAnchorMarkerPane anchorMarkerPane; + + public VanChartAnchorMarkerConditionPane(ConditionAttributesPane conditionAttributesPane) { + super(conditionAttributesPane); + } + + protected String getItemLabelString() { + return Toolkit.i18nText("Fine-Design_Chart_Marker"); + } + + protected JPanel initContentPane() { + anchorMarkerPane = new VanChartMapAnchorMarkerPane(); + return anchorMarkerPane; + } + + public String nameForPopupMenuItem() { + return Toolkit.i18nText("Fine-Design_Chart_Marker"); + } + + public void populate(DataSeriesCondition condition) { + if (condition instanceof VanChartAttrMarker) { + anchorMarkerPane.populateBean((VanChartAttrMarker) condition); + } + } + + public DataSeriesCondition update() { + return anchorMarkerPane.updateBean(); + } +} + diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartAnchorPointMapConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartAnchorPointMapConditionPane.java new file mode 100644 index 0000000000..aba352a2dc --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartAnchorPointMapConditionPane.java @@ -0,0 +1,26 @@ +package com.fr.van.chart.map.designer.other.condition.pane; + +import com.fr.chart.chartattr.Plot; +import com.fr.plugin.chart.attr.EffectHelper; +import com.fr.plugin.chart.base.AttrEffect; +import com.fr.plugin.chart.base.AttrFloatColor; +import com.fr.plugin.chart.base.VanChartAttrMarker; +import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane; +import com.fr.van.chart.designer.other.condition.item.VanChartFloatColorConditionPane; +import com.fr.van.chart.map.designer.other.condition.item.VanChartAnchorMarkerConditionPane; + +public class VanChartAnchorPointMapConditionPane extends VanChartMapConditionPane { + + public VanChartAnchorPointMapConditionPane(Plot plot) { + super(plot); + } + + protected void addDiffAction() { + classPaneMap.put(VanChartAttrMarker.class, new VanChartAnchorMarkerConditionPane(this)); + if (addLabelOrEffectAction()) { + addLabelAction(); + classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this)); + classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getScatterPlotDefaultEffect())); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java index 6d22d97001..80dc9ef0b1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/label/VanChartMapLabelPane.java @@ -39,18 +39,14 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { if (mapPlot == null) { return contentPane; } - switch (mapPlot.getAllLayersMapType()){ + switch (mapPlot.getAllLayersMapType()) { case POINT: pointLabelPane = new VanChartPlotLabelPane(mapPlot, parent); contentPane.add(pointLabelPane, BorderLayout.NORTH); break; case CUSTOM: - areaLabelPane = createAreaMapPlotLabelPane(); - pointLabelPane = new VanChartPlotLabelPane(mapPlot, parent); - contentPane.add(new VanMapAreaAndPointGroupPane(areaLabelPane, pointLabelPane), BorderLayout.NORTH); - break; case DRILL_CUSTOM: - areaLabelPane = new VanChartPlotLabelPane(mapPlot, parent); + areaLabelPane = createAreaMapPlotLabelPane(); pointLabelPane = new VanChartPlotLabelPane(mapPlot, parent); contentPane.add(new VanMapAreaAndPointGroupPane(areaLabelPane, pointLabelPane), BorderLayout.NORTH); break; @@ -64,7 +60,7 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { } private VanChartPlotLabelPane createAreaMapPlotLabelPane() { - return new VanChartPlotLabelPane(mapPlot, parent){ + return new VanChartPlotLabelPane(mapPlot, parent) { @Override protected boolean checkEnabled4Large() { return false; @@ -75,7 +71,7 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { @Override public void populateBean(Chart chart) { Plot plot = chart.getPlot(); - if(plot instanceof VanChartMapPlot){ + if (plot instanceof VanChartMapPlot) { mapPlot = (VanChartMapPlot) plot; } @@ -85,11 +81,11 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { parent.initAllListeners(); } - AttrMapLabel attrMapLabel = (AttrMapLabel)plot.getConditionCollection().getDefaultAttr().getExisted(AttrMapLabel.class); - if(attrMapLabel == null){ + AttrMapLabel attrMapLabel = (AttrMapLabel) plot.getConditionCollection().getDefaultAttr().getExisted(AttrMapLabel.class); + if (attrMapLabel == null) { attrMapLabel = new AttrMapLabel(); } - if(pointLabelPane != null){ + if (pointLabelPane != null) { pointLabelPane.populate(attrMapLabel.getPointLabel()); } if (areaLabelPane != null) { @@ -103,17 +99,17 @@ public class VanChartMapLabelPane extends AbstractVanChartScrollPane { return; } ConditionAttr defaultAttr = chart.getPlot().getConditionCollection().getDefaultAttr(); - AttrMapLabel attrMapLabel = (AttrMapLabel)defaultAttr.getExisted(AttrMapLabel.class); + AttrMapLabel attrMapLabel = (AttrMapLabel) defaultAttr.getExisted(AttrMapLabel.class); if (attrMapLabel != null) { defaultAttr.remove(attrMapLabel); } else { attrMapLabel = new AttrMapLabel(); } - if(areaLabelPane != null){ + if (areaLabelPane != null) { attrMapLabel.setAreaLabel(areaLabelPane.update()); } - if(pointLabelPane != null){ + if (pointLabelPane != null) { attrMapLabel.setPointLabel(pointLabelPane.update()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java new file mode 100644 index 0000000000..745c3a79a8 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/series/VanChartMapAnchorMarkerPane.java @@ -0,0 +1,64 @@ +package com.fr.van.chart.map.designer.style.series; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.plugin.chart.base.VanChartAttrMarker; +import com.fr.plugin.chart.marker.type.MarkerType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class VanChartMapAnchorMarkerPane extends BasicBeanPane { + + private UISpinner anchorSize; + + public VanChartMapAnchorMarkerPane() { + anchorSize = new UISpinner(0, Double.MAX_VALUE, 0.5, 28); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Height")), anchorSize} + }; + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] row = {p}; + double[] col = {f, e}; + + JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col); + content.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); + + this.setLayout(new BorderLayout()); + this.add(content, BorderLayout.CENTER); + } + + public void populateBean(VanChartAttrMarker marker) { + if (marker == null) { + marker = new VanChartAttrMarker(); + marker.setCommon(false); + marker.setMarkerType(MarkerType.MARKER_AUTO); + } + + this.anchorSize.setValue(marker.getAnchorSize()); + } + + public VanChartAttrMarker updateBean() { + VanChartAttrMarker marker = new VanChartAttrMarker(); + + marker.setCommon(false); + marker.setMarkerType(MarkerType.MARKER_AUTO); + marker.setAnchorSize(this.anchorSize.getValue()); + + return marker; + } + + protected String title4PopupWindow() { + return "anchorMarker"; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java new file mode 100644 index 0000000000..c69297fa86 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GeoUrlPane.java @@ -0,0 +1,258 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.base.Parameter; +import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icombobox.FRTreeComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; +import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; +import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; +import com.fr.plugin.chart.type.MapType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; +import com.fr.workspace.WorkContext; + +import javax.swing.JPanel; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class GeoUrlPane extends JPanel implements UIObserver { + + private UILabel sourceTitleLabel; + private FRTreeComboBox sourceComboBox; + private MapDataTree mapDataTree; + private TreePath selectTreePath; + + private UIObserverListener listener; + + private String[] oldParams; + + public GeoUrlPane() { + initComps(); + } + + private void initComps() { + this.setLayout(new BorderLayout()); + this.add(createMapSourcesPane(), BorderLayout.CENTER); + } + + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.listener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + private JPanel createMapSourcesPane() { + + mapDataTree = new MapDataTree(this.getRootNode()); + mapDataTree.setEditable(false); + mapDataTree.selectDefaultTreeNode(); + sourceComboBox = new FRTreeComboBox(mapDataTree, mapDataTree.getCellRenderer()) { + //搜索 + protected void dealSamePath(TreePath parent, TreeNode node, UITextField textField) { + String searchText = textField.getText(); + GeoUrlPane.this.mapDataTree.search(searchText); + } + + //选中 tree---combobox + public void setSelectedItem(Object o) { + TreePath oldPath = mapDataTree.getSelectionPath(); + Object oldText = getSelectedItem(); + if (o != null && o instanceof TreePath) { + selectTreePath = (TreePath) o; + this.tree.setSelectionPath(selectTreePath); + this.getModel().setSelectedItem(pathToString(selectTreePath)); + if (ComparatorUtils.equals(oldText, getSelectedItem()) && !ComparatorUtils.equals(oldPath, selectTreePath)) { + //point的江苏省切换到area的江苏省 + listener.doChange(); + } + } else if (o instanceof String) {//list里面没有 + selectTreePath = null; + this.tree.setSelectionPath(null); + this.getModel().setSelectedItem(ChartGEOJSONHelper.getPresentNameWithPath((String) o)); + } + } + + @Override + protected String pathToString(TreePath path) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + //不显示后缀 + return ChartGEOJSONHelper.getPresentNameWithPath(node.toString()); + } + + @Override + protected boolean customSelectable(DefaultMutableTreeNode node) { + return GEOJSONTreeHelper.isSelectableTreeNode(node); + } + }; + sourceComboBox.setEditable(true); + sourceComboBox.setOnlyLeafSelectable(false); + sourceComboBox.addPopupMenuListener(popupMenuListener); + sourceTitleLabel = createSourceTitleLabel(); + + + boolean hasRefreshButton = !WorkContext.getCurrent().isLocal(); + UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); + button.setToolTipText(Toolkit.i18nText("Fine-Design_Chart_Update_Remote_Map_JSON")); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + GEOJSONHelper.reset(); + GEOJSONHelper.getInstance(); + } + }); + + double p = TableLayout.PREFERRED; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double f = TableLayout.FILL; + double[] rowSize = {p, p}; + double[] columnSize = hasRefreshButton ? new double[]{d + 10, e - 20, 20} : new double[]{f, e}; + + Component[] comps = hasRefreshButton + ? new Component[]{sourceTitleLabel, sourceComboBox, button} + : new Component[]{sourceTitleLabel, sourceComboBox}; + + double hGap = hasRefreshButton ? 0 : TableLayout4VanChartHelper.COMPONENT_INTERVAL; + Component[][] components = new Component[][]{ + new Component[]{null, null}, + comps, + }; + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, hGap, LayoutConstants.VGAP_LARGE); + } + + protected UILabel createSourceTitleLabel() { + return new UILabel(Toolkit.i18nText("Fine-Design_Chart_Map_Area")); + } + + protected TreeNode getRootNode() { + return GEOJSONTreeHelper.getInstance().getRootNodeWithPara(); + } + + private String[] getParamsName() { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + + if (jTemplate == null) { + return new String[0]; + } + + Parameter[] parameters = jTemplate.getJTemplateParameters(); + + int len = parameters.length; + String[] names = new String[len]; + + for (int i = 0; i < len; i++) { + names[i] = parameters[i].getName(); + } + + return names; + } + + private PopupMenuListener popupMenuListener = new PopupMenuListener() { + public void popupMenuCanceled(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + + GEOJSONTreeHelper.reset(); + mapDataTree.changeRootNode(GeoUrlPane.this.getRootNode()); + GEOJSONTreeHelper.getInstance().updateParamRootNode(GeoUrlPane.this.getParamsName()); + + if (selectTreePath != null) { + mapDataTree.setSelectNodePath(CompatibleGEOJSONHelper.completeJSONName(selectTreePath.getLastPathComponent().toString())); + selectTreePath = mapDataTree.getSelectionPath(); + } + + mapDataTree.updateUI();//因为服务器那边可能随时编辑,所以这边要重画 + mapDataTree.setSelectionPath(selectTreePath); + mapDataTree.scrollPathToVisible(selectTreePath); + } + }; + + public void populate(VanChartMapPlot mapPlot) { + resetComponentValue(mapPlot, false); + String geoUrl = mapPlot.getGeoUrl(); + mapDataTree.setSelectNodePath(geoUrl); + selectTreePath = mapDataTree.getSelectionPath(); + + if (selectTreePath == null) {//此url当前环境没有 + sourceComboBox.setSelectedItem(geoUrl); + } else { + sourceComboBox.setSelectedItem(selectTreePath); + } + boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(mapPlot.getGeoUrl()); + GUICoreUtils.setEnabled(sourceComboBox, enabled); + } + + public String update() { + return mapDataTree.getSelectNodeJSONPath(); + } + + protected void resetComponentValue(VanChartMapPlot mapPlot, boolean samePlotChange) { + MapType mapType = mapPlot.getMapType(); + + //获取最新的参数 + String[] params = getParamsName(); + + if (!ComparatorUtils.equals(oldParams, params)) { + oldParams = params; + GEOJSONTreeHelper.getInstance().updateParamRootNode(params); + } + + mapDataTree.changeRootNode(this.getRootNode()); + if (samePlotChange) { + String nodePath = ChartGEOJSONHelper.getDefaultJSONURL(); + mapPlot.setGeoUrl(nodePath); + mapDataTree.setSelectNodePath(nodePath); + selectTreePath = mapDataTree.getSelectionPath(); + sourceComboBox.setSelectedItem(selectTreePath); + } + switch (mapType) { + case CUSTOM: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); + break; + case POINT: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Point")); + break; + case LINE: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Point")); + break; + default: + sourceTitleLabel.setText(Toolkit.i18nText("Fine-Design_Chart_Map_Area")); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java new file mode 100644 index 0000000000..406b896104 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/GisLayerPane.java @@ -0,0 +1,303 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.base.Utils; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.base.GisLayer; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.server.MapLayerConfigManager; +import com.fr.plugin.chart.type.GISLayerType; +import com.fr.plugin.chart.type.GaoDeGisType; +import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ItemEvent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class GisLayerPane extends JPanel implements UIObserver { + + private UIButtonGroup gisButton; + private JPanel layerPaneCheckPane; + private UIComboBox gisGaoDeLayer; + private UIComboBox gisLayer; + private JPanel layerCardPane; + + private WMSLayerPane wmsLayerPane; + private TileLayerPane tileLayerPane; + + private UIComboBox zoomLevel; + + private String[] layers = MapLayerConfigManager.getLayerItems(); + + public GisLayerPane() { + initComps(); + } + + private void initComps() { + this.setLayout(new BorderLayout()); + this.add(createGISLayerPane(), BorderLayout.CENTER); + } + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.wmsLayerPane.registerChangeListener(listener); + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + public void registerZoomLevel(UIComboBox zoomLevel) { + this.zoomLevel = zoomLevel; + } + + private boolean isStandardGis() { + return gisButton.getSelectedIndex() == 0; + } + + + private JPanel createGISLayerPane() { + gisButton = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Form_Widget_Style_Standard"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); + gisGaoDeLayer = new UIComboBox(MapLayerConfigManager.getGaoDeLayerItems()); + gisButton.addActionListener(event -> { + refreshZoomLevel(); + checkLayerCardPane(); + }); + + gisGaoDeLayer.addItemListener(event -> refreshZoomLevel()); + + initCustomGISLayerPane(); + initLayerCardPane(); + + layerPaneCheckPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (isStandardGis()) { + return gisGaoDeLayer.getPreferredSize(); + } else { + return gisLayer.getPreferredSize(); + } + } + }; + layerPaneCheckPane.add(gisGaoDeLayer, "standard"); + layerPaneCheckPane.add(gisLayer, "custom"); + + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] row = {p, p, p}; + double[] col = {f, e}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gis_Layer")), gisButton}, + new Component[]{null, layerPaneCheckPane}, + new Component[]{layerCardPane, null}, + }; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + return panel; + } + + private void initLayerCardPane() { + tileLayerPane = new TileLayerPane(); + wmsLayerPane = new WMSLayerPane(); + + layerCardPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (isStandardGis()) { + return new Dimension(0, 0); + } + String itemName = Utils.objectToString(gisLayer.getSelectedItem()); + if (MapLayerConfigManager.isCustomLayer(itemName)) { + return tileLayerPane.getPreferredSize(); + } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { + return wmsLayerPane.getPreferredSize(); + } + return new Dimension(0, 0); + } + }; + + for (String itemName : layers) { + JPanel pane = new JPanel(); + if (MapLayerConfigManager.isCustomLayer(itemName)) { + pane = tileLayerPane; + } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { + pane = wmsLayerPane; + } + layerCardPane.add(pane, itemName); + } + } + + private void initCustomGISLayerPane() { + gisLayer = new UIComboBox(layers); + + gisLayer.addItemListener(e -> + { + if (e.getStateChange() == ItemEvent.SELECTED) { + checkCustomLayerCardPane(); + } + refreshZoomLevel(); + } + ); + + gisLayer.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuCanceled(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + } + + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + + String selected = Utils.objectToString(gisLayer.getSelectedItem()); + ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem(); + + gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems())); + + gisLayer.setSelectedItem(selected); + zoomLevel.setSelectedItem(zoomSelected); + } + }); + } + + private void refreshZoomLevel() { + //gis图层不同,对应的缩放等级不同。 + ZoomLevel[] levels; + if (isStandardGis()) { + if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) { + levels = MapStatusPane.ZOOM_LEVELS; + } else { + levels = MapStatusPane.GAODE_ZOOM_LEVELS; + } + } else { + if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) { + levels = MapStatusPane.BLUE_ZOOM_LEVELS; + } else if (ComparatorUtils.equals(gisLayer.getSelectedItem(), Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) { + levels = MapStatusPane.GAODE_ZOOM_LEVELS; + } else { + levels = MapStatusPane.ZOOM_LEVELS; + } + } + zoomLevel.setModel(new DefaultComboBoxModel(levels)); + } + + + private void checkLayerCardPane() { + CardLayout cardLayout = (CardLayout) layerPaneCheckPane.getLayout(); + cardLayout.show(layerPaneCheckPane, isStandardGis() ? "standard" : "custom"); + } + + private void checkCustomLayerCardPane() { + CardLayout cardLayout = (CardLayout) layerCardPane.getLayout(); + cardLayout.show(layerCardPane, Utils.objectToString(gisLayer.getSelectedItem())); + } + + public void resetGisLayer(VanChartMapPlot mapPlot) { + //TODO Bjorn 地图gis图层自动逻辑 + /* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO); + mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/ + + GaoDeGisType gaoDeGisType= mapPlot.getDefaultGisLayerType(); + + mapPlot.getGisLayer().setGisLayerType(GISLayerType.GAO_DE_API); + mapPlot.getGisLayer().setLayerName(gaoDeGisType.getTypeName()); + mapPlot.getGisLayer().setGaoDeGisType(gaoDeGisType); + populate(mapPlot.getGisLayer()); + } + + public void populate(GisLayer layer) { + switch (layer.getGisLayerType()) { + case GAO_DE_API: + case LAYER_NULL: + populateStandardGis(layer); + break; + default: + populateCustomGis(layer); + } + refreshZoomLevel(); + + checkCustomLayerCardPane(); + checkLayerCardPane(); + } + + private void populateStandardGis(GisLayer layer) { + gisButton.setSelectedIndex(0); + if (layer.getGisLayerType() == GISLayerType.LAYER_NULL) { + gisGaoDeLayer.setSelectedIndex(gisGaoDeLayer.getItemCount() - 1); + } else { + gisGaoDeLayer.setSelectedItem(layer.getGaoDeGisType().getTypeName()); + } + } + + private void populateCustomGis(GisLayer layer) { + gisButton.setSelectedIndex(1); + gisLayer.setSelectedItem(layer.getShowItemName()); + + switch (layer.getGisLayerType()) { + case CUSTOM_WMS_LAYER: + wmsLayerPane.populate(layer); + break; + case CUSTOM_TILE_LAYER: + tileLayerPane.populate(layer); + break; + } + } + + public void update(GisLayer layer) { + if (isStandardGis()) { + updateStandardGis(layer); + } else { + updateCustomGis(layer); + } + } + + private void updateStandardGis(GisLayer layer) { + String layerName = Utils.objectToString(gisGaoDeLayer.getSelectedItem()); + layer.setLayerName(layerName); + if (gisGaoDeLayer.getSelectedIndex() == gisGaoDeLayer.getItemCount() - 1) { + layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); + } else { + layer.setGisLayerType(GISLayerType.GAO_DE_API); + layer.setGaoDeGisType(GaoDeGisType.parseByLocaleName(layerName)); + } + } + + private void updateCustomGis(GisLayer layer) { + String layerName = Utils.objectToString(gisLayer.getSelectedItem()); + layer.setLayerName(layerName); + layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); + + switch (layer.getGisLayerType()) { + case CUSTOM_WMS_LAYER: + wmsLayerPane.update(layer); + break; + case CUSTOM_TILE_LAYER: + tileLayerPane.update(layer); + break; + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java new file mode 100644 index 0000000000..668a9b7745 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/MapStatusPane.java @@ -0,0 +1,167 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.plugin.chart.base.ViewCenter; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.stable.ArrayUtils; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class MapStatusPane extends JPanel { + + public static final ZoomLevel[] ZOOM_LEVELS = new ZoomLevel[]{ + ZoomLevel.AUTO, + ZoomLevel.ZERO, ZoomLevel.ZEROPOINTFIVE, + ZoomLevel.ONE, ZoomLevel.ONEPOINTFIVE, + ZoomLevel.TWO, ZoomLevel.TWOPOINTFIVE, + ZoomLevel.THREE, ZoomLevel.THREEPOINTFIVE, + ZoomLevel.FOUR, ZoomLevel.FOURPOINTFIVE, + ZoomLevel.FIVE, ZoomLevel.FIVEPOINTFIVE, + ZoomLevel.SIX, ZoomLevel.SIXPOINTFIVE, + ZoomLevel.SEVEN, ZoomLevel.SEVENPOINTFIVE, + ZoomLevel.EIGHT, ZoomLevel.EIGHTPOINTFIVE, + ZoomLevel.NINE, ZoomLevel.NINEPOINTFIVE, + ZoomLevel.TEN, ZoomLevel.TENPOINTFIVE, + ZoomLevel.ELEVEN, ZoomLevel.ELEVENTPOINTFIVE, + ZoomLevel.TWELVE, ZoomLevel.TWELVEPOINTFIVE, + ZoomLevel.THIRTEEN, ZoomLevel.THIRTEENPOINTFIVE, + ZoomLevel.FOURTEEN, ZoomLevel.FOURTEENPOINTFIVE, + ZoomLevel.FIFTEEN, ZoomLevel.FIFTEENPOINTFIVE, + ZoomLevel.SIXTEEN, ZoomLevel.SIXTEENPOINTFIVE, + ZoomLevel.SEVENTEEN, ZoomLevel.SEVENTEENPOINTFIVE, + ZoomLevel.EIGHTEEN + }; + //深蓝和高德地图下拉框层级 + public static final ZoomLevel[] BLUE_ZOOM_LEVELS = ArrayUtils.subarray(ZOOM_LEVELS, 0, 34); + public static final ZoomLevel[] GAODE_ZOOM_LEVELS = ArrayUtils.addAll(new ZoomLevel[]{ZoomLevel.AUTO}, (ZoomLevel[]) ArrayUtils.subarray(ZOOM_LEVELS, 7, 38)); + private static final String AUTO_CENTER_STRING = Toolkit.i18nText("Fine-Design_Chart_Automatic"); + private static final String CUSTOM_CENTER_STRING = Toolkit.i18nText("Fine-Design_Chart_Custom"); + + + private JPanel levelAndCenterPane; + private JPanel longAndLatPane; + + private UIComboBox zoomLevel; + private UIButtonGroup viewCenterCom; + private UISpinner longitude; + private UISpinner latitude; + + public MapStatusPane() { + initComps(); + } + + public UIComboBox getZoomLevel() { + return zoomLevel; + } + + private void initComps() { + zoomLevel = new UIComboBox(ZOOM_LEVELS); + viewCenterCom = new UIButtonGroup(new String[]{AUTO_CENTER_STRING, CUSTOM_CENTER_STRING}); + longitude = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1, 0.0); + latitude = new UISpinner(-Double.MAX_VALUE, Double.MAX_VALUE, 1, 0.0); + + double p = TableLayout.PREFERRED; + double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; + double[] rowSize = {p, p, p}; + double[] columnSize = {d, e}; + double[] column = {d, s}; + + Component[][] comps = new Component[][]{ + new Component[]{null, null}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), zoomLevel}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_View_Center")), viewCenterCom}, + }; + levelAndCenterPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, columnSize); + + Component[][] longAndLatComps = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitude}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitude} + }; + longAndLatPane = TableLayout4VanChartHelper.createGapTableLayoutPane(longAndLatComps, rowSize, column); + longAndLatPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); + longAndLatPane.setVisible(false); + + this.setLayout(new BorderLayout(0, 6)); + + this.add(levelAndCenterPane, BorderLayout.NORTH); + this.add(longAndLatPane, BorderLayout.CENTER); + + viewCenterCom.addActionListener(event -> + longAndLatPane.setVisible(!isAutoViewCenter())); + } + + @Override + public Dimension getPreferredSize() { + if (longAndLatPane.isVisible()) { + return super.getPreferredSize(); + } else { + return levelAndCenterPane.getPreferredSize(); + } + } + + private boolean isAutoViewCenter() { + return viewCenterCom.getSelectedIndex() == 0; + } + + + public void resetViewCenter(VanChartMapPlot mapPlot) { + mapPlot.setViewCenter(new ViewCenter()); + viewCenterCom.setSelectedIndex(0); + longitude.setValue(0); + latitude.setValue(0); + longAndLatPane.setVisible(false); + } + + public void resetZoomLevel(VanChartMapPlot mapPlot) { + mapPlot.setZoomLevel(ZoomLevel.AUTO); + zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); + } + + public void populate(VanChartMapPlot mapPlot) { + zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); + + ViewCenter viewCenter = mapPlot.getViewCenter(); + if (viewCenter.isAuto()) { + viewCenterCom.setSelectedIndex(0); + longitude.setValue(0); + latitude.setValue(0); + } else { + viewCenterCom.setSelectedIndex(1); + longitude.setValue(viewCenter.getLongitude()); + latitude.setValue(viewCenter.getLatitude()); + } + + longAndLatPane.setVisible(!isAutoViewCenter()); + } + + public void update(VanChartMapPlot mapPlot) { + mapPlot.setZoomLevel((ZoomLevel) zoomLevel.getSelectedItem()); + + ViewCenter viewCenter = mapPlot.getViewCenter(); + if (isAutoViewCenter()) { + viewCenter.setAuto(true); + } else { + viewCenter.setAuto(false); + viewCenter.setLongitude(longitude.getValue()); + viewCenter.setLatitude(latitude.getValue()); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java new file mode 100644 index 0000000000..4101fbd9d5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/TileLayerPane.java @@ -0,0 +1,51 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.layout.TableLayout; +import com.fr.plugin.chart.base.GisLayer; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class TileLayerPane extends JPanel { + + private UITextArea customTileLayer; + private UITextArea attribution; + + + public TileLayerPane() { + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH - 3}; + + customTileLayer = new UITextArea(); + attribution = new UITextArea(); + Component[][] comps = new Component[][]{ + new Component[]{new UILabel("url"), customTileLayer}, + new Component[]{new UILabel("Attribution"), attribution} + }; + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); + panel.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); + + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.CENTER); + } + + public void populate(GisLayer layer) { + customTileLayer.setText(layer.getCustomTileLayer()); + attribution.setText(layer.getAttribution()); + } + + public void update(GisLayer layer) { + layer.setCustomTileLayer(customTileLayer.getText()); + layer.setAttribution(attribution.getText()); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java index a4356be870..9b5636e402 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java @@ -2,9 +2,11 @@ package com.fr.van.chart.map.designer.type; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; +import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.data.ChartDataDefinitionProvider; import com.fr.chartx.data.MapChartDataDefinition; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; +import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; @@ -78,7 +80,6 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { boolean enabled = !CompatibleGEOJSONHelper.isDeprecated(plot.getGeoUrl()); GUICoreUtils.setEnabled(this.getTypePane(), enabled); - GUICoreUtils.setEnabled(this.sourceChoosePane.getSourceComboBox(), enabled); checkDemosBackground(); } @@ -101,6 +102,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane { if (!isSamePlot() || (typeChanged && isSamePlot())) { resetAttr(plot); } + ChartInfoCollector.getInstance().updateChartConfig(chart, ConfigType.MAP, chart.getBuryingPointMapConfig()); } } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index bbe9d7dd44..5be437619c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -1,739 +1,113 @@ package com.fr.van.chart.map.designer.type; -import com.fr.base.Parameter; -import com.fr.base.Utils; -import com.fr.decision.webservice.v10.map.WMSFactory; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; -import com.fr.design.constants.LayoutConstants; -import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.FRTreeComboBox; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UISpinner; -import com.fr.design.gui.itextarea.UITextArea; -import com.fr.design.gui.itextfield.UITextField; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.JTemplate; -import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; -import com.fr.plugin.chart.base.GisLayer; -import com.fr.plugin.chart.base.ViewCenter; import com.fr.plugin.chart.map.VanChartMapPlot; -import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; -import com.fr.plugin.chart.map.layer.WMSLayer; -import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; -import com.fr.plugin.chart.map.server.MapLayerConfigManager; -import com.fr.plugin.chart.type.GISLayerType; -import com.fr.plugin.chart.type.MapType; -import com.fr.plugin.chart.type.ZoomLevel; -import com.fr.stable.ArrayUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.drillmap.designer.data.comp.MapDataTree; -import com.fr.workspace.WorkContext; import javax.swing.BorderFactory; -import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.SwingWorker; -import javax.swing.event.PopupMenuEvent; -import javax.swing.event.PopupMenuListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; -import java.util.ArrayList; -import java.util.List; import java.awt.BorderLayout; -import java.awt.CardLayout; import java.awt.Component; -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.awt.event.MouseEvent; -import java.awt.event.MouseListener; /** * Created by Mitisky on 16/5/11. * 地图类型选择面板,关于json资源路径/gis图层等设置面板 */ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { - private static final double[] COLUMN_SIZE = {48, TableLayout.FILL, TableLayout.PREFERRED}; - public static final ZoomLevel[] ZOOM_LEVELS = new ZoomLevel[]{ - ZoomLevel.AUTO, - ZoomLevel.ZERO, ZoomLevel.ZEROPOINTFIVE, - ZoomLevel.ONE, ZoomLevel.ONEPOINTFIVE, - ZoomLevel.TWO, ZoomLevel.TWOPOINTFIVE, - ZoomLevel.THREE, ZoomLevel.THREEPOINTFIVE, - ZoomLevel.FOUR, ZoomLevel.FOURPOINTFIVE, - ZoomLevel.FIVE, ZoomLevel.FIVEPOINTFIVE, - ZoomLevel.SIX, ZoomLevel.SIXPOINTFIVE, - ZoomLevel.SEVEN, ZoomLevel.SEVENPOINTFIVE, - ZoomLevel.EIGHT, ZoomLevel.EIGHTPOINTFIVE, - ZoomLevel.NINE, ZoomLevel.NINEPOINTFIVE, - ZoomLevel.TEN, ZoomLevel.TENPOINTFIVE, - ZoomLevel.ELEVEN, ZoomLevel.ELEVENTPOINTFIVE, - ZoomLevel.TWELVE, ZoomLevel.TWELVEPOINTFIVE, - ZoomLevel.THIRTEEN, ZoomLevel.THIRTEENPOINTFIVE, - ZoomLevel.FOURTEEN, ZoomLevel.FOURTEENPOINTFIVE, - ZoomLevel.FIFTEEN, ZoomLevel.FIFTEENPOINTFIVE, - ZoomLevel.SIXTEEN, ZoomLevel.SIXTEENPOINTFIVE, - ZoomLevel.SEVENTEEN, ZoomLevel.SEVENTEENPOINTFIVE, - ZoomLevel.EIGHTEEN - }; - //深蓝和高德地图下拉框层级 - private static final ZoomLevel[] BLUE_ZOOM_LEVELS =(ZoomLevel[]) ArrayUtils.subarray(ZOOM_LEVELS, 0, 34); - private static final ZoomLevel[] GAODE_ZOOM_LEVELS =ArrayUtils.addAll(new ZoomLevel[]{ZoomLevel.AUTO}, (ZoomLevel[])ArrayUtils.subarray(ZOOM_LEVELS, 7, 38)); - private static final String AUTO_CENTER_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"); - private static final String CUSTOM_CENTER_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom"); - private UILabel sourceTitleLabel; - private FRTreeComboBox sourceComboBox; - private MapDataTree mapDataTree; - private TreePath selectTreePath; + private GeoUrlPane geoUrlPane; - private UIComboBox gisLayer; - private JPanel layerCardPane; + private GisLayerPane gisLayerPane; - private UITextArea wmsUrl; - private UIButton connectButton; - private JPanel wmsLayerPane; - - private java.util.List wmsLayerCheckBoxs = new ArrayList(); - - private UITextArea customTileLayer; - private UITextArea attribution; - - private UIComboBox zoomLevel; - private UIButtonGroup viewCenterCom; - private JPanel longAndLatPane; - private UISpinner longitude; - private UISpinner latitude; - - private String[] oldParams; - - private UIObserverListener listener; - private String[] layers = MapLayerConfigManager.getLayerItems(); - /** - * 给组件登记一个观察者监听事件 - * - * @param listener 观察者监听事件 - */ - @Override - public void registerChangeListener(UIObserverListener listener) { - this.listener = listener; - } - - /** - * 组件是否需要响应添加的观察者事件 - * - * @return 如果需要响应观察者事件则返回true,否则返回false - */ - @Override - public boolean shouldResponseChangeListener() { - return true; - } + private MapStatusPane mapStatusPane; public VanChartMapSourceChoosePane() { + initGeoUrlPane(); + initMapStatusPane(); + initGisLayerPane(); + this.setLayout(new BorderLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); + this.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); double p = TableLayout.PREFERRED; double[] columnSize = {230}; - double[] rowSize = {p,p,p,p,p,p,p,p}; + double[] rowSize = {p, p, p, p, p, p, p, p}; JPanel panel = new JPanel(new BorderLayout()); - panel.add(createMapSourcesPane(), BorderLayout.NORTH); - panel.add(createGISLayerPane(), BorderLayout.CENTER); - JPanel BasePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"), panel); + panel.add(geoUrlPane, BorderLayout.NORTH); + panel.add(gisLayerPane, BorderLayout.CENTER); + JPanel basePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Report_Basic"), panel); + + JPanel mapStatusPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Map_Init_Status"), mapStatusPane); Component[][] comps = new Component[][]{ - new Component[]{BasePane}, - new Component[]{createMapInitStatusPane()} + new Component[]{basePane}, + new Component[]{mapStatusPaneWithTitle} }; - JPanel contentPane = TableLayoutHelper.createTableLayoutPane(comps,rowSize,columnSize); + JPanel contentPane = TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize); this.add(contentPane, BorderLayout.CENTER); } - protected boolean supportParam(){ - return true; - } - - protected TreeNode getRootNode() { - return supportParam() ? GEOJSONTreeHelper.getInstance().getRootNodeWithPara() : GEOJSONTreeHelper.getInstance().getRootNodeWithoutPara(); + public void setGeoUrlPane(GeoUrlPane geoUrlPane) { + this.geoUrlPane = geoUrlPane; } - protected UILabel createSourceTitleLabel() { - return new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area")); - } - - private JPanel createMapSourcesPane() { - mapDataTree = new MapDataTree(this.getRootNode()); - mapDataTree.setEditable(false); - mapDataTree.selectDefaultTreeNode(); - sourceComboBox = new FRTreeComboBox(mapDataTree, mapDataTree.getCellRenderer()){ - //搜索 - protected void dealSamePath(TreePath parent, TreeNode node, UITextField textField){ - String searchText = textField.getText(); - VanChartMapSourceChoosePane.this.mapDataTree.search(searchText); - } - - //选中 tree---combobox - public void setSelectedItem(Object o) { - TreePath oldPath = mapDataTree.getSelectionPath(); - Object oldText = getSelectedItem(); - if(o != null && o instanceof TreePath){ - selectTreePath =(TreePath)o; - this.tree.setSelectionPath(selectTreePath); - this.getModel().setSelectedItem(pathToString(selectTreePath)); - if(ComparatorUtils.equals(oldText, getSelectedItem()) && !ComparatorUtils.equals(oldPath, selectTreePath)) { - //point的江苏省切换到area的江苏省 - listener.doChange(); - } - } else if(o instanceof String){//list里面没有 - selectTreePath = null; - this.tree.setSelectionPath(null); - this.getModel().setSelectedItem(ChartGEOJSONHelper.getPresentNameWithPath((String) o)); - } - } - - @Override - protected String pathToString(TreePath path) { - DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); - //不显示后缀 - return ChartGEOJSONHelper.getPresentNameWithPath(node.toString()); - } - - @Override - protected boolean customSelectable(DefaultMutableTreeNode node){ - return GEOJSONTreeHelper.isSelectableTreeNode(node); - } - }; - sourceComboBox.setEditable(true); - sourceComboBox.setOnlyLeafSelectable(false); - sourceComboBox.addPopupMenuListener(popupMenuListener); - - sourceTitleLabel = createSourceTitleLabel(); - - boolean hasRefreshButton = !WorkContext.getCurrent().isLocal(); - - UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/images/control/refresh.png")); - button.setToolTipText(Toolkit.i18nText("Fine-Design_Chart_Update_Remote_Map_JSON")); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - GEOJSONHelper.reset(); - GEOJSONHelper.getInstance(); - } - }); - - - double p = TableLayout.PREFERRED; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double[] rowSize = {p, p}; - - double[] columnSize = hasRefreshButton ? new double[]{d + 10, e - 20, 20} : new double[]{d, e}; - Component[] comps = hasRefreshButton ? new Component[]{sourceTitleLabel, sourceComboBox, button} : new Component[]{sourceTitleLabel, sourceComboBox}; - double hGap = hasRefreshButton ? 0 : TableLayout4VanChartHelper.COMPONENT_INTERVAL; - Component[][] components = new Component[][]{ - new Component[]{null,null}, - comps, - - }; - return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, hGap, LayoutConstants.VGAP_LARGE); - } - - private JPanel createGISLayerPane() { - JPanel panel = new JPanel(new BorderLayout(0, 8)); - - gisLayer = new UIComboBox(layers); - - gisLayer.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - refreshZoomLevel(); - } - }); - - gisLayer.addPopupMenuListener(new PopupMenuListener() { - public void popupMenuCanceled(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - - String selected = Utils.objectToString(gisLayer.getSelectedItem()); - ZoomLevel zoomSelected = (ZoomLevel) zoomLevel.getSelectedItem(); - - gisLayer.setModel(new DefaultComboBoxModel(MapLayerConfigManager.getLayerItems())); - - gisLayer.setSelectedItem(selected); - zoomLevel.setSelectedItem(zoomSelected); - } - }); - - - gisLayer.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - checkLayerCardPane(); - } - } - }); - - final JPanel tileLyaerPane = createCustomTileLayer(); - final JPanel wmsLayerPane = createWMSPanel(); - - layerCardPane = new JPanel(new CardLayout()){ - @Override - public Dimension getPreferredSize() { - String itemName = Utils.objectToString(gisLayer.getSelectedItem()); - if (MapLayerConfigManager.isCustomLayer(itemName)) { - return tileLyaerPane.getPreferredSize(); - } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { - return wmsLayerPane.getPreferredSize(); - } - return new Dimension(0,0); - } - }; - - for(String itemName : layers){ - JPanel pane = new JPanel(); - if (MapLayerConfigManager.isCustomLayer(itemName)) { - pane = tileLyaerPane; - } else if (MapLayerConfigManager.isCustomWmsLayer(itemName)) { - pane = wmsLayerPane; - } - - layerCardPane.add(pane, itemName); - } - - JPanel panel1 = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gis_Layer"), gisLayer); - - panel.add(panel1, BorderLayout.CENTER); - panel.add(layerCardPane, BorderLayout.SOUTH); - - return panel; - } - - private void refreshZoomLevel(){ - //gis图层不同,对应的缩放等级不同。 - ZoomLevel[] levels; - if (ComparatorUtils.equals(gisLayer.getSelectedItem(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Blue"))) { - levels = BLUE_ZOOM_LEVELS; - } else if (ComparatorUtils.equals(gisLayer.getSelectedItem(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_GaoDe"))) { - levels = GAODE_ZOOM_LEVELS; - } else { - levels = ZOOM_LEVELS; - } - zoomLevel.setModel(new DefaultComboBoxModel(levels)); - } - - - private JPanel createCustomTileLayer() { - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH-3}; - - customTileLayer = new UITextArea(); - attribution = new UITextArea(); - Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), customTileLayer}, - new Component[]{new UILabel("Attribution"), attribution} - }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); - panel.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); - return panel; - } - - private JPanel createWMSPanel() { - - final double p = TableLayout.PREFERRED; - double[] rowSize = {p}; - double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 84,44}; - - - wmsUrl = new UITextArea(); - connectButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); - - Component[][] comps = new Component[][]{ - new Component[]{new UILabel("url"), wmsUrl, connectButton} - }; - JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); - northPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); - JPanel wmsPanel = new JPanel(new BorderLayout(0, 4)); - wmsLayerPane = new JPanel(new BorderLayout()); - resetWMSLayerPane(new ArrayList()); - wmsPanel.add(northPane, BorderLayout.NORTH); - wmsPanel.add(wmsLayerPane, BorderLayout.CENTER); - - connectButton.addActionListener(actionListener); - - addMouseListener(); - - return wmsPanel; - } - - ActionListener actionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - - new SwingWorker() { - private java.util.List list = new ArrayList<>(); - - @Override - protected Void doInBackground() throws Exception { - HttpClient httpClient = new HttpClient(wmsUrl.getText() + "service=WMS&request=GetCapabilities"); - httpClient.asGet(); - - if (!httpClient.isServerAlive()) { - return null; - } - - String res = httpClient.getResponseText(); - List layers = WMSFactory.readLayers(res); - list.clear(); - for (String layer : layers) { - list.add(new WMSLayer(layer, false)); - } - return null; - } - - @Override - protected void done() { - connectButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); - if(list != null && list.size() > 0) { - resetWMSLayerPane(list); - } else { - FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); - } - } - }.execute(); - } - }; - - private void addMouseListener() { - connectButton.addMouseListener(new MouseListener() { - @Override - public void mouseClicked(MouseEvent e) { - - } - - @Override - public void mousePressed(MouseEvent e) { - connectButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Connecting_WMP")); - } - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - - } - }); + @Override + public void registerChangeListener(UIObserverListener listener) { + geoUrlPane.registerChangeListener(listener); + gisLayerPane.registerChangeListener(listener); } - private void resetWMSLayerPane(java.util.List wmsLayers) { - - int size = wmsLayers.size(); - double[] rowSize = new double[size]; - Component[][] comps = new Component[size][2]; - wmsLayerCheckBoxs.clear(); - wmsLayerPane.removeAll(); - for(int i =0; i < size; i++){ - rowSize[i] = TableLayout.PREFERRED; - comps[i][0] = i == 0 ? new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_WMS_Layers"), SwingConstants.RIGHT) : null; - WMSLayer layer = wmsLayers.get(i); - UICheckBox checkBox = new UICheckBox(layer.getLayer()); - checkBox.registerChangeListener(listener); - checkBox.setToolTipText(layer.getLayer()); - checkBox.setSelected(layer.isSelected()); - comps[i][1] = checkBox; - wmsLayerCheckBoxs.add(checkBox); - } - - wmsLayerPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps,rowSize, COLUMN_SIZE,0), BorderLayout.CENTER); - - VanChartMapSourceChoosePane.this.updateUI(); + @Override + public boolean shouldResponseChangeListener() { + return true; } - private JPanel createMapInitStatusPane() { - zoomLevel = new UIComboBox(ZOOM_LEVELS); - viewCenterCom = new UIButtonGroup(new String[]{AUTO_CENTER_STRING, CUSTOM_CENTER_STRING}); - longitude = new UISpinner(-Double.MAX_VALUE,Double.MAX_VALUE,1,0.0); - latitude = new UISpinner(-Double.MAX_VALUE,Double.MAX_VALUE,1,0.0); - - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; - double[] rowSize = {p,p,p}; - double[] columnSize = {d, e}; - double[] column = {d, s}; - - Component[][] comps = new Component[][]{ - new Component[]{null, null}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), zoomLevel}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_View_Center")), viewCenterCom}, - }; - final JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps,rowSize,columnSize); - - Component[][] longAndLatComps = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitude}, - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitude} - }; - longAndLatPane =TableLayout4VanChartHelper.createGapTableLayoutPane(longAndLatComps,rowSize,column); - longAndLatPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); - longAndLatPane.setVisible(false); - - JPanel contentPane = new JPanel(new BorderLayout(0, 6)){ - - @Override - public Dimension getPreferredSize() { - if(longAndLatPane.isVisible()) { - return super.getPreferredSize(); - } else { - return northPane.getPreferredSize(); - } - } - }; - contentPane.add(northPane, BorderLayout.NORTH); - contentPane.add(longAndLatPane, BorderLayout.CENTER); - - viewCenterCom.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - longAndLatPane.setVisible(!isAutoViewCenter()); - } - }); - return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Init_Status"), contentPane); + protected void initGeoUrlPane() { + geoUrlPane = new GeoUrlPane(); } - private boolean isAutoViewCenter() { - return viewCenterCom.getSelectedIndex()==0; + private void initGisLayerPane() { + gisLayerPane = new GisLayerPane(); + gisLayerPane.registerZoomLevel(mapStatusPane.getZoomLevel()); } - private PopupMenuListener popupMenuListener = new PopupMenuListener() { - public void popupMenuCanceled(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - } - - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - - GEOJSONTreeHelper.reset(); - mapDataTree.changeRootNode(VanChartMapSourceChoosePane.this.getRootNode()); - GEOJSONTreeHelper.getInstance().updateParamRootNode(VanChartMapSourceChoosePane.this.getParams()); - - if(selectTreePath != null){ - mapDataTree.setSelectNodePath(CompatibleGEOJSONHelper.completeJSONName(selectTreePath.getLastPathComponent().toString())); - selectTreePath = mapDataTree.getSelectionPath(); - } - - mapDataTree.updateUI();//因为服务器那边可能随时编辑,所以这边要重画 - mapDataTree.setSelectionPath(selectTreePath); - mapDataTree.scrollPathToVisible(selectTreePath); - } - }; - - private void checkLayerCardPane() { - CardLayout cardLayout = (CardLayout) layerCardPane.getLayout(); - cardLayout.show(layerCardPane, Utils.objectToString(gisLayer.getSelectedItem())); + private void initMapStatusPane() { + mapStatusPane = new MapStatusPane(); } public void resetComponentValue(VanChartMapPlot mapPlot) { - resetComponentValue(mapPlot, true); + geoUrlPane.resetComponentValue(mapPlot, true); //重置图层属性 - resetGisLayer(mapPlot); + gisLayerPane.resetGisLayer(mapPlot); //重置缩放等级 - resetZoomLevel(mapPlot); + mapStatusPane.resetZoomLevel(mapPlot); //重置中心点位置 - resetViewCenter(mapPlot); + mapStatusPane.resetViewCenter(mapPlot); } - protected void resetComponentValue(VanChartMapPlot mapPlot, boolean samePlotChange) { - MapType mapType = mapPlot.getMapType(); - - //获取最新的参数 - String[] params = getParams(); - - if (!ComparatorUtils.equals(oldParams, params)){ - oldParams = params; - GEOJSONTreeHelper.getInstance().updateParamRootNode(params); - } - - mapDataTree.changeRootNode(this.getRootNode()); - if(samePlotChange) { - String nodePath = ChartGEOJSONHelper.getDefaultJSONURL(); - mapPlot.setGeoUrl(nodePath); - mapDataTree.setSelectNodePath(nodePath); - selectTreePath = mapDataTree.getSelectionPath(); - sourceComboBox.setSelectedItem(selectTreePath); - } - switch (mapType){ - case CUSTOM: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area_And_Point")); - break; - case POINT: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Point")); - break; - case LINE: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Point")); - break; - default: - sourceTitleLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Area")); - } - - } - - private String[] getParams() { - JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jTemplate == null){ - return new String[0]; - } - - return getParamsName((jTemplate.getJTemplateParameters())); - } - - private String[] getParamsName(Parameter[] parameters) { - String[] names = new String[parameters.length]; - for (int i = 0; i < parameters.length; i++){ - names[i] = parameters[i].getName(); - } - return names; - } - - private void resetViewCenter(VanChartMapPlot mapPlot) { - mapPlot.setViewCenter(new ViewCenter()); - viewCenterCom.setSelectedIndex(0); - longitude.setValue(0); - latitude.setValue(0); - longAndLatPane.setVisible(false); - } - - private void resetZoomLevel(VanChartMapPlot mapPlot) { - mapPlot.setZoomLevel(ZoomLevel.AUTO); - zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); - } - - private void resetGisLayer(VanChartMapPlot mapPlot) { - //TODO Bjorn 地图gis图层自动逻辑 - /* mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO); - mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));*/ - - String layerName = mapPlot.getDefaultGisLayerName(); - - mapPlot.getGisLayer().setGisLayerType(GISLayerType.PREDEFINED_LAYER); - mapPlot.getGisLayer().setLayerName(layerName); - gisLayer.setSelectedItem(mapPlot.getGisLayer().getShowItemName()); - } public void populateBean(VanChartMapPlot mapPlot) { - resetComponentValue(mapPlot, false); - - mapDataTree.setSelectNodePath(mapPlot.getGeoUrl()); - selectTreePath = mapDataTree.getSelectionPath(); - - if(selectTreePath == null){//此url当前环境没有 - sourceComboBox.setSelectedItem(mapPlot.getGeoUrl()); - } else { - sourceComboBox.setSelectedItem(selectTreePath); - } - - GisLayer layer = mapPlot.getGisLayer(); - gisLayer.setSelectedItem(layer.getShowItemName()); - - wmsUrl.setText(layer.getWmsUrl()); - resetWMSLayerPane(layer.getWmsLayers()); - customTileLayer.setText(layer.getCustomTileLayer()); - attribution.setText(layer.getAttribution()); - - refreshZoomLevel(); - zoomLevel.setSelectedItem(mapPlot.getZoomLevel()); - - ViewCenter viewCenter = mapPlot.getViewCenter(); - if(viewCenter.isAuto()){ - viewCenterCom.setSelectedIndex(0); - longitude.setValue(0); - latitude.setValue(0); - } else { - viewCenterCom.setSelectedIndex(1); - longitude.setValue(viewCenter.getLongitude()); - latitude.setValue(viewCenter.getLatitude()); - } - - longAndLatPane.setVisible(!isAutoViewCenter()); - - checkLayerCardPane(); + geoUrlPane.populate(mapPlot); + gisLayerPane.populate(mapPlot.getGisLayer()); + mapStatusPane.populate(mapPlot); } public void updateBean(VanChartMapPlot mapPlot) { - if(!CompatibleGEOJSONHelper.isDeprecated(mapPlot.getGeoUrl())){ - mapPlot.setGeoUrl(mapDataTree.getSelectNodeJSONPath()); - } - - GisLayer layer = mapPlot.getGisLayer(); - String layerName = Utils.objectToString(gisLayer.getSelectedItem()); - - layer.setLayerName(layerName); - layer.setGisLayerType(MapLayerConfigManager.getGisLayerType(layerName)); - - switch (layer.getGisLayerType()){ - case CUSTOM_WMS_LAYER: - layer.setWmsUrl(wmsUrl.getText()); - layer.setWmsLayers(new ArrayList()); - for(UICheckBox checkBox : wmsLayerCheckBoxs){ - layer.addWmsLayer(new WMSLayer(checkBox.getText(), checkBox.isSelected())); - } - break; - case CUSTOM_TILE_LAYER: - layer.setCustomTileLayer(customTileLayer.getText()); - layer.setAttribution(attribution.getText()); - break; + if (!CompatibleGEOJSONHelper.isDeprecated(mapPlot.getGeoUrl())) { + mapPlot.setGeoUrl(geoUrlPane.update()); } - mapPlot.setZoomLevel((ZoomLevel) zoomLevel.getSelectedItem()); - - ViewCenter viewCenter = mapPlot.getViewCenter(); - if(isAutoViewCenter()){ - viewCenter.setAuto(true); - } else { - viewCenter.setAuto(false); - viewCenter.setLongitude(longitude.getValue()); - viewCenter.setLatitude(latitude.getValue()); - } - } - - public UIComboBox getSourceComboBox(){ - return this.sourceComboBox; + gisLayerPane.update(mapPlot.getGisLayer()); + mapStatusPane.update(mapPlot); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java new file mode 100644 index 0000000000..19afd688f6 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/WMSLayerPane.java @@ -0,0 +1,165 @@ +package com.fr.van.chart.map.designer.type; + +import com.fr.decision.webservice.v10.map.WMSFactory; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextarea.UITextArea; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.http.HttpClient; +import com.fr.plugin.chart.base.GisLayer; +import com.fr.plugin.chart.map.layer.WMSLayer; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.SwingWorker; +import java.util.ArrayList; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-07 + */ +public class WMSLayerPane extends JPanel implements UIObserver { + private static final double[] COLUMN_SIZE = {48, TableLayout.FILL, TableLayout.PREFERRED}; + + private UITextArea wmsUrl; + private UIButton connectButton; + private JPanel wmsLayerPane; + + private List wmsLayerCheckBoxs = new ArrayList<>(); + + private UIObserverListener listener; + + @Override + public void registerChangeListener(UIObserverListener listener) { + this.listener = listener; + } + + @Override + public boolean shouldResponseChangeListener() { + return true; + } + + + public WMSLayerPane() { + final double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] COLUMN_SIZE = {TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH, 84, 44}; + + + wmsUrl = new UITextArea(); + connectButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); + + Component[][] comps = new Component[][]{ + new Component[]{new UILabel("url"), wmsUrl, connectButton} + }; + JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, rowSize, COLUMN_SIZE); + northPane.setBorder(TableLayout4VanChartHelper.SECOND_EDIT_AREA_BORDER); + + wmsLayerPane = new JPanel(new BorderLayout()); + resetWMSLayerPane(new ArrayList<>()); + + this.setLayout(new BorderLayout(0, 6)); + this.add(northPane, BorderLayout.NORTH); + this.add(wmsLayerPane, BorderLayout.CENTER); + addListener(); + } + + private void addListener() { + connectButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + new SwingWorker() { + private java.util.List list = new ArrayList<>(); + + @Override + protected Void doInBackground() { + HttpClient httpClient = new HttpClient(wmsUrl.getText() + "service=WMS&request=GetCapabilities"); + httpClient.asGet(); + + if (!httpClient.isServerAlive()) { + return null; + } + + String res = httpClient.getResponseText(); + List layers = WMSFactory.readLayers(res); + list.clear(); + for (String layer : layers) { + list.add(new WMSLayer(layer, false)); + } + return null; + } + + @Override + protected void done() { + connectButton.setText(Toolkit.i18nText("Fine-Design_Chart_Connect_WMP")); + if (list != null && list.size() > 0) { + resetWMSLayerPane(list); + } else { + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); + } + } + }.execute(); + } + }); + + connectButton.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + connectButton.setText(Toolkit.i18nText("Fine-Design_Chart_Connecting_WMP")); + } + }); + } + + private void resetWMSLayerPane(java.util.List wmsLayers) { + int size = wmsLayers.size(); + double[] rowSize = new double[size]; + Component[][] comps = new Component[size][2]; + wmsLayerCheckBoxs.clear(); + wmsLayerPane.removeAll(); + for (int i = 0; i < size; i++) { + rowSize[i] = TableLayout.PREFERRED; + comps[i][0] = i == 0 ? new UILabel(Toolkit.i18nText("Fine-Design_Chart_WMS_Layers"), SwingConstants.RIGHT) : null; + WMSLayer layer = wmsLayers.get(i); + UICheckBox checkBox = new UICheckBox(layer.getLayer()); + checkBox.registerChangeListener(listener); + checkBox.setToolTipText(layer.getLayer()); + checkBox.setSelected(layer.isSelected()); + comps[i][1] = checkBox; + wmsLayerCheckBoxs.add(checkBox); + } + + wmsLayerPane.add(TableLayoutHelper.createCommonTableLayoutPane(comps, rowSize, COLUMN_SIZE, 0), BorderLayout.CENTER); + + updateUI(); + } + + public void populate(GisLayer layer) { + wmsUrl.setText(layer.getWmsUrl()); + resetWMSLayerPane(layer.getWmsLayers()); + } + + public void update(GisLayer layer) { + layer.setWmsUrl(wmsUrl.getText()); + layer.setWmsLayers(new ArrayList<>()); + for (UICheckBox checkBox : wmsLayerCheckBoxs) { + layer.addWmsLayer(new WMSLayer(checkBox.getText(), checkBox.isSelected())); + } + } +} + diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java index dc64adef11..e9b0373a83 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -1,10 +1,10 @@ package com.fr.van.chart.map.server; import com.fr.base.ServerConfig; +import com.fr.base.svg.IconUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; import com.fr.start.ServerStarter; import com.fr.workspace.WorkContext; @@ -17,7 +17,7 @@ import java.awt.event.ActionEvent; public class ChartMapEditorAction extends UpdateAction { public ChartMapEditorAction(){ - this.setSmallIcon(IOUtils.readIcon("/com/fr/van/chart/map/images/mapData.png")); + this.setSmallIcon("/com/fr/van/chart/map/images/mapData"); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Data")); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java new file mode 100644 index 0000000000..e5b55d7491 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieCategoryLabelContentPane.java @@ -0,0 +1,130 @@ +package com.fr.van.chart.pie.style; + +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; +import com.fr.plugin.chart.base.AttrTooltipContent; +import com.fr.plugin.chart.base.AttrTooltipRichText; +import com.fr.plugin.chart.base.format.AttrTooltipFormat; +import com.fr.plugin.chart.pie.attr.PieCategoryLabelContent; +import com.fr.van.chart.designer.component.VanChartLabelContentPane; +import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.SummaryValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-10 + */ +public class VanChartPieCategoryLabelContentPane extends VanChartLabelContentPane { + + private SummaryValueFormatPaneWithCheckBox summaryValueFormatPane; + + private SummaryValueFormatPaneWithoutCheckBox richTextSummaryValueFormatPane; + + public VanChartPieCategoryLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { + super(parent, showOnPane, inCondition); + } + + @Override + protected JPanel getLabelContentPane(JPanel contentPane) { + return contentPane; + } + + @Override + protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { + setCategoryNameFormatPane(new CategoryNameFormatPaneWithCheckBox(parent, showOnPane)); + summaryValueFormatPane = new SummaryValueFormatPaneWithCheckBox(parent, showOnPane); + } + + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + setRichTextCategoryNameFormatPane(new CategoryNameFormatPaneWithoutCheckBox(parent, showOnPane)); + richTextSummaryValueFormatPane = new SummaryValueFormatPaneWithoutCheckBox(parent, showOnPane); + } + + @Override + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{getCategoryNameFormatPane(), null}, + new Component[]{summaryValueFormatPane, null}, + }; + } + + @Override + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{getRichTextCategoryNameFormatPane(), null}, + new Component[]{richTextSummaryValueFormatPane, null}, + }; + } + + @Override + protected double[] getRowSize(double p) { + return new double[]{p, p}; + } + + public JPanel createCommonStylePane() { + setTextAttrPane(new ChartTextAttrPane()); + return getTextAttrPane(); + } + + @Override + protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { + PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; + super.populateFormatPane(pieCategoryLabelContent); + summaryValueFormatPane.populate(pieCategoryLabelContent.getSummaryValueFormat()); + } + + protected void populateRichEditor(AttrTooltipContent attrTooltipContent) { + PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; + VanChartFormatPaneWithoutCheckBox[] formatPaneGroup = new VanChartFormatPaneWithoutCheckBox[]{ + getRichTextCategoryNameFormatPane(), + richTextSummaryValueFormatPane + }; + + AttrTooltipFormat[] formatGroup = new AttrTooltipFormat[]{ + pieCategoryLabelContent.getRichTextCategoryFormat(), + pieCategoryLabelContent.getRichTextSummaryValueFormat() + }; + + setRichTextAttr(new AttrTooltipRichText()); + populateRichTextFormat(formatPaneGroup, formatGroup); + populateRichText(pieCategoryLabelContent.getRichTextAttr()); + + checkRichEditorState(pieCategoryLabelContent); + } + + @Override + protected void updateFormatPane(AttrTooltipContent attrTooltipContent) { + PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; + super.updateFormatPane(pieCategoryLabelContent); + summaryValueFormatPane.update(pieCategoryLabelContent.getSummaryValueFormat()); + } + + protected void updateRichEditor(AttrTooltipContent attrTooltipContent) { + PieCategoryLabelContent pieCategoryLabelContent = (PieCategoryLabelContent) attrTooltipContent; + super.updateRichEditor(pieCategoryLabelContent); + richTextSummaryValueFormatPane.update(pieCategoryLabelContent.getRichTextSummaryValueFormat()); + } + + @Override + public void setDirty(boolean isDirty) { + getCategoryNameFormatPane().setDirty(isDirty); + summaryValueFormatPane.setDirty(isDirty); + } + + @Override + public boolean isDirty() { + return getCategoryNameFormatPane().isDirty() || summaryValueFormatPane.isDirty(); + } + + protected AttrTooltipContent createAttrTooltip() { + return new PieCategoryLabelContent(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java new file mode 100644 index 0000000000..ddc6e66313 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/pie/style/VanChartPieValueLabelContentPane.java @@ -0,0 +1,79 @@ +package com.fr.van.chart.pie.style; + +import com.fr.van.chart.designer.component.VanChartLabelContentPane; +import com.fr.van.chart.designer.component.format.PercentFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; +import com.fr.van.chart.designer.component.format.ValueFormatPaneWithoutCheckBox; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.JPanel; +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-12-09 + */ +public class VanChartPieValueLabelContentPane extends VanChartLabelContentPane { + + public VanChartPieValueLabelContentPane(VanChartStylePane parent, JPanel showOnPane, boolean inCondition) { + super(parent, showOnPane, inCondition); + } + + @Override + protected JPanel getLabelContentPane(JPanel contentPane) { + return contentPane; + } + + @Override + protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { + setSeriesNameFormatPane(new SeriesNameFormatPaneWithCheckBox(parent, showOnPane)); + setValueFormatPane(new ValueFormatPaneWithCheckBox(parent, showOnPane)); + setPercentFormatPane(new PercentFormatPaneWithCheckBox(parent, showOnPane)); + } + + @Override + protected void initRichTextFormatPane(VanChartStylePane parent, JPanel showOnPane) { + setRichTextSeriesNameFormatPane(new SeriesNameFormatPaneWithoutCheckBox(parent, showOnPane)); + setRichTextValueFormatPane(new ValueFormatPaneWithoutCheckBox(parent, showOnPane)); + setRichTextPercentFormatPane(new PercentFormatPaneWithoutCheckBox(parent, showOnPane)); + } + + @Override + protected double[] getRowSize(double p) { + return new double[]{p, p, p}; + } + + @Override + protected Component[][] getPaneComponents() { + return new Component[][]{ + new Component[]{getSeriesNameFormatPane(), null}, + new Component[]{getValueFormatPane(), null}, + new Component[]{getPercentFormatPane(), null}, + }; + } + + @Override + protected Component[][] getRichTextComponents() { + return new Component[][]{ + new Component[]{getRichTextSeriesNameFormatPane(), null}, + new Component[]{getRichTextValueFormatPane(), null}, + new Component[]{getRichTextPercentFormatPane(), null} + }; + } + + @Override + public void setDirty(boolean isDirty) { + getSeriesNameFormatPane().setDirty(isDirty); + getValueFormatPane().setDirty(isDirty); + getPercentFormatPane().setDirty(isDirty); + } + + @Override + public boolean isDirty() { + return getSeriesNameFormatPane().isDirty() || getValueFormatPane().isDirty() || getPercentFormatPane().isDirty(); + } +} diff --git a/designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg b/designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg new file mode 100644 index 0000000000..bbf7baac79 --- /dev/null +++ b/designer-chart/src/main/resources/com/fr/van/chart/map/images/mapData_normal.svg @@ -0,0 +1,8 @@ + + + icon_地图数据_normal + + + + + diff --git a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java index 8004b739f2..c867be8d24 100644 --- a/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/NewFormAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions; -import com.fr.base.BaseUtils; -import com.fr.design.actions.UpdateAction; + +import com.fr.base.svg.IconUtils; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; @@ -21,7 +21,7 @@ public class NewFormAction extends UpdateAction { this.setMenuKeySet(NEW_FORM); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/new_form3.png")); + this.setSmallIcon("/com/fr/design/images/buttonicon/new_form3"); this.setAccelerator(getMenuKeySet().getKeyStroke()); } diff --git a/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java b/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java index bd747444e3..99e432eee1 100644 --- a/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/TemplateParameterAction.java @@ -2,7 +2,7 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.Parameter; -import com.fr.design.actions.JTemplateAction; +import com.fr.design.DesignModelAdapter; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.JForm; @@ -10,7 +10,7 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterArrayPane; import com.fr.form.main.Form; -import javax.swing.*; +import javax.swing.SwingUtilities; import java.awt.event.ActionEvent; /** @@ -48,9 +48,8 @@ public class TemplateParameterAction extends JTemplateAction { for (int i = 0; i < parameters.length; i++) { wbTpl.addParameter(parameters[i]); } - jwb.fireTargetModified(); - jwb.getFormDesign().setParameterArray(parameters); - jwb.getFormDesign().refreshParameter(); + DesignModelAdapter.getCurrentModelAdapter().fireTargetModified(); + DesignModelAdapter.getCurrentModelAdapter().parameterChanged(); } }); parameterArrayDialog.setVisible(true); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java index c087d78fef..f10b877e27 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/LayoutAdapter.java @@ -42,6 +42,19 @@ public interface LayoutAdapter { */ boolean addBean(XCreator creator, int x, int y); + + /** + * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 + * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 + * + * @param creator 被添加的新组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @param accept 是否添加新组件 + * @return 是否添加成功,成功返回true,否则false + */ + boolean addBean(XCreator creator, int x, int y, boolean accept); + /** * 返回该布局管理适配器的Painter,为容器提供放置位置的标识。 */ @@ -91,4 +104,4 @@ public interface LayoutAdapter { * @param initHeight 组件之前高度 */ void removeBean(XCreator creator, int initWidth, int initHeight); -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java index 47f7e3924c..c577a86939 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CopyAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; + import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,7 +16,7 @@ public class CopyAction extends FormWidgetEditAction { super(t); 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)); setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); @@ -27,4 +27,4 @@ public class CopyAction extends FormWidgetEditAction { DesignModeContext.doCopy(getEditingComponent()); return false; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java index 421cae2e6e..e93eebd729 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/CutAction.java @@ -1,6 +1,6 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; + import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -16,7 +16,7 @@ public class CutAction extends FormWidgetEditAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut")); this.setMnemonic('T'); - this.setSmallIcon(BaseUtils.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.setUpdateBehavior(new ComponentEnable()); this.setEnabled(!DesignModeContext.isBanCopyAndCut()); @@ -26,4 +26,4 @@ public class CutAction extends FormWidgetEditAction { public boolean executeActionReturnUndoRecordNeeded() { return DesignModeContext.doCut(getEditingComponent()); } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java index 7492f8cc8b..5f9a59de5f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/FormDeleteAction.java @@ -7,7 +7,7 @@ import java.awt.event.KeyEvent; import javax.swing.*; -import com.fr.base.BaseUtils; + import com.fr.design.designer.beans.actions.behavior.ComponentEnable; import com.fr.design.mainframe.FormDesigner; @@ -24,7 +24,7 @@ public class FormDeleteAction extends FormWidgetEditAction { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); // Richie:删除菜单图标 - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); + this.setSmallIcon("/com/fr/design/images/m_report/delete"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); this.setUpdateBehavior(new ComponentEnable()); } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java index c02295f0f0..ef35097b21 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/actions/PasteAction.java @@ -1,6 +1,5 @@ package com.fr.design.designer.beans.actions; -import com.fr.base.BaseUtils; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.mainframe.FormDesigner; @@ -15,7 +14,7 @@ public class PasteAction extends FormWidgetEditAction { super(t); 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)); } @@ -29,4 +28,4 @@ public class PasteAction extends FormWidgetEditAction { this.setEnabled(true); } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java index 493dd02aa2..d9fae2dd86 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/AbstractLayoutAdapter.java @@ -78,7 +78,23 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { */ @Override public boolean addBean(XCreator creator, int x, int y) { - if (!accept(creator, x, y)) { + boolean accept = accept(creator, x, y); + return addBean(creator, x, y, accept); + } + + /** + * 组件的ComponentAdapter在添加组件时,如果发现布局管理器不为空,会继而调用该布局管理器的 + * addComp方法来完成组件的具体添加。在该方法内,布局管理器可以提供额外的功能。 + * + * @param creator 被添加的新组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @param accept 是否添加新组件 + * @return 是否添加成功,成功返回true,否则false + */ + @Override + public boolean addBean(XCreator creator, int x, int y, boolean accept) { + if (!accept) { return false; } addComp(creator, x, y); @@ -186,4 +202,4 @@ public abstract class AbstractLayoutAdapter implements LayoutAdapter { public XLayoutContainer getContainer() { return this.container; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java index d5a680b611..2b33159e8b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java @@ -18,7 +18,8 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; import com.fr.general.act.BorderPacker; -import java.awt.*; +import java.awt.Rectangle; + /** * tab布局tabFit适配器 @@ -73,8 +74,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { y = adjustY(y, tabLayout); } //这时候应该要用计算后的父fit布局添加 - this.container.getLayoutAdapter().addBean(creator, x, y); - ((XWidgetCreator) creator).recalculateChildrenSize(); + this.container.getLayoutAdapter().addBean(creator, x, y, true); return true; } // 如果不在边缘,容器为本自适应布局,增加组件的位置就是相对于容器的位置 diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 0f673e30ae..dc74087c40 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -397,8 +397,12 @@ public class SelectionModel { boolean absoluteCanvas = selectionXCreator.getClass().equals(XWAbsoluteLayout.class); //选中的是否是相对布局编辑器本身 boolean relativeEditor = selectionXCreator.getClass().equals(XWFitLayout.class); + //选中的参数面板编辑器本身 + boolean parameterEditor = selectionXCreator.getClass().equals(XWParameterLayout.class); + // 选中的是扩展容器布局本身 + boolean extraEditor = isSelectedExtraEditor(selectionXCreator); - return !(tabEditor || absoluteEditor || absoluteCanvas || relativeEditor); + return !(tabEditor || absoluteEditor || absoluteCanvas || relativeEditor || parameterEditor || extraEditor); } else { return false; } @@ -408,6 +412,16 @@ public class SelectionModel { } } + private boolean isSelectedExtraEditor(XCreator selectionXCreator) { + Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG); + for (FormWidgetOptionProvider provider : set) { + if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), selectionXCreator.getClass())) { + return true; + } + } + return false; + } + /** * 是否有组件被选择。如果所选组件是最底层容器,也视为无选择 * diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java index 9a627ab2c0..894a8ebdad 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java @@ -14,11 +14,11 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.mainframe.widget.editors.ShortCutTextEditor; import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.mainframe.widget.renderer.IconCellRenderer; +import com.fr.design.utils.DesignUtils; import com.fr.form.parameter.FormSubmitButton; import com.fr.form.ui.Button; import com.fr.form.ui.FreeButton; import com.fr.general.Background; - import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; @@ -29,7 +29,6 @@ import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; @@ -41,14 +40,13 @@ import java.beans.IntrospectionException; */ public class XButton extends XWidgetCreator { - public final static Background DEFAULTBG = new GradientBackground(new Color(247,247,247),new Color(210,210,210), GradientBackground.TOP2BOTTOM); - public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12); + public final static Background DEFAULTBG = new GradientBackground(new Color(247, 247, 247), new Color(210, 210, 210), GradientBackground.TOP2BOTTOM); public final static Color DEFAULTFOREGROUNDCOLOR = Color.BLACK; - private Background bg; - private UILabel contentLabel; + private Background bg; + private UILabel contentLabel; public XButton(Button widget, Dimension initSize) { - this(new FreeButton(widget),initSize); + this(new FreeButton(widget), initSize); } public XButton(FreeButton widget, Dimension initSize) { @@ -56,143 +54,146 @@ public class XButton extends XWidgetCreator { } public XButton(FormSubmitButton widget, Dimension initSize) { - super(widget, initSize); + super(widget, initSize); } - public Background getContentBackground() { - return bg; - } + public Background getContentBackground() { + return bg; + } - public void setContentBackground(Background bg) { - this.bg = bg; - } + public void setContentBackground(Background bg) { + this.bg = bg; + } - public UILabel getContentLabel() { - return contentLabel; - } + public UILabel getContentLabel() { + return contentLabel; + } - public void setContentLabel(UILabel contentLabel) { - this.contentLabel = contentLabel; - } + public void setContentLabel(UILabel contentLabel) { + this.contentLabel = contentLabel; + } /** - *根据下拉框选择返回按钮样式的默认设置或自定义设置列表 - * @return 列表 - * @throws IntrospectionException 抛错 + * 根据下拉框选择返回按钮样式的默认设置或自定义设置列表 + * + * @return 列表 + * @throws IntrospectionException 抛错 */ - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = ((FreeButton) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle(); - - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), crp); - } - - protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{ - CRPropertyDescriptor[] crPropertyDescriptors = { - new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( - ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass( - ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass( - ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( - ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font")) - .setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) - .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("hotkeys", this.data.getClass()) - .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setEditorClass(ShortCutTextEditor.class) - - }; + @Override + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = ((FreeButton) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle(); + + return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), crp); + } + + protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException { + CRPropertyDescriptor[] crPropertyDescriptors = { + new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( + ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font")) + .setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) + .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("hotkeys", this.data.getClass()) + .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setEditorClass(ShortCutTextEditor.class) + + }; return crPropertyDescriptors[i]; } - protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException{ - return new CRPropertyDescriptor[]{ - creatNonListenerStyle(0) .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - setButtonText(((FreeButton) data).getText()); - } - }), - - creatNonListenerStyle(1) .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - checkButonType(); - } - }), - creatNonListenerStyle(2).setPropertyChangeListener( - new PropertyChangeAdapter() { - @Override - public void propertyChange() { - bg = ((FreeButton) data).getInitialBackground(); - } - }), - creatNonListenerStyle(3), - creatNonListenerStyle(4), - creatNonListenerStyle(5) .setPropertyChangeListener( - new PropertyChangeAdapter() { - @Override - public void propertyChange() { - FreeButton button = (FreeButton) data; - if (button.getFont() != null) { - contentLabel.setFont(button.getFont().applyResolutionNP( - FontTransformUtil.getDesignerFontResolution())); - contentLabel.setForeground(button.getFont().getForeground()); - } - } - }), - creatNonListenerStyle(6), - creatNonListenerStyle(7) - - }; - } + + protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException { + return new CRPropertyDescriptor[]{ + creatNonListenerStyle(0).setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + setButtonText(((FreeButton) data).getText()); + } + }), + + creatNonListenerStyle(1).setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + checkButonType(); + } + }), + creatNonListenerStyle(2).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + bg = ((FreeButton) data).getInitialBackground(); + } + }), + creatNonListenerStyle(3), + creatNonListenerStyle(4), + creatNonListenerStyle(5).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + FreeButton button = (FreeButton) data; + if (button.getFont() != null) { + contentLabel.setFont(button.getFont().applyResolutionNP( + FontTransformUtil.getDesignerFontResolution())); + contentLabel.setForeground(button.getFont().getForeground()); + } + } + }), + creatNonListenerStyle(6), + creatNonListenerStyle(7) + + }; + } protected CRPropertyDescriptor[] getisnotCustomStyle() throws IntrospectionException { - return new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("text", this.data.getClass()) - .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - setButtonText(((FreeButton) data).getText()); - } - }), - new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( - ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - checkButonType(); - } - }), - new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) - .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("hotkeys", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setEditorClass(ShortCutTextEditor.class) - - - }; + return new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("text", this.data.getClass()) + .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + setButtonText(((FreeButton) data).getText()); + } + }), + new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( + ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + checkButonType(); + } + }), + new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) + .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("hotkeys", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setEditorClass(ShortCutTextEditor.class) + + + }; } + @Override protected JComponent initEditor() { if (editor == null) { @@ -202,110 +203,114 @@ public class XButton extends XWidgetCreator { return editor; } - protected UILabel initContentLabel() { - return new UILabel(); - } + protected UILabel initContentLabel() { + return new UILabel(); + } - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); //不可见时,按钮.4f透明 - AlphaComposite composite = this.data.isVisible() ? (AlphaComposite)((Graphics2D)g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER,HALF_OPACITY); - ((Graphics2D)g).setComposite(composite); - Dimension panelSize = (contentLabel).getSize(); - if(bg != null) { - bg.paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight())); - } - } - - public void setButtonText(String text) { - contentLabel.setText(text); - } - - private void checkButonType() { - UILabel l = contentLabel; - FreeButton button = (FreeButton) data; - - if (!button.isCustomStyle()) { - l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148))); - bg = DEFAULTBG; - contentLabel.setFont(DEFAULTFT); + AlphaComposite composite = this.data.isVisible() ? (AlphaComposite) ((Graphics2D) g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER, HALF_OPACITY); + ((Graphics2D) g).setComposite(composite); + Dimension panelSize = (contentLabel).getSize(); + if (bg != null) { + bg.paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight())); + } + } + + public void setButtonText(String text) { + contentLabel.setText(text); + } + + private void checkButonType() { + UILabel l = contentLabel; + FreeButton button = (FreeButton) data; + + if (!button.isCustomStyle()) { + l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148))); + bg = DEFAULTBG; + contentLabel.setFont(DesignUtils.getDefaultGUIFont()); contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR); editor.setLayout(new BorderLayout()); - editor.add(l, BorderLayout.CENTER); - } else { - l.setBorder(null); - editor.setLayout(new BorderLayout()); - editor.add(l,BorderLayout.CENTER); + editor.add(l, BorderLayout.CENTER); + } else { + l.setBorder(null); + editor.setLayout(new BorderLayout()); + editor.add(l, BorderLayout.CENTER); if (button.getFont() != null) { contentLabel.setFont(button.getFont().applyResolutionNP( - FontTransformUtil.getDesignerFontResolution())); + FontTransformUtil.getDesignerFontResolution())); contentLabel.setForeground(button.getFont().getForeground()); } - l.setBounds(0, 0, button.getButtonWidth() == 0 ? this.getWidth() : button.getButtonWidth(), button - .getButtonHeight() == 0 ? this.getHeight() : button.getButtonHeight()); - bg = button.getInitialBackground(); - } - } + l.setBounds(0, 0, button.getButtonWidth() == 0 ? this.getWidth() : button.getButtonWidth(), button + .getButtonHeight() == 0 ? this.getHeight() : button.getButtonHeight()); + bg = button.getInitialBackground(); + } + } @Override - protected void initXCreatorProperties() { - super.initXCreatorProperties(); - checkButonType(); - UILabel l = contentLabel; - FreeButton button = (FreeButton) data; - l.setText(button.getText()); - if (button.isCustomStyle() && button.getFont() != null) { - l.setFont(button.getFont().applyResolutionNP(FontTransformUtil.getDesignerFontResolution())); - l.setForeground(button.getFont().getForeground()); - } - - l.setVerticalAlignment(SwingConstants.CENTER); - l.setHorizontalAlignment(SwingConstants.CENTER); - if (button.getButtonHeight() > 0 && button.getButtonWidth() > 0) { - this.setSize(button.getButtonWidth(), button.getButtonHeight()); - l.setSize(button.getButtonWidth(), button.getButtonHeight()); - XLayoutContainer parent; - if ((parent = XCreatorUtils.getParentXLayoutContainer(this)) instanceof XWAbsoluteLayout) { - ((XWAbsoluteLayout) parent).toData().setBounds(toData(), getBounds()); - } - } - l.setEnabled(button.isEnabled()); - } + protected void initXCreatorProperties() { + super.initXCreatorProperties(); + checkButonType(); + UILabel l = contentLabel; + FreeButton button = (FreeButton) data; + l.setText(button.getText()); + if (button.isCustomStyle() && button.getFont() != null) { + l.setFont(button.getFont().applyResolutionNP(FontTransformUtil.getDesignerFontResolution())); + l.setForeground(button.getFont().getForeground()); + } + + l.setVerticalAlignment(SwingConstants.CENTER); + l.setHorizontalAlignment(SwingConstants.CENTER); + if (button.getButtonHeight() > 0 && button.getButtonWidth() > 0) { + this.setSize(button.getButtonWidth(), button.getButtonHeight()); + l.setSize(button.getButtonWidth(), button.getButtonHeight()); + XLayoutContainer parent; + if ((parent = XCreatorUtils.getParentXLayoutContainer(this)) instanceof XWAbsoluteLayout) { + ((XWAbsoluteLayout) parent).toData().setBounds(toData(), getBounds()); + } + } + l.setEnabled(button.isEnabled()); + } /** * 初始化按钮的Size - * @return 尺寸 + * + * @return 尺寸 */ - public Dimension initEditorSize() { - FreeButton button = (FreeButton) data; - if (checkbutton(button)) { - return new Dimension(button.getButtonWidth(), button.getButtonHeight()); - } - return super.initEditorSize(); - } - private boolean checkbutton(FreeButton button){ - return (button.isCustomStyle() && button.getButtonHeight() > 0 && button.getButtonWidth() > 0) ; + @Override + public Dimension initEditorSize() { + FreeButton button = (FreeButton) data; + if (checkbutton(button)) { + return new Dimension(button.getButtonWidth(), button.getButtonHeight()); + } + return super.initEditorSize(); + } + + private boolean checkbutton(FreeButton button) { + return (button.isCustomStyle() && button.getButtonHeight() > 0 && button.getButtonWidth() > 0); } + @Override protected String getIconName() { return "button_16.png"; } - /** - * data属性改变触发其他操作 - * - */ - public void firePropertyChange(){ - FreeButton button = (FreeButton) data; - setButtonText(button.getText()); - checkButonType(); - if (button.getFont() != null) { - contentLabel.setFont(button.getFont().applyResolutionNP( - FontTransformUtil.getDesignerFontResolution())); - contentLabel.setForeground(button.getFont().getForeground()); - } - - } + /** + * data属性改变触发其他操作 + */ + @Override + public void firePropertyChange() { + FreeButton button = (FreeButton) data; + setButtonText(button.getText()); + checkButonType(); + if (button.getFont() != null) { + contentLabel.setFont(button.getFont().applyResolutionNP( + FontTransformUtil.getDesignerFontResolution())); + contentLabel.setForeground(button.getFont().getForeground()); + } + + } } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java index d39e5620ec..72c7b8bfd1 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaTargetMode.java @@ -1,6 +1,7 @@ package com.fr.design.form.parameter; -import com.fr.base.BaseUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.gui.core.WidgetOption; @@ -27,7 +28,7 @@ public class FormParaTargetMode extends FormDesignerModeForSpecial predifinedwidgeList = new ArrayList(); private UIButton predefineButton; @@ -48,25 +48,25 @@ public class FormParaPane extends JPanel { private FormDesigner designer; - + static { GeneralContext.listenPluginRunningChanged(new PluginEventListener() { - + @Override public void on(PluginEvent event) { - + THIS = null; } }, new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(PluginModule.ExtraDesign); } }); } - + public static final FormParaPane getInstance(FormDesigner designer) { if(THIS == null) { THIS = new FormParaPane(); @@ -82,7 +82,7 @@ public class FormParaPane extends JPanel { public FormParaPane() { - predefineButton = new UIButton(UIConstants.PRE_WIDGET_ICON) { + predefineButton = new UIButton(UIConstants.PRE_WIDGET_NORMAL_ICON) { @Override public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 27e765f3f1..ddd78c13f6 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.beans.events.DesignerEditListener; @@ -373,7 +374,7 @@ public class FormParaWidgetPane extends JPanel { private class paraButton extends ToolBarButton { public paraButton(WidgetOption no) { super(no); - this.setDisabledIcon(BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter2.png")); + this.setDisabledIcon(IconUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter2_disabled.svg")); if (designer != null) { this.setEnabled(designer.getParaComponent() == null); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index c310ee5780..2900650aa0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; @@ -12,6 +13,7 @@ import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; +import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.utils.ComponentUtils; import com.fr.form.main.Form; import com.fr.form.ui.Widget; @@ -26,6 +28,7 @@ import java.awt.Toolkit; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; /** * 表单选中工具类 @@ -46,6 +49,8 @@ public class FormSelectionUtils { */ private static final String POSTFIX = "_c"; + private static FormWidgetOptionProvider optionProvider; + private FormSelectionUtils() { } @@ -64,10 +69,27 @@ public class FormSelectionUtils { //相对布局 relativePaste(designer, clipboard, adapter, x, y); return; + } else if (isExtraContainer(parent)) { + // 扩展布局 + optionProvider.formWidgetPaste(clipboard, adapter, x, y); + return; } Toolkit.getDefaultToolkit().beep(); } + private static boolean isExtraContainer(XLayoutContainer parent) { + if (parent != null) { + Set set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG); + for (FormWidgetOptionProvider provider : set) { + if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), parent.getClass())) { + optionProvider = provider; + return true; + } + } + } + return false; + } + public static void rebuildSelection(FormDesigner designer) { ArrayList newSelection = new ArrayList<>(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java b/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java index f80ce94ebd..948796f494 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormTargetMode.java @@ -2,7 +2,8 @@ package com.fr.design.mainframe; import java.util.ArrayList; -import com.fr.base.BaseUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.itable.PropertyGroup; @@ -22,7 +23,7 @@ public class FormTargetMode extends FormDesignerModeForSpecial { public WidgetOption[] getPredefinedWidgetOptions() { return new WidgetOption[]{ WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query_Button"), - BaseUtils.readIcon("/com/fr/web/images/form/resources/preview_16.png"), FormSubmitButton.class)}; + "/com/fr/web/images/form/resources/preview_16", FormSubmitButton.class)}; } public ArrayList createRootDesignerPropertyGroup() { @@ -38,9 +39,9 @@ public class FormTargetMode extends FormDesignerModeForSpecial { public int getMinDesignHeight() { return getTarget().getTarget().getContainer().getMinDesignSize().height; } - + @Override public int getMinDesignWidth() { return getTarget().getTarget().getContainer().getMinDesignSize().width; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index 43aa58d9b9..d39de1d447 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -97,6 +97,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import javax.swing.tree.TreePath; public class JForm extends JTemplate implements BaseJForm
{ private static final String FORM_CARD = "FORM"; @@ -247,7 +248,7 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm { private boolean hasTestECReport() { ElementCaseEditorProvider[] elementCaseEditorProviders = this.template.getElementCases(); for (ElementCaseEditorProvider elementCaseEditorProvider : elementCaseEditorProviders) { - FormElementCaseProvider elementCase = elementCaseEditorProvider.getElementCase(); - Iterator it = elementCase.cellIterator(); - if (!it.hasNext()) { + if (isTestECReport(elementCaseEditorProvider)) { return true; } - while (it.hasNext()) { - DefaultTemplateCellElement ce = (DefaultTemplateCellElement) it.next(); - Object value = ce.getValue(); - if (isTestCell(value, ce.getStyle())) { - return true; - } - } - } return false; } + private boolean isTestECReport(ElementCaseEditorProvider elementCaseEditorProvider) { + FormElementCaseProvider elementCase = elementCaseEditorProvider.getElementCase(); + if (!isTestElementCaseEditor((ElementCaseEditor) elementCaseEditorProvider)) { + return false; + } + Iterator it = elementCase.cellIterator(); + if (!it.hasNext()) { + return true; + } + while (it.hasNext()) { + DefaultTemplateCellElement ce = (DefaultTemplateCellElement) it.next(); + Object value = ce.getValue(); + if (!isTestCell(value, ce.getStyle())) { + return false; + } + } + return true; + } + + private boolean isTestElementCaseEditor(ElementCaseEditor editor) { + return editor.getToolBars().length == 0 && editor.getListenerSize() == 0 + && ComparatorUtils.equals(editor.getBorderStyle(), new LayoutBorderStyle()) + && ComparatorUtils.equals(editor.getMargin(), new PaddingMargin()) + && editor.getBackground() == null; + + } + private boolean hasTestChart() { final boolean[] hasTestChart = {false}; Form.traversalWidget(this.template.getContainer(), new WidgetGather() { @@ -226,7 +245,7 @@ public class JFormProcessInfo extends TemplateProcessInfo { private void addComponentRemoveInfo(JSONObject jsonObject) { String componentID = jsonObject.getString("componentID"); - if (componentID == null){ + if (componentID == null) { return; } JSONObject info = componentProcessInfoMap.get(componentID); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java new file mode 100644 index 0000000000..94fa4607c3 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java @@ -0,0 +1,48 @@ +package com.fr.design.mainframe.widget.accessibles; + +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileParamSettingPane; +import com.fr.design.mainframe.widget.wrappers.MobileParamWrapper; +import com.fr.form.ui.container.WParameterLayout; +import com.fr.form.ui.mobile.MobileParamStyle; +import com.fr.report.mobile.EmptyMobileParamStyle; +import javax.swing.SwingUtilities; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/1/4 + */ +public class AccessibleMobileParamEditor extends UneditableAccessibleEditor { + + private MobileParamSettingPane mobileParamSettingPane; + + public AccessibleMobileParamEditor(MobileParamSettingPane mobileParamSettingPane) { + super(new MobileParamWrapper()); + this.mobileParamSettingPane = mobileParamSettingPane; + } + + @Override + protected void showEditorPane() { + mobileParamSettingPane.setPreferredSize(BasicDialog.MEDIUM); + BasicDialog dlg = mobileParamSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); + dlg.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + MobileParamStyle mobileParamStyle = mobileParamSettingPane.update(); + setValue(mobileParamStyle); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + WParameterLayout wParameterLayout = (WParameterLayout) formDesigner.getSelectionModel().getSelection().getSelectedCreator().toData(); + if (mobileParamStyle instanceof EmptyMobileParamStyle) { + wParameterLayout.setProvider(((EmptyMobileParamStyle) mobileParamStyle).getProvider()); + } + fireStateChanged(); + } + }); + mobileParamSettingPane.populate((MobileParamStyle) getValue()); + dlg.setVisible(true); + } +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index 138434d306..27d55ac28c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -1,9 +1,12 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.form.ui.Widget; import javax.swing.BorderFactory; +import java.awt.Component; /** * Created by ibm on 2017/7/26. @@ -16,13 +19,17 @@ public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane { } public UICheckBox createOtherConfig() { - enableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enabled"), true); - enableCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic")); + enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_Basic")); enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); return enableCheckBox; } + public String obtainBasicName(){ + return Toolkit.i18nText("Fine-Design_Basic_Widget_Name"); + } + @Override public String title4PopupWindow() { return "basicProperty"; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java index db98069094..a3a34a0619 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java @@ -1,21 +1,37 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.JForm; /** * Created by kerry on 2017/9/30. */ public class WidgetBasicPropertyPaneFactory { - public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator){ - if(xCreator.supportSetVisible() && xCreator.supportSetEnable()){ + public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator) { + freshPropertyMode(xCreator); + if (xCreator.supportSetVisible() && xCreator.supportSetEnable()) { return new FormBasicWidgetPropertyPane(); } - if(xCreator.supportSetVisible()){ + if (xCreator.supportSetVisible()) { return new BasicSetVisiblePropertyPane(); - }else{ + } else { return new FormBasicPropertyPane(); } } + + private static void freshPropertyMode(XCreator xCreator) { + if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { + if (xCreator instanceof XWParameterLayout) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); + } else { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET); + } + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java index 140e294e08..aa4120d410 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java @@ -1,50 +1,48 @@ package com.fr.design.widget.ui.designer; -import com.fr.base.FRContext; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.form.ui.Radio; -import com.fr.general.FRFont; - -import javax.swing.*; -import java.awt.*; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Font; /** * @deprecated */ @Deprecated public class RadioDefinePane extends AbstractDataModify { - public RadioDefinePane(XCreator xCreator) { - super(xCreator); - iniComoponents(); - } - - private void iniComoponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - UILabel infoLabel = new UILabel(); - FRFont frFont = FRContext.getDefaultValues().getFRFont(); - infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); - infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( - "Fine-Design_Report_No_Editor_Property_Definition") + "."); - infoLabel.setHorizontalAlignment(SwingConstants.CENTER); - - this.add(infoLabel, BorderLayout.CENTER); - } - - @Override - public String title4PopupWindow() { - return "radio"; - } - - @Override - public void populateBean(Radio cellWidget) { - } - - @Override - public Radio updateBean() { - return (Radio)creator.toData(); - } + public RadioDefinePane(XCreator xCreator) { + super(xCreator); + iniComoponents(); + } + + private void iniComoponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + UILabel infoLabel = new UILabel(); + infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD)); + infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( + "Fine-Design_Report_No_Editor_Property_Definition") + "."); + infoLabel.setHorizontalAlignment(SwingConstants.CENTER); + + this.add(infoLabel, BorderLayout.CENTER); + } + + @Override + public String title4PopupWindow() { + return "radio"; + } + + @Override + public void populateBean(Radio cellWidget) { + } + + @Override + public Radio updateBean() { + return (Radio) creator.toData(); + } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 7ddff022f9..5604ef4be7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -34,7 +34,7 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { y.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); width.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); height.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size")); - this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height)); + this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height, WidgetBoundsPaneFactory.NameAttribute.WIDGET)); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java index cf909618c4..906fa6e55e 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java @@ -5,11 +5,9 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.properties.PropertyTab; -import com.fr.design.designer.properties.items.Item; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; @@ -17,25 +15,21 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileParamSettingPane; +import com.fr.design.mainframe.widget.accessibles.AccessibleMobileParamEditor; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WSortLayout; +import com.fr.form.ui.mobile.MobileParamStyle; import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; -import com.fr.general.SiteCenter; import com.fr.log.FineLoggerFactory; -import com.fr.report.ExtraReportClassManager; -import com.fr.report.fun.MobileParamStyleProvider; -import com.fr.report.mobile.DefaultMobileParamStyle; - +import com.fr.report.mobile.EmptyMobileParamStyle; import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Cursor; import java.awt.Desktop; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.net.URI; @@ -47,10 +41,9 @@ import java.util.Set; public class ParaMobileDefinePane extends MobileWidgetDefinePane { private XCreator paraCreator; private FormDesigner designer; - private Item[] items; - private UIComboBox paramLocationComboBox; private AttributeChangeListener changeListener; private MobileWidgetListPane mobileWidgetListPane; + private AccessibleMobileParamEditor mobileParamEditor; public ParaMobileDefinePane(XCreator xCreator) { this.paraCreator = xCreator; @@ -81,18 +74,15 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { // 手机属性 private UIExpandablePane getMobilePropertyPane() { - paramLocationComboBox = getParamLocationComboBox(); + mobileParamEditor = new AccessibleMobileParamEditor(new MobileParamSettingPane()); UILabel tipLabel = getTipLabel(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}}; - if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).isEmpty()) { - ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue()); - } Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Param_Style")), mobileParamEditor}, new Component[]{tipLabel, null}, }; JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); @@ -102,18 +92,6 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), 280, 20, jPanel); } - private Item[] getItems() { - Set pluginCreators = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING); - Item[] items = new Item[pluginCreators.size() + 1]; - MobileParamStyleProvider provider = new DefaultMobileParamStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); - items[0] = new Item(provider.descriptor(), provider); - int i = 1; - for (MobileParamStyleProvider mobileParamStyleProvider : pluginCreators) { - items[i++] = new Item(mobileParamStyleProvider.descriptor(), mobileParamStyleProvider); - } - return items; - } - private UILabel getTipLabel() { UILabel tipLabel = new UILabel(); StringBuilder text = new StringBuilder(); @@ -156,21 +134,6 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { return tipLabel; } - private UIComboBox getParamLocationComboBox() { - items = getItems(); - - UIComboBox paramLocationComoBox = new UIComboBox(items); - paramLocationComoBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - ((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) e.getItem()).getValue()); - } - } - }); - return paramLocationComoBox; - } - // 控件顺序 private UIExpandablePane getMobileWidgetListPane() { mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); @@ -205,27 +168,20 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane { // 设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); - int index = 0; - try { - MobileParamStyleProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider(); - String currentQueryType = provider.createJSON().getString("queryType"); - for (int i = 0; i < items.length; i++) { - String existedQueryType = ((MobileParamStyleProvider) items[i].getValue()).createJSON().getString("queryType"); - if (ComparatorUtils.equals(existedQueryType, currentQueryType)) { - index = i; - break; - } - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - paramLocationComboBox.setSelectedIndex(index); - + WParameterLayout wParameterLayout = (WParameterLayout) paraCreator.toData(); + this.mobileParamEditor.setValue(wParameterLayout.getMobileParamStyle()); } @Override public void update() { mobileWidgetListPane.updateToDesigner(); + WParameterLayout wParameterLayout = (WParameterLayout) paraCreator.toData(); + MobileParamStyle mobileParamStyle = (MobileParamStyle) this.mobileParamEditor.getValue(); + if (mobileParamStyle instanceof EmptyMobileParamStyle) { + wParameterLayout.setProvider(((EmptyMobileParamStyle) mobileParamStyle).getProvider()); + } + wParameterLayout.setMobileParamStyle(mobileParamStyle); + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); } } diff --git a/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java b/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java index 663be87581..04327d354b 100644 --- a/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java +++ b/designer-form/src/test/java/com/fr/design/mainframe/template/info/JFormProcessInfoTest.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.template.info; +import com.fr.base.background.ColorBackground; import com.fr.chart.chartattr.ChartCollection; import com.fr.form.main.Form; import com.fr.form.ui.CardSwitchButton; @@ -21,6 +22,8 @@ import com.fr.report.worksheet.FormElementCase; import org.junit.Assert; import org.junit.Test; +import java.awt.Color; + /** * Created by kerry on 2020-05-08 */ @@ -35,14 +38,36 @@ public class JFormProcessInfoTest { wFitLayout.addWidget(editor); form.setContainer(wFitLayout); JFormProcessInfo jFormProcessInfo = new JFormProcessInfo(form); - boolean result1 = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); - Assert.assertTrue(result1); + boolean result = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); + Assert.assertTrue(result); elementCase.addCellElement(new DefaultTemplateCellElement()); - boolean result2 = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); - Assert.assertTrue(result2); + result = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); + Assert.assertTrue(result); + + DefaultTemplateCellElement templateCellElement = new DefaultTemplateCellElement(); + templateCellElement.setValue(123); + + elementCase.addCellElement(templateCellElement); + result = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); + Assert.assertFalse(result); + + elementCase.removeCellElement(templateCellElement); + result = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); + Assert.assertTrue(result); + + editor.setBackground(ColorBackground.getInstance(Color.WHITE)); + result = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); + Assert.assertFalse(result); + + + editor.setBackground(null); + result = Reflect.on(jFormProcessInfo).call("hasTestECReport").get(); + Assert.assertTrue(result); } + + @Test public void testHasTestChart() { Form form = new Form(); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java index e9d5501a4f..6dff89dfd8 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.menu.KeySetUtils; @@ -12,7 +12,7 @@ public class CellAttributeAction extends CellAttributeTableAction { this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellAttr.png")); + this.setSmallIcon("/com/fr/design/images/m_format/cellAttr"); } @Override @@ -20,4 +20,4 @@ public class CellAttributeAction extends CellAttributeTableAction { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Datasource_Other_Attributes"); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java index f6b6a3123d..62f2db3125 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellExpandAttrAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.menu.KeySetUtils; @@ -11,7 +11,7 @@ public class CellExpandAttrAction extends CellAttributeTableAction{ this.setMenuKeySet(KeySetUtils.CELL_EXPAND_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); + this.setSmallIcon("/com/fr/design/images/expand/cellAttr"); } @@ -21,4 +21,4 @@ public class CellExpandAttrAction extends CellAttributeTableAction{ return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Expand_Attribute"); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java index 0736151a18..f1110187a0 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/CellWidgetAttrAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; @@ -16,7 +16,7 @@ public class CellWidgetAttrAction extends UpdateAction { this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/modified.png")); + this.setSmallIcon("/com/fr/design/images/m_format/modified"); } @Override @@ -30,4 +30,4 @@ public class CellWidgetAttrAction extends UpdateAction { super.update(); this.setEnabled(EastRegionContainerPane.getInstance().isWidgetSettingsPaneEnabled()); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java index 1aecf94d5f..d019c978b3 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/ConditionAttributesAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; @@ -18,7 +18,7 @@ public class ConditionAttributesAction extends UpdateAction { this.setMenuKeySet(KeySetUtils.CONDITION_ATTR); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/highlight.png")); + this.setSmallIcon("/com/fr/design/images/m_format/highlight"); } @Override @@ -32,4 +32,4 @@ public class ConditionAttributesAction extends UpdateAction { super.update(); this.setEnabled(EastRegionContainerPane.getInstance().isConditionAttrPaneEnabled()); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java index 1876bce350..81c7f3cfb2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/EditCellAction.java @@ -3,7 +3,8 @@ */ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ElementCaseAction; import com.fr.design.mainframe.ElementCasePane; @@ -16,10 +17,10 @@ import java.awt.event.ActionEvent; public class EditCellAction extends ElementCaseAction { public EditCellAction(ElementCasePane t) { super(t); - + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); this.setMnemonic('I'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/edit.png")); + this.setSmallIcon("/com/fr/design/images/control/edit"); } @Override @@ -31,7 +32,7 @@ public class EditCellAction extends ElementCaseAction { Toolkit.getDefaultToolkit().beep(); } } - + // TODO ALEX_SEP 这里的undo redo又是怎么回事呢? @Override public boolean executeActionReturnUndoRecordNeeded() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java index 8cb0b81fbb..4699ab886e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java @@ -33,7 +33,7 @@ public class GlobalStyleMenuDef extends MenuDef { this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setIconPath("/com/fr/design/images/m_web/style.png"); + this.setIconPath("/com/fr/design/images/m_web/style"); } protected ContainerListener getContainerListener() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java b/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java index 8a93bb227a..52f753ad05 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/UIToolbarBorderButton.java @@ -1,7 +1,8 @@ package com.fr.design.actions.cell; -import com.fr.base.BaseUtils; import com.fr.base.CellBorderStyle; + +import com.fr.base.svg.IconUtils; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; @@ -35,9 +36,9 @@ import java.awt.event.MouseEvent; /** * 这个Pane用来显示常用边框和设置自定义边框 - * + * * @author richer - * + * */ public class UIToolbarBorderButton extends UICombinationButton implements PopupHider { private EventListenerList styleChangeListenerList = new EventListenerList(); @@ -46,7 +47,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH private JPopupMenu popupWin; public UIToolbarBorderButton(Icon icon, ElementCasePane reportPane) { - super(new UIButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); + super(new UIButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup"))); this.reportPane = reportPane; } @@ -80,7 +81,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH rightButton.setToolTipText(tooltipText); } - + private void showPopupMenu() { if (popupWin != null && popupWin.isVisible()) { hidePopupMenu(); @@ -102,12 +103,12 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH return popupWin; } - + protected void leftButtonClickEvent() { UIToolbarBorderButton.this.cellBorderStyle = ((BorderIcon)getLeftButton().getIcon()).cellBorderStyle; UIToolbarBorderButton.this.fireStyleStateChanged(); } - + @Override protected void rightButtonClickEvent() { showPopupMenu(); @@ -223,7 +224,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"); } } - + /** * Adds a new StyleChangeListener */ @@ -237,9 +238,9 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH public void removeColorChangeListener(ChangeListener changeListener) { styleChangeListenerList.remove(ChangeListener.class, changeListener); } - + /** - * + * */ public void fireStyleStateChanged() { Object[] listeners = styleChangeListenerList.getListenerList(); @@ -254,7 +255,7 @@ public class UIToolbarBorderButton extends UICombinationButton implements PopupH } } } - + public boolean isCanBeNull() { return this.isCanBeNull; } diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java index 8dab29a0d2..cd5a0e788f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/AlignmentAction.java @@ -3,6 +3,8 @@ package com.fr.design.actions.cell.style; import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; + +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ButtonGroupAction; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.constants.UIConstants; @@ -21,9 +23,9 @@ import javax.swing.*; public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { private static final Icon[][] ICONS = new Icon[][]{ - {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png")}, - {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png")}, - {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}}; + {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_selected.svg")}, + {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_selected.svg")}, + {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_selected.svg")}}; private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java index e819eb6fc6..6e78baf2d0 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontBoldAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ToggleButtonUpdateAction; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.mainframe.ElementCasePane; @@ -21,7 +21,7 @@ import javax.swing.*; public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { private UIToggleButton button; protected Style style; - private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; + private final static Icon[] ICONS = {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_selected.svg")}; public ReportFontBoldAction(ElementCasePane t) { super(t); @@ -92,4 +92,4 @@ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleB } return button; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java index 1a50b3f53b..677fd0491f 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontForegroundAction.java @@ -3,9 +3,10 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.actions.core.ActionFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.style.color.UIToolbarColorButton; @@ -50,7 +51,7 @@ public class ReportFontForegroundAction extends AbstractStyleAction implements C public JComponent createToolBarComponent() { Object object = this.getValue(UIToolbarColorButton.class.getName()); if (object == null || !(object instanceof UIToolbarColorButton)) { - UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); + UIToolbarColorButton tbButton = new UIToolbarColorButton(IconUtils.readIcon("/com/fr/design/images/gui/color/foreground")); this.putValue(UIToolbarColorButton.class.getName(), tbButton); tbButton.set4Toolbar(); tbButton.setEnabled(this.isEnabled()); @@ -63,4 +64,4 @@ public class ReportFontForegroundAction extends AbstractStyleAction implements C return (JComponent) object; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java index 765e6d3199..d8f85b7c64 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontItalicAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.IconUtils; import com.fr.general.FRFont; import com.fr.design.mainframe.ElementCasePane; @@ -17,7 +17,7 @@ import javax.swing.*; */ public class ReportFontItalicAction extends ReportFontBoldAction { - private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png")}; + private final static Icon[] ICONS = {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_selected.svg")}; public ReportFontItalicAction(ElementCasePane t) { super(t); diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java index d96d22b88f..ed68f22e0c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.cell.style; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.core.StyleUtils; +import com.fr.base.svg.IconUtils; import com.fr.general.FRFont; import com.fr.design.mainframe.ElementCasePane; @@ -18,7 +18,7 @@ import javax.swing.*; */ public class ReportFontUnderlineAction extends ReportFontBoldAction { - private final static Icon[] ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_white.png")}; + private final static Icon[] ICONS = {IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline"), IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_selected.svg")}; public ReportFontUnderlineAction(ElementCasePane t) { super(t); @@ -40,4 +40,4 @@ public class ReportFontUnderlineAction extends ReportFontBoldAction { return frFont.getUnderline() != Constants.LINE_NONE; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java index 4ce5d2f70e..7d4376f3c2 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/StyleBackgroundAction.java @@ -9,9 +9,10 @@ import javax.swing.JComponent; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.background.ColorBackground; + +import com.fr.base.svg.IconUtils; import com.fr.design.actions.core.ActionFactory; import com.fr.general.ComparatorUtils; @@ -24,7 +25,7 @@ import com.fr.design.style.color.UIToolbarColorButton; public class StyleBackgroundAction extends AbstractStyleAction implements ChangeListener { public StyleBackgroundAction(ElementCasePane t) { super(t); - + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background")); } @@ -49,7 +50,7 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change return style; } - + @Override public boolean isFontStye() { return false; @@ -59,7 +60,7 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change public JComponent createToolBarComponent() { Object object = this.getValue(UIToolbarColorButton.class.getName()); if (object == null || !(object instanceof UIToolbarColorButton)) { - UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); + UIToolbarColorButton tbButton = new UIToolbarColorButton(IconUtils.readIcon("/com/fr/design/images/gui/color/background")); tbButton.set4Toolbar(); this.putValue(UIToolbarColorButton.class.getName(), tbButton); @@ -74,4 +75,4 @@ public class StyleBackgroundAction extends AbstractStyleAction implements Change return (JComponent) object; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java index c093fde0ed..954128f822 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertColumnAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.columnrow; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.CellSelectionAction; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -27,7 +27,7 @@ public class InsertColumnAction extends CellSelectionAction { this.setName(name); this.setMnemonic(INSERT_COLUMN.getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/insertColumn.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/insertColumn"); } public static final MenuKeySet INSERT_COLUMN = new MenuKeySet() { @@ -59,4 +59,4 @@ public class InsertColumnAction extends CellSelectionAction { } return true; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java index edd4dd98ee..f05a71ffe7 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/columnrow/InsertRowAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.columnrow; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.CellSelectionAction; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -26,7 +26,7 @@ public class InsertRowAction extends CellSelectionAction { super(t); this.setName(name); this.setMnemonic(INSERT_ROW.getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/insertRow.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/insertRow"); } public static final MenuKeySet INSERT_ROW = new MenuKeySet() { @@ -59,4 +59,4 @@ public class InsertRowAction extends CellSelectionAction { return true; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java index e7ca0bd961..c82bf748de 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/DeleteAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit; -import com.fr.base.BaseUtils; + import com.fr.design.actions.ElementCaseAction; import com.fr.design.mainframe.ElementCasePane; @@ -17,18 +17,17 @@ public class DeleteAction extends ElementCaseAction { */ public DeleteAction(ElementCasePane t) { super(t); - this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); //Richie:删除菜单图标 - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); + this.setSmallIcon("/com/fr/design/images/m_report/delete"); // this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)); } - + @Override public boolean executeActionReturnUndoRecordNeeded() { ElementCasePane ePane = getEditingComponent(); - + return ePane.getSelection().triggerDeleteAction(ePane); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java index 269d509174..41aba36880 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/HyperlinkAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit; -import com.fr.base.BaseUtils; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.menu.KeySetUtils; @@ -19,7 +19,7 @@ public class HyperlinkAction extends UpdateAction { this.setMenuKeySet(KeySetUtils.HYPER_LINK); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/hyperLink"); } @Override @@ -27,4 +27,4 @@ public class HyperlinkAction extends UpdateAction { EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_HYPERLINK); EastRegionContainerPane.getInstance().setWindow2PreferWidth(); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java index a0fc125dcd..0bf48382dc 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/MergeCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit.merge; -import com.fr.base.BaseUtils; + import com.fr.design.actions.ElementCaseAction; import com.fr.design.menu.KeySetUtils; import com.fr.design.mainframe.ElementCasePane; @@ -21,7 +21,7 @@ public class MergeCellAction extends ElementCaseAction { this.setMenuKeySet(KeySetUtils.MERGE_CELL); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/merge.png")); + this.setSmallIcon("/com/fr/design/images/m_edit/merge"); } /** @@ -43,4 +43,4 @@ public class MergeCellAction extends ElementCaseAction { this.setEnabled(reportPane.canMergeCell()); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java index 42e6a9f4cd..8a35b16d38 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/edit/merge/UnmergeCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.edit.merge; -import com.fr.base.BaseUtils; + import com.fr.design.actions.ElementCaseAction; import com.fr.design.menu.KeySetUtils; import com.fr.design.mainframe.ElementCasePane; @@ -20,7 +20,7 @@ public class UnmergeCellAction extends ElementCaseAction { this.setMenuKeySet(KeySetUtils.UNMERGE_CELL); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/unmerge.png")); + this.setSmallIcon("/com/fr/design/images/m_edit/unmerge"); } @Override @@ -42,4 +42,4 @@ public class UnmergeCellAction extends ElementCaseAction { return reportPane.unMergeCell(); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java index 3a368f6968..95115cd04b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewPolyReportAction.java @@ -5,7 +5,8 @@ import java.awt.event.KeyEvent; import javax.swing.KeyStroke; -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.mainframe.JPolyWorkBook; @@ -18,17 +19,17 @@ public class NewPolyReportAction extends UpdateAction { public NewPolyReportAction() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_New_Multi_Report")); this.setMnemonic('F'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/formExport.png")); + this.setSmallIcon("/com/fr/design/images/m_file/formExport"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, DEFAULT_MODIFIER)); } /** * Action触发后 - * + * * @param e 触发的事件 - * + * * @date 2015-2-5-上午11:43:13 - * + * */ public void actionPerformed(ActionEvent e) { DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JPolyWorkBook()); diff --git a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java index 6a5e8ba196..371e952baf 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/file/newReport/NewWorkBookAction.java @@ -1,6 +1,7 @@ package com.fr.design.actions.file.newReport; -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.mainframe.JWorkBook; @@ -25,7 +26,7 @@ public class NewWorkBookAction extends UpdateAction { } protected Icon icon() { - return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png"); + return IconUtils.readIcon("/com/fr/design/images/buttonicon/newcpts"); } /** diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java index a709be9378..e88366c158 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/BiasCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; + import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -30,7 +30,7 @@ public class BiasCellAction extends AbstractCellAction implements WorkBookSuppor this.setMenuKeySet(INSERT_SLOPE_LINE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/bias"); } public static final MenuKeySet INSERT_SLOPE_LINE = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java index 59e2c3e3c4..7eb36fe241 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ChartCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; + import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; @@ -29,7 +29,7 @@ public class ChartCellAction extends AbstractCellAction implements WorkBookSuppo this.setMenuKeySet(INSERT_CHART); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/chart"); } public static final MenuKeySet INSERT_CHART = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java index af0fd6bab2..498d1e00eb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/DSColumnCellAction.java @@ -1,10 +1,10 @@ package com.fr.design.actions.insert.cell; + import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.dscolumn.DSColumnPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.KeySetUtils; -import com.fr.general.IOUtils; import com.fr.report.cell.cellattr.core.group.DSColumn; public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable { @@ -22,11 +22,11 @@ public class DSColumnCellAction extends AbstractCellAction implements WorkBookSu this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/bindColumn"); } @Override public Class getCellValueClass() { return DSColumn.class; } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java index 733045b20c..4e0e858c31 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/FormulaCellAction.java @@ -4,7 +4,7 @@ package com.fr.design.actions.insert.cell; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; + import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -26,7 +26,7 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup this.setMenuKeySet(INSERT_FORMULA); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/formula"); } public static final MenuKeySet INSERT_FORMULA = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java index 402c7ead1c..ae805e0276 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; + import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -28,7 +28,7 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup this.setMenuKeySet(INSERT_TEXT); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/text"); } public static final MenuKeySet INSERT_TEXT = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java index 68b64f293a..a315aee69b 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/ImageCellAction.java @@ -3,7 +3,7 @@ */ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; + import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -29,7 +29,7 @@ public class ImageCellAction extends AbstractCellAction implements WorkBookSuppo this.setMenuKeySet(INSERT_IMAGE); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/image"); } public static final MenuKeySet INSERT_IMAGE = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java index cf266f82a6..bbdba83122 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/RichTextCellAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; + import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; @@ -25,8 +25,7 @@ public class RichTextCellAction extends AbstractCellAction implements WorkBookSu this.setMenuKeySet(INSERT_RICHTEXT); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon( - "/com/fr/design/images/m_insert/richtext.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/richtext"); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java index 0d572fe844..9fa6fabf4e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/cell/SubReportCellAction.java @@ -1,6 +1,6 @@ package com.fr.design.actions.insert.cell; -import com.fr.base.BaseUtils; + import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.MenuKeySet; import com.fr.general.ComparatorUtils; @@ -24,8 +24,7 @@ public class SubReportCellAction extends AbstractCellAction { this.setMenuKeySet(INSERT_SUB_REPORT); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon( - "/com/fr/design/images/m_insert/subReport.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/subReport"); } public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java index 1d1e07c628..67fcaae594 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java @@ -3,10 +3,10 @@ */ package com.fr.design.actions.insert.flot; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; + import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; @@ -48,7 +48,7 @@ public class ChartFloatAction extends ElementCaseAction { this.setMenuKeySet(FLOAT_INSERT_CHART); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/chart"); } public static final MenuKeySet FLOAT_INSERT_CHART = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java index 0c97ee61b8..9cbd7e8760 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java @@ -4,8 +4,8 @@ package com.fr.design.actions.insert.flot; import com.fr.base.BaseFormula; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; + import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -37,7 +37,7 @@ public class FormulaFloatAction extends ElementCaseAction { this.setMenuKeySet(FLOAT_INSERT_FORMULA); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/formula"); } public static final MenuKeySet FLOAT_INSERT_FORMULA = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java index d7f98a2122..e514c88dfb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/ImageFloatAction.java @@ -3,8 +3,8 @@ */ package com.fr.design.actions.insert.flot; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; + import com.fr.design.actions.ElementCaseAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -39,7 +39,7 @@ public class ImageFloatAction extends ElementCaseAction { this.setMenuKeySet(FLOAT_INSERT_IMAGE); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/image"); } public static final MenuKeySet FLOAT_INSERT_IMAGE = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java index 0803092bae..82aa17f2d9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java @@ -3,7 +3,6 @@ */ package com.fr.design.actions.insert.flot; -import com.fr.base.BaseUtils; import com.fr.base.DynamicUnitList; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.ElementCasePane; @@ -28,7 +27,7 @@ public class TextBoxFloatAction extends AbstractShapeAction { this.setMenuKeySet(FLOAT_INSERT_TEXT); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); + this.setSmallIcon("/com/fr/design/images/m_insert/text"); } public static final MenuKeySet FLOAT_INSERT_TEXT = new MenuKeySet() { diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java index 62a0e00ebb..fa4055807c 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportBackgroundAction.java @@ -3,9 +3,9 @@ */ package com.fr.design.actions.report; -import com.fr.base.BaseUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ReportComponentAction; -import com.fr.design.dialog.BasicDialog; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ReportComponent; import com.fr.design.menu.KeySetUtils; @@ -23,7 +23,7 @@ public class ReportBackgroundAction extends ReportComponentAction { @@ -17,7 +18,7 @@ public class ReportEngineAttrAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_FOOTER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/footer.png")); + this.setSmallIcon("/com/fr/design/images/m_report/footer"); } /** @@ -88,4 +89,4 @@ public class ReportFooterAction extends ReportComponentAction { } } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java index 5ee5c9792f..c23ed10b53 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportHeaderAction.java @@ -3,7 +3,8 @@ */ package com.fr.design.actions.report; -import com.fr.base.BaseUtils; + +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.headerfooter.EditHeaderPane; @@ -32,7 +33,7 @@ public class ReportHeaderAction extends ReportComponentAction { this.setMenuKeySet(KeySetUtils.REPORT_HEADER); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/header.png")); + this.setSmallIcon("/com/fr/design/images/m_report/header"); } /** @@ -90,4 +91,4 @@ public class ReportHeaderAction extends ReportComponentAction { } } } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java index a002f56e8a..b18c62b086 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java @@ -2,6 +2,7 @@ package com.fr.design.actions.report; import com.fr.base.PaperSize; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.JWorkBookAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; @@ -10,7 +11,6 @@ import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.MenuKeySet; import com.fr.design.report.mobile.ReportMobileAttrPane; import com.fr.file.FILE; -import com.fr.general.IOUtils; import com.fr.intelli.record.Focus; import com.fr.main.TemplateWorkBook; @@ -35,7 +35,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{ this.setMenuKeySet(REPORT_APP_ATTR); this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/mobile.png")); + this.setSmallIcon("/com/fr/design/images/m_report/mobile"); this.generateAndSetSearchText(ReportMobileAttrPane.class.getName()); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java index 2b819a3987..9177f4d307 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportPageAttrAction.java @@ -3,13 +3,13 @@ */ package com.fr.design.actions.report; +import com.fr.base.svg.IconUtils; import com.fr.design.actions.ReportComponentAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.WorkSheetDesigner; import com.fr.design.menu.KeySetUtils; import com.fr.design.report.freeze.RepeatAndFreezeSettingPane; -import com.fr.general.IOUtils; import com.fr.report.worksheet.WorkSheet; import javax.swing.SwingUtilities; @@ -27,7 +27,7 @@ public class ReportPageAttrAction extends ReportComponentAction this.add(frFontPreviewPane); this.add(editFRFontButton); this.add(this.fontScopeComboBox); - this.frFontPreviewPane.setFontObject(FRFont.getInstance()); + this.frFontPreviewPane.setFontObject(DesignUtils.getDefaultGUIFont()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 9fc0b7b521..30f7b15461 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -655,7 +655,7 @@ public abstract class ElementCasePane extends Tar return false; } Object clipObject = getClipObject(); - //如果是悬浮元素,则不允许粘贴到表单 + //如果是悬浮元素,则不允许粘贴到表单 if (!DesignerContext.getDesignerFrame().getSelectedJTemplate().accept(clipObject)) { return false; } @@ -1330,7 +1330,7 @@ public abstract class ElementCasePane extends Tar MenuDef insertFloatMenu = new MenuDef(); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setTooltip(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_T_Insert_Float")); - insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop.png"); + insertFloatMenu.setIconPath("/com/fr/design/images/m_insert/floatPop"); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this); for (int i = 0; i < actions.length; i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java index 83a1c08501..44992a84b2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -182,7 +182,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { private void addInsertFloatMenuDef(MenuDef menuDef) { // 悬浮元素菜单 MenuDef subMenuDef = new MenuDef(KeySetUtils.INSERT_FLOAT.getMenuName()); - subMenuDef.setIconPath("/com/fr/design/images/m_insert/float.png"); + subMenuDef.setIconPath("/com/fr/design/images/m_insert/float_normal.svg"); menuDef.addShortCut(subMenuDef); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, this); for (int i = 0; i < actions.length; i++) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java index 76298161f0..9b89864b67 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/FormatBrushAction.java @@ -1,7 +1,7 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.base.Style; + import com.fr.design.actions.ElementCaseAction; import com.fr.grid.selection.CellSelection; @@ -31,7 +31,7 @@ public class FormatBrushAction extends ElementCaseAction { super(t); this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_FormatBrush")); this.setMnemonic('B'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/formatBrush.png")); + this.setSmallIcon("/com/fr/design/images/m_edit/formatBrush"); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, DEFAULT_MODIFIER)); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 7fba013587..ff14d54f40 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -682,7 +682,7 @@ public class JWorkBook extends JTemplate { .addShortCut(new PageExcelExportAction(this), new ExcelExportAction(this), new PageToSheetExcelExportAction(this)); // Export - MenuDef MenuDef exportMenuDef = new MenuDef(KeySetUtils.EXPORT.getMenuName()); - exportMenuDef.setIconPath("/com/fr/design/images/m_file/export.png"); + exportMenuDef.setIconPath("/com/fr/design/images/m_file/export"); addShortCut(exportMenuDef, excelExportMenuDef); return exportMenuDef; } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index ead1cf2f1e..7b6fbff6f8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -24,6 +24,8 @@ import javax.swing.UIManager; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; + +import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; @@ -57,14 +59,14 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse private static final Color LINE_COLOR = new Color(0xababab); - private static final Icon ADD_WORK_SHEET = IOUtils.readIcon("com/fr/base/images/oem/addworksheet.png"); - protected static final Icon ADD_POLY_SHEET = IOUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png"); - private static final Icon WORK_SHEET_ICON = IOUtils.readIcon("com/fr/base/images/oem/worksheet.png"); - private static final Icon POLY_SHEET_ICON = IOUtils.readIcon("com/fr/design/images/sheet/polysheet.png"); - private static final Icon LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_normal@1x.png"); - private static final Icon RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_normal@1x.png"); - private static final Icon DISABLED_LEFT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/left_hover@1x.png"); - private static final Icon DISABLED_RIGHT_ICON = IOUtils.readIcon("com/fr/design/images/sheet/right_hover@1x.png"); + private static final Icon ADD_WORK_SHEET = IconUtils.readIcon("com/fr/base/images/oem/add_worksheet"); + protected static final Icon ADD_POLY_SHEET = IconUtils.readIcon("com/fr/design/images/sheet/add_polysheet"); + private static final Icon WORK_SHEET_ICON = IconUtils.readIcon("com/fr/base/images/oem/worksheet"); + private static final Icon POLY_SHEET_ICON = IconUtils.readIcon("com/fr/design/images/sheet/polysheet"); + private static final Icon LEFT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/pre_page"); + private static final Icon RIGHT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/next_page"); + private static final Icon DISABLED_LEFT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/pre_page_disabled.svg"); + private static final Icon DISABLED_RIGHT_ICON = IconUtils.readIcon("com/fr/design/images/sheet/next_page_disabled.svg"); private static final int NUM = 10; private static final int ICON_SEP_DISTANCE = 8; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 4cebe741ca..3946c9cbc2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.alphafine; import com.fr.base.extension.FileExtension; +import com.fr.design.utils.DesignUtils; import com.fr.general.CloudCenter; import java.awt.Color; @@ -73,15 +74,15 @@ public class AlphaFineConstants { public static final String HIGH_LIGHT_COLOR = "rgb(51,148,240)"; - public static final Font SMALL_FONT = new Font("Song_TypeFace", 0, 10); + public static final Font SMALL_FONT = DesignUtils.getDefaultGUIFont().applySize(10); - public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12); + public static final Font MEDIUM_FONT = DesignUtils.getDefaultGUIFont().applySize(12); public static final Font MEDIUM_FONT_ANOTHER = new Font("HiraginoSansGB-W3", 0, 12); - public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18); + public static final Font LARGE_FONT = DesignUtils.getDefaultGUIFont().applySize(18); - public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20); + public static final Font GREATER_FONT = DesignUtils.getDefaultGUIFont().applySize(20); public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/"; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java index 738ecf4efd..29a8c1e082 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -3,10 +3,14 @@ package com.fr.design.mainframe.alphafine.preview; import com.bulenkov.iconloader.IconLoader; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.general.FRFont; +import com.fr.design.utils.DesignUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; /** * Created by XiaXiang on 2017/8/14. @@ -23,7 +27,7 @@ public class NoResultPane extends JPanel { image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0)); UILabel description = new UILabel(title); description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14)); + description.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); description.setHorizontalAlignment(SwingConstants.CENTER); add(image, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index a902d0e00c..31a1b18ed9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -11,15 +11,14 @@ import com.fr.design.mainframe.alphafine.search.manager.fun.AlphaFineSearchProvi import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; -import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.basic.version.Version; +import com.fr.plugin.basic.version.VersionIntervalType; import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; -import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java index 82f8a84842..b37c048e92 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java @@ -8,16 +8,24 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; 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.GUICoreUtils; -import com.fr.general.*; +import com.fr.general.CloudCenter; +import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; -import javax.swing.*; - -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -37,7 +45,7 @@ public class BBSLoginDialog extends UIDialog { private static final int DIALOG_WIDTH = 400; private static final int DIALOG_HEIGHT = 200; - private static final Font DEFAULT_FONT = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, 0, 14); + private static final Font DEFAULT_FONT = DesignUtils.getDefaultGUIFont().applySize(14); private static final int TIME_OUT = 10000; private static final int BUTTON_WIDTH = 90; diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java index 4062e0dbe5..f1897e148e 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java @@ -12,6 +12,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; 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.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.IOUtils; @@ -32,7 +33,6 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -59,7 +59,6 @@ public class ReportColumnsPane extends BasicPane{ com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Columns_Repeat_Column") }; - private static final String FONT_NAME = "simsun"; private static final int FONT_SIZE = 14; private UIButtonGroup onOffButtonGroup; @@ -109,7 +108,7 @@ public class ReportColumnsPane extends BasicPane{ onOffButtonGroup.addActionListener(onOffListener); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns")); - FRFont uiLableFont = FRFont.getInstance(FONT_NAME, Font.PLAIN, FONT_SIZE); + FRFont uiLableFont = DesignUtils.getDefaultGUIFont().applySize(FONT_SIZE); uiLabel.setFont(uiLableFont); uiLabel.setHorizontalAlignment(SwingConstants.CENTER); int uiLabelWidth = GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns"), uiLableFont); diff --git a/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java b/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java index fa19c38f82..26acc77513 100644 --- a/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java @@ -1,12 +1,12 @@ package com.fr.design.report; import com.fr.base.BaseFormula; -import com.fr.base.FRContext; import com.fr.base.Style; import com.fr.design.cell.editor.RichTextToolBar; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; @@ -37,7 +37,7 @@ public class RichTextPane extends BasicPane { //12号字体有个奇怪的bug, 字体下部分渲染会截断一部分, 换其他字体没问题, 字体改大小也没问题. //直接弄个jtexarea放到jframe里也有同样问题, 不知道是字体渲染bug还是jdk问题 - public static final FRFont DEFAUL_FONT = FRContext.getDefaultValues().getFRFont().applySize(13); + public static final FRFont DEFAUL_FONT = DesignUtils.getDefaultGUIFont().applySize(13); private RichTextEditingPane textPane; //用于populate时动态更新按钮 diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java index 8b520f3183..5bd91d038d 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/BasicWidgetPropertySettingPane.java @@ -4,6 +4,7 @@ import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.dialog.BasicPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NoneWidget; @@ -22,19 +23,19 @@ public class BasicWidgetPropertySettingPane extends BasicPane { private UICheckBox enableCheckBox; private UICheckBox visibleCheckBox; private Widget widget; - + public BasicWidgetPropertySettingPane() { this.setLayout(new BorderLayout()); - enableCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Enabled"), true); + enableCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Enabled"), true); enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); - visibleCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); + visibleCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Form_Widget_Visible"), true); visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); widgetNameComboBox = new ParameterTreeComboBox(); widgetNameComboBox.refreshTree(); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form-Widget_Name")), widgetNameComboBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Widget_Name")), widgetNameComboBox}, new Component[]{enableCheckBox, null}, new Component[]{visibleCheckBox, null}, }; @@ -47,12 +48,12 @@ public class BasicWidgetPropertySettingPane extends BasicPane { this.add(pane, BorderLayout.CENTER); } - + @Override protected String title4PopupWindow() { return "property"; } - + public void populate(Widget widget){ //:jackie if(widget instanceof NoneWidget){ @@ -67,7 +68,7 @@ public class BasicWidgetPropertySettingPane extends BasicPane { visibleCheckBox.setSelected(this.widget.isVisible()); } } - + public void update(Widget widget){ if(this.widget == null) return ; diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java index 5de31c110c..7239a39c1c 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java @@ -1,48 +1,46 @@ package com.fr.design.widget.ui; -import com.fr.base.FRContext; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.form.ui.Radio; -import com.fr.general.FRFont; - -import javax.swing.*; -import java.awt.*; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Font; /** * @deprecated */ @Deprecated public class RadioDefinePane extends AbstractDataModify { - public RadioDefinePane() { - this.iniComoponents(); - } - - private void iniComoponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - UILabel infoLabel = new UILabel(); - FRFont frFont = FRContext.getDefaultValues().getFRFont(); - infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); - infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( - "Fine-Design_Report_No_Editor_Property_Definition") + "."); - infoLabel.setHorizontalAlignment(SwingConstants.CENTER); - - this.add(infoLabel, BorderLayout.CENTER); - } - - @Override - protected String title4PopupWindow() { - return "radio"; - } - - @Override - public void populateBean(Radio cellWidget) { - } - - @Override - public Radio updateBean() { - return new Radio(); - } + public RadioDefinePane() { + this.iniComoponents(); + } + + private void iniComoponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + UILabel infoLabel = new UILabel(); + infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD)); + infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( + "Fine-Design_Report_No_Editor_Property_Definition") + "."); + infoLabel.setHorizontalAlignment(SwingConstants.CENTER); + + this.add(infoLabel, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return "radio"; + } + + @Override + public void populateBean(Radio cellWidget) { + } + + @Override + public Radio updateBean() { + return new Radio(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java index a9e5ee3d03..455bf0b125 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java @@ -1,14 +1,13 @@ package com.fr.design.widget.ui; -import com.fr.base.FRContext; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.form.ui.NameWidget; -import com.fr.general.FRFont; - -import javax.swing.*; -import java.awt.*; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Font; public class UserEditorDefinePane extends AbstractDataModify { private NameWidget nWidget; @@ -20,8 +19,7 @@ public class UserEditorDefinePane extends AbstractDataModify { this.setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel infoLabel = new UILabel(); - FRFont frFont = FRContext.getDefaultValues().getFRFont(); - infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); + infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD)); infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( "Fine-Design_Report_Widget_User_Defined_Editor") + "."); infoLabel.setHorizontalAlignment(SwingConstants.CENTER); diff --git a/designer-realize/src/main/java/com/fr/grid/GridUI.java b/designer-realize/src/main/java/com/fr/grid/GridUI.java index 5f5476511b..711ecee832 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridUI.java +++ b/designer-realize/src/main/java/com/fr/grid/GridUI.java @@ -49,6 +49,7 @@ import com.fr.stable.script.CalculatorUtils; import com.fr.stable.unit.FU; import com.fr.stable.AssistUtils; import com.fr.third.antlr.ANTLRException; +import com.fr.third.guava.collect.HashMultimap; import javax.swing.JComponent; import javax.swing.UIManager; @@ -73,6 +74,7 @@ import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Objects; public class GridUI extends ComponentUI { @@ -91,6 +93,7 @@ public class GridUI extends ComponentUI { protected List paintCellElementList = new ArrayList(); protected List paintCellElementRectangleList = new ArrayList(); protected List paginateLineList = new ArrayList(); // 分页线 + protected HashMultimap mergeCellElementTable = HashMultimap.create(); // 为了画白色的背景. protected static Background WHITE_Backgorund = ColorBackground.getInstance(Color.WHITE); // CellElementPainter @@ -247,7 +250,7 @@ public class GridUI extends ComponentUI { - reportSettings.getFooterHeight().toPixD(resolution); } - private void paintGridLine(Graphics g, Grid grid, double realWidth, double realHeight, + private void paintGridLine(Graphics g, Grid grid, TemplateElementCase report, double realWidth, double realHeight, int resolution) { Graphics2D g2d = (Graphics2D) g; @@ -257,22 +260,51 @@ public class GridUI extends ComponentUI { // 分页线 paginateLineList.clear(); + // 合并单元格 + mergeCellElementTable.clear(); boolean isShowVerticalPaginateLine = grid.getPaginateLineShowType() == Grid.MULTIPLE_PAGINATE_LINE; boolean isShowHorizontalPaginateLine = grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE; - new DrawVerticalLineHelper(grid.getVerticalBeginValue(), verticalEndValue, - grid.isShowGridLine(), isShowVerticalPaginateLine, rowHeightList, paperPaintHeight, - paginateLineList, realWidth, resolution).iterateStart2End(g2d); + Iterator cells = report.intersect(grid.getHorizontalBeginValue(), grid.getVerticalBeginValue(), + horizontalEndValue - grid.getHorizontalBeginValue(), verticalEndValue - grid.getVerticalBeginValue()); + while (cells.hasNext()) { + TemplateCellElement cellElement = (TemplateCellElement) cells.next(); + if (cellElement == null) { + continue; + } + int columnSpan = cellElement.getColumnSpan(); + int rowSpan = cellElement.getRowSpan(); + if (columnSpan > 1 || rowSpan > 1) { + for (int c = 0; c < columnSpan - 1; c++) { + for (int r = 0; r < rowSpan; r++) { + mergeCellElementTable.put(CellPosition.value(cellElement.getRow() + r, cellElement.getColumn() + c), CellPosition.RIGHT); + } + } + for (int r = 0; r < rowSpan - 1; r++) { + for (int c = 0; c < columnSpan; c++) { + mergeCellElementTable.put(CellPosition.value(cellElement.getRow() + r, cellElement.getColumn() + c), CellPosition.BOTTOM); + } + } + } + } + GridRange gridRange = GridRange.range(grid.getHorizontalBeginValue(), horizontalEndValue, grid.getVerticalBeginValue(), verticalEndValue) + .rangeList(rowHeightList, columnWidthList) + .realSize(realWidth, realHeight); + + new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), + isShowVerticalPaginateLine, paperPaintHeight, + paginateLineList, resolution).iterateStart2End(g2d); - new DrawHorizontalLineHelper(grid.getHorizontalBeginValue(), horizontalEndValue, - grid.isShowGridLine(), isShowHorizontalPaginateLine, columnWidthList, paperPaintWidth, - paginateLineList, realHeight, resolution).iterateStart2End(g2d); + new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), + isShowHorizontalPaginateLine, paperPaintWidth, + paginateLineList, resolution).iterateStart2End(g2d); } /** * 最后处理 */ + @Override public void finalize() { try { super.finalize(); @@ -285,80 +317,34 @@ public class GridUI extends ComponentUI { } private static abstract class DrawLineHelper { - private int startIndex; - private int endIndex; + protected GridRange gridRange; - private boolean showGridLine; - private boolean showPaginateLine; + protected boolean showGridLine; + protected boolean showPaginateLine; - private DynamicUnitList sizeList; - private double paperPaintSize; + protected double paperPaintSize; - private List paginateLineList; + protected List paginateLineList; Line2D tmpLine2D = new Line2D.Double(0, 0, 0, 0); - private int resolution; + protected int resolution; - private static final double THRESHOLD = 1.0E-4D; + protected static final double THRESHOLD = 1.0E-4D; - DrawLineHelper(int startIndex, int endIndex, boolean showGridLine, - boolean showPaginateLine, DynamicUnitList sizeList, double paperPaintSize, + DrawLineHelper(GridRange gridRange, boolean showGridLine, + boolean showPaginateLine, double paperPaintSize, List paginateLineList, int resolution) { - this.startIndex = startIndex; - this.endIndex = endIndex; + this.gridRange = gridRange; this.showGridLine = showGridLine; this.showPaginateLine = showPaginateLine; - this.sizeList = sizeList; this.paperPaintSize = paperPaintSize; this.paginateLineList = paginateLineList; this.resolution = resolution; } - protected void iterateStart2End(Graphics2D g2d) { - float tmpSize = 0, paperSumSize = 0, sumSize = 0; - for (int i = 0; i <= endIndex; i++) { - // denny: 开始 - if (i == 0) { - i = startIndex; - - // denny: 增加从0到Grid左边被hide的列宽 - for (int k = 0; k < startIndex; k++) { - tmpSize = sizeList.get(k).toPixF(resolution); - - paperSumSize += tmpSize; - if (paperSumSize >= paperPaintSize) { - paperSumSize = tmpSize; - } - } - } - - // adjust height. - tmpSize = sizeList.get(i).toPixF(resolution); - paperSumSize += tmpSize; - - if (showGridLine) {// paint line. - setLine2D((int) sumSize); - g2d.draw(tmpLine2D); - } - - // paint paper margin line. - if (showPaginateLine && paperSumSize - paperPaintSize > THRESHOLD) { - paginateLineList.add(getPaginateLine2D((int) sumSize)); - paperSumSize = tmpSize; - } - - sumSize += tmpSize; - } - - // paint 最后一个横线.. - if (showGridLine) { - drawLastLine(g2d, (int) sumSize); - } - } - - protected abstract void setLine2D(int sumSize); + protected abstract void iterateStart2End(Graphics2D g2d); protected abstract Line2D.Double getPaginateLine2D(int sumSize); @@ -366,14 +352,12 @@ public class GridUI extends ComponentUI { } private class DrawVerticalLineHelper extends DrawLineHelper { - private double realWidth; - DrawVerticalLineHelper(int startIndex, int endIndex, boolean showGridLine, - boolean showPaginateLine, DynamicUnitList unitSizeList, double paperPaintSize, - List paginateLineList, double realWidth, int resolution) { - super(startIndex, endIndex, showGridLine, showPaginateLine, unitSizeList, + DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, + boolean showPaginateLine, double paperPaintSize, + List paginateLineList, int resolution) { + super(gridRange, showGridLine, showPaginateLine, paperPaintSize, paginateLineList, resolution); - this.realWidth = realWidth; } @Override @@ -382,25 +366,58 @@ public class GridUI extends ComponentUI { } @Override - protected void setLine2D(int sumHeight) { - tmpLine2D.setLine(0, sumHeight, realWidth, sumHeight); + protected void drawLastLine(Graphics2D g2d, int sumHeight) { + GraphHelper.drawLine(g2d, 0, sumHeight, gridRange.realWidth, sumHeight); } @Override - protected void drawLastLine(Graphics2D g2d, int sumHeight) { - GraphHelper.drawLine(g2d, 0, sumHeight, realWidth, sumHeight); + protected void iterateStart2End(Graphics2D g2d) { + float rowHeight, paperYAxisSumSize = 0, yAxisSumSize = 0; + for (int i = 0; i <= gridRange.yEndIndex; i++) { + if (i == 0) { + i = gridRange.yBeginIndex; + for (int k = 0; k < gridRange.yBeginIndex; k++) { + rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution); + + paperYAxisSumSize += rowHeight; + if (paperYAxisSumSize >= paperPaintSize) { + paperYAxisSumSize = rowHeight; + } + } + } + rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution); + paperYAxisSumSize += rowHeight; + if (showGridLine) { + float columnWidth, xAxisSumSize = 0; + for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) { + columnWidth = gridRange.columnWidthList.get(j).toPixF(resolution); + if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) { + tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize + columnWidth, yAxisSumSize); + g2d.draw(tmpLine2D); + } + xAxisSumSize += columnWidth; + } + } + if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) { + paginateLineList.add(getPaginateLine2D((int) yAxisSumSize)); + paperYAxisSumSize = rowHeight; + } + yAxisSumSize += rowHeight; + } + // paint 最后一个横线.. + if (showGridLine) { + drawLastLine(g2d, (int) yAxisSumSize); + } } } private class DrawHorizontalLineHelper extends DrawLineHelper { - private double realHeight; - DrawHorizontalLineHelper(int startIndex, int endIndex, boolean showGridLine, - boolean showPaginateLine, DynamicUnitList unitSizeList, double paperPaintSize, - List paginateLineList, double realHeight, int resolution) { - super(startIndex, endIndex, showGridLine, showPaginateLine, unitSizeList, + DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, + boolean showPaginateLine, double paperPaintSize, + List paginateLineList, int resolution) { + super(gridRange, showGridLine, showPaginateLine, paperPaintSize, paginateLineList, resolution); - this.realHeight = realHeight; } @Override @@ -409,13 +426,47 @@ public class GridUI extends ComponentUI { } @Override - protected void setLine2D(int sumWidth) { - tmpLine2D.setLine(sumWidth, 0, sumWidth, realHeight); + protected void drawLastLine(Graphics2D g2d, int sumWidth) { + GraphHelper.drawLine(g2d, sumWidth, 0, sumWidth, gridRange.realHeight); } @Override - protected void drawLastLine(Graphics2D g2d, int sumWidth) { - GraphHelper.drawLine(g2d, sumWidth, 0, sumWidth, realHeight); + protected void iterateStart2End(Graphics2D g2d) { + float columnWidth, paperXAxisSumSize = 0, xAxisSumSize = 0; + for (int i = 0; i <= gridRange.xEndIndex; i++) { + if (i == 0) { + i = gridRange.xBeginIndex; + for (int k = 0; k < gridRange.xBeginIndex; k++) { + columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution); + paperXAxisSumSize += columnWidth; + if (paperXAxisSumSize >= paperPaintSize) { + paperXAxisSumSize = columnWidth; + } + } + } + columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution); + paperXAxisSumSize += columnWidth; + if (showGridLine) { + float rowHeight, yAxisSumSize = 0; + for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) { + rowHeight = gridRange.rowHeightList.get(j).toPixF(resolution); + if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) { + tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize, yAxisSumSize + rowHeight); + g2d.draw(tmpLine2D); + } + yAxisSumSize += rowHeight; + } + } + if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) { + paginateLineList.add(getPaginateLine2D((int) xAxisSumSize)); + paperXAxisSumSize = columnWidth; + } + xAxisSumSize += columnWidth; + } + // paint 最后一个横线.. + if (showGridLine) { + drawLastLine(g2d, (int) xAxisSumSize); + } } } @@ -482,18 +533,6 @@ public class GridUI extends ComponentUI { // peter:tmpRectangle2D_3只是一个临时的Rectangle2D,由于后面不少地方需要用到这个矩形 this.cell_back_rect.setRect(0, 0, this.tmpRectangle.getWidth() - 1, this.tmpRectangle.getHeight() - 1.5); - // peter:对于合并的单元格,需要先白色的背景来清除背景. - if (tmpCellElement.getColumnSpan() > 1 || tmpCellElement.getRowSpan() > 1) { - // REPORT-23492 要看下是否设置了纸张背景 如果设置了按照背景来画 - ReportSettingsProvider reportSettings = getReportSettings(report); - Background currentBackground = reportSettings.getBackground(); - if (currentBackground != null) { - currentBackground.paint(g2d, this.cell_back_rect); - } else { - WHITE_Backgorund.paint(g2d, this.cell_back_rect); - } - //daniel:上面这里就有问题了啊....报表的背景在这个之前画的 会覆盖报表背景....不过只是设计器中看到预览浏览没问题 - } // peter:将这个元素添加到需要paint的元素列表当中去,留着画边框线.. paintCellElementList.add(tmpCellElement); paintCellElementRectangleList.add(this.tmpRectangle.clone()); @@ -1093,8 +1132,7 @@ public class GridUI extends ComponentUI { this.paintBackground(g2d, grid, elementCase, resolution); // 画Grid Line - this.paintGridLine(g2d, grid, realWidth, realHeight, resolution); - + this.paintGridLine(g2d, grid, elementCase, realWidth, realHeight, resolution); // peter:添上线程的支持,有时候,paint元素的时候,可能会有元素被删除了. // 需要先清除画Border需要的元素. paintCellElementList.clear(); @@ -1277,4 +1315,101 @@ public class GridUI extends ComponentUI { paginateLineList.add(new Line2D.Double(0, sumHeight, width, sumHeight)); } } + + /** + * 描述单元格位置的POJO + */ + private static class CellPosition { + public final static int TOP = 0; + public static final int LEFT = 1; + public final static int BOTTOM = 2; + public static final int RIGHT = 4; + public int x; + public int y; + + public CellPosition(int x, int y) { + this.x = x; + this.y = y; + } + + public static CellPosition value(int x, int y) { + return new CellPosition(x, y); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CellPosition that = (CellPosition) o; + return x == that.x && y == that.y; + } + + @Override + public int hashCode() { + return Objects.hash(x, y); + } + } + + /** + * 描述表格范围的POJO + * x轴为水平方向,对应的宽度表为列宽列表 + * y轴为垂直方向,对应的宽度表为行高列表 + */ + private static class GridRange { + + public int xBeginIndex; + public int xEndIndex; + public int yBeginIndex; + public int yEndIndex; + double realWidth; + double realHeight; + /** + * 行高列表,对应y方向线段 + */ + public DynamicUnitList rowHeightList; + + /** + * 列宽列表,对应x方向线段 + */ + public DynamicUnitList columnWidthList; + + public GridRange(int xBeginIndex, int xEndIndex, int yBeginIndex, int yEndIndex) { + this.xBeginIndex = xBeginIndex; + this.xEndIndex = xEndIndex; + this.yBeginIndex = yBeginIndex; + this.yEndIndex = yEndIndex; + } + + /** + * 设置行高列宽列表 + * + * @param rowHeightList 行高列表 + * @param columnWidthList 列宽列表 + */ + public GridRange rangeList(DynamicUnitList rowHeightList, DynamicUnitList columnWidthList) { + this.rowHeightList = rowHeightList; + this.columnWidthList = columnWidthList; + return this; + } + + /** + * 设置表格真实宽高 + * + * @param realWidth 宽度 + * @param realHeight 高度 + */ + public GridRange realSize(double realWidth, double realHeight) { + this.realWidth = realWidth; + this.realHeight = realHeight; + return this; + } + + public static GridRange range(int xBeginIndex, int xEndIndex, int yBeginIndex, int yEndIndex) { + return new GridRange(xBeginIndex, xEndIndex, yBeginIndex, yEndIndex); + } + } } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index 4c90be3c5a..7f5d86ef1f 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -573,6 +573,7 @@ public class CellSelection extends Selection { for (int i = 0; i < removeElementList.size(); i++) { CellElement element = removeElementList.get(i); element.setValue(null); + setDefault(element); } break; @@ -588,6 +589,17 @@ public class CellSelection extends Selection { return true; } + //设置显示内容为default + private void setDefault(CellElement element) { + CellGUIAttr cellGUIAttr = element.getCellGUIAttr(); + if (cellGUIAttr != null) { + cellGUIAttr.setShowAsDefault(true); + cellGUIAttr.setShowAsHTML(false); + cellGUIAttr.setShowAsDownload(false); + cellGUIAttr.setShowAsImage(false); + } + } + @Override public int[] getSelectedColumns() { diff --git a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java index 908e235a60..1acda00e68 100644 --- a/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java +++ b/designer-realize/src/main/java/com/fr/poly/actions/DeleteBlockAction.java @@ -8,7 +8,7 @@ import java.awt.event.KeyEvent; import javax.swing.KeyStroke; -import com.fr.base.BaseUtils; + import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.TemplateComponentActionInterface; import com.fr.design.actions.UpdateAction; @@ -26,7 +26,7 @@ public class DeleteBlockAction extends UpdateAction implements TemplateComponent this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Edit_Delete")); this.setMnemonic('D'); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); + this.setSmallIcon("/com/fr/design/images/m_report/delete"); } @Override diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index cfc0e9adb5..dc6b0490fd 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -4,6 +4,7 @@ import com.fr.base.BaseFormula; import com.fr.design.actions.columnrow.DSColumnConditionAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.DSColumnCellAction; +import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dscolumn.DSColumnAdvancedPane; @@ -259,7 +260,7 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setEditingComponent(tc); } //丢掉icon,修改按钮名称为编辑 - condition.setSmallIcon(null); + condition.setSmallIcon(UIConstants.EMPTY_ICON); condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); conditionUIButton = new UIButton(condition); Component[][] components = new Component[][]{ diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java index 438d440f65..efddda0adf 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -2,12 +2,14 @@ package com.fr.quickeditor.cellquick; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.RichTextCellAction; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.quickeditor.CellQuickEditor; +import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -47,7 +49,7 @@ public class CellRichTextEditor extends CellQuickEditor { protected void refreshDetails() { RichTextCellAction subReportCellAction = new RichTextCellAction(tc); subReportCellAction.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - subReportCellAction.setSmallIcon(null); + subReportCellAction.setSmallIcon(UIConstants.EMPTY_ICON); richTextButton.setAction(subReportCellAction); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java index 3f29b592a9..d44380a5b8 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -2,12 +2,14 @@ package com.fr.quickeditor.cellquick; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.SubReportCellAction; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.quickeditor.CellQuickEditor; +import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -43,7 +45,7 @@ public class CellSubReportEditor extends CellQuickEditor { protected void refreshDetails() { SubReportCellAction subReportCellAction = new SubReportCellAction(tc); subReportCellAction.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - subReportCellAction.setSmallIcon(null); + subReportCellAction.setSmallIcon(UIConstants.EMPTY_ICON); subReportButton.setAction(subReportCellAction); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java index 3e3211259b..5dc4140883 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java @@ -8,6 +8,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.DesignUtils; import com.fr.quickeditor.FloatQuickEditor; import com.fr.report.ReportHelper; import com.fr.stable.StringUtils; @@ -20,7 +21,6 @@ import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -77,7 +77,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor { } private void initTextField() { - stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12)); + stringTextField.setFont(DesignUtils.getDefaultGUIFont()); stringTextField.setOpaque(true); stringTextField.setLineWrap(true); stringTextField.setWrapStyleWord(true); diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index ff3aadd36b..a9a1ccbd15 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -1,6 +1,6 @@ package com.fr.start; -import com.fr.base.BaseUtils; + import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.file.WebPreviewUtils; @@ -222,7 +222,7 @@ public class MainDesigner extends BaseDesigner { private void createSaveButton() { - saveButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/save.png")); + saveButton = new UIButton("/com/fr/design/images/buttonicon/save.png", true); saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); saveButton.set4ToolbarButton(); saveButton.addActionListener(new ActionListener() { @@ -238,7 +238,7 @@ public class MainDesigner extends BaseDesigner { private void createUndoButton() { - undo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/undo.png")); + undo = new UIButton("/com/fr/design/images/buttonicon/undo.png", true); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); undo.set4ToolbarButton(); undo.addActionListener(new ActionListener() { @@ -253,7 +253,7 @@ public class MainDesigner extends BaseDesigner { } private void createRedoButton() { - redo = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/redo.png")); + redo = new UIButton("/com/fr/design/images/buttonicon/redo.png", true); redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); redo.set4ToolbarButton(); redo.addActionListener(new ActionListener() { diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java index 3f1aa26636..495252e38f 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java @@ -99,6 +99,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.CellImagePainter; import com.fr.stable.ArrayUtils; +import com.fr.stable.EssentialUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.bridge.StableFactory; import com.fr.stable.os.support.OSBasedAction; @@ -191,8 +192,8 @@ public class DesignerActivator extends Activator { justStartModules4Designer(); CalculatorProviderContext.setValueConverter(valueConverter()); - GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer(); - GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); + EssentialUtils.Object_Tokenizer = startXMLReadObjectTokenizer(); + EssentialUtils.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); addAdapterForPlate(); designerRegister(); diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java index 1eeb5a6a3a..ebea410bba 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java @@ -1,5 +1,6 @@ package com.fr.start.module; +import com.fr.design.PluginClassRefreshManager; import com.fr.module.Activator; import com.fr.start.DesignerInitial; @@ -15,6 +16,7 @@ public class DesignerInitActivator extends Activator { @Override public void start() { + PluginClassRefreshManager.getInstance().load(); DesignerInitial.init(findSingleton(StartupArgs.class).get()); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java index f5231eafeb..7154de982f 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java @@ -1,6 +1,7 @@ package com.fr.start.module; import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.PluginClassRefreshManager; import com.fr.design.file.HistoryTemplateListCache; import com.fr.event.Event; import com.fr.event.Listener; @@ -50,7 +51,7 @@ public class DesignerWorkspaceActivator extends Activator { @Override public void on(Event event, Workspace workspace) { - + PluginClassRefreshManager.getInstance().removePluginListener(); HistoryTemplateListCache.getInstance().stash(); } }); @@ -62,6 +63,7 @@ public class DesignerWorkspaceActivator extends Activator { public void on(Event event, Workspace workspace) { HistoryTemplateListCache.getInstance().load(); + PluginClassRefreshManager.getInstance().addPluginListener(); } }); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java index 420f0f2b65..a7ef4f108a 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java @@ -87,6 +87,16 @@ public class DesignerWorkspaceProvider extends Activator { EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(); } } + pluginErrorRemind(); + } + + private void pluginErrorRemind() { + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null aNull) { + EnvChangeEntrance.getInstance().pluginErrorRemind(); + } + }); } @Override diff --git a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java index 0c38d731e7..138e7df2bb 100644 --- a/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java +++ b/designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java @@ -46,11 +46,13 @@ public class ImagePreLoader { private String[] preLoadImages = { "com/fr/design/images/m_file/formExport.png", - "com/fr/base/images/oem/cpt.png", + "com/fr/design/images/m_file/formExport_normal.svg", + "com/fr/base/images/oem/cpt.xpng", "com/fr/design/images/data/store_procedure.png", "/com/fr/design/images/m_file/preview.png", "com/fr/base/images/cell/blank.gif", "com/fr/design/images/data/dock/serverdatabase.png", + "com/fr/design/images/data/dock/serverdatabase_normal.svg", "/com/fr/design/images/data/dock/serverclasstabledata.png", "/com/fr/design/images/data/dock/serverdatatable.png", "/com/fr/design/images/data/file.png", @@ -73,6 +75,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/run24.png", "com/fr/design/images/buttonicon/runs.png", "com/fr/design/mainframe/alphafine/images/smallsearch.png", + "com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg", "com/fr/design/images/buttonicon/pageb24.png", "com/fr/design/images/buttonicon/writeb24.png", "com/fr/design/images/buttonicon/anab24.png", @@ -81,6 +84,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/anas.png", "com/fr/design/images/buttonicon/refresh.png", "com/fr/design/images/gui/color/foreground.png", + "com/fr/design/images/gui/color/foreground_normal.svg", "com/fr/design/images/buttonicon/history.png", "com/fr/design/images/m_file/close.png", "com/fr/design/images/m_file/edit.png", @@ -94,8 +98,14 @@ public class ImagePreLoader { "com/fr/design/images/m_report/close_over.png", "com/fr/design/images/m_report/close_press.png", "com/fr/design/images/buttonicon/save.png", + "com/fr/design/images/buttonicon/save_normal.svg", + "com/fr/design/images/buttonicon/save_disabled.svg", "com/fr/design/images/buttonicon/undo.png", + "com/fr/design/images/buttonicon/undo_normal.svg", + "com/fr/design/images/buttonicon/undo_disabled.svg", "com/fr/design/images/buttonicon/redo.png", + "com/fr/design/images/buttonicon/redo_normal.svg", + "com/fr/design/images/buttonicon/redo_disabled.svg", "com/fr/design/images/buttonicon/additicon_grey.png", "com/fr/design/images/buttonicon/addicon.png", "com/fr/design/images/buttonicon/list_normal.png", @@ -104,6 +114,7 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/mouseoverclose icon.png", "com/fr/design/images/buttonicon/pressclose icon.png", "com/fr/design/images/buttonicon/open.png", + "com/fr/design/images/buttonicon/open_normal.svg", "com/fr/design/images/m_file/view_folder.png", "com/fr/design/images/data/source/rename.png", "com/fr/design/images/buttonicon/minus.png", @@ -117,6 +128,7 @@ public class ImagePreLoader { "com/fr/design/images/control/tab/remove.png", "com/fr/design/images/m_file/preview.png", "com/fr/design/images/m_web/connection.png", + "com/fr/design/images/m_web/connection_normal.svg", "com/fr/design/images/control/addPopup.png", "com/fr/design/images/buttonicon/propertiestab/cellelement_normal.png", "com/fr/design/images/buttonicon/propertiestab/cellattr_normal.png", @@ -130,15 +142,19 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/propertiestab/cellelement_selected.png", "com/fr/design/images/log/selectedall.png", "com/fr/design/images/m_edit/copy.png", + "com/fr/design/images/m_edit/copy_normal.svg", + "com/fr/design/images/m_edit/copy_disabled.svg", "com/fr/design/images/log/clear.png", "com/fr/design/images/log/clear.png", "com/fr/design/images/log/selectedall.png", "com/fr/design/images/log/setting.png", "com/fr/design/images/buttonicon/newcpts.png", + "com/fr/design/images/buttonicon/newcpts_normal.svg", "com/fr/base/images/oem/logo.png", "com/fr/design/images/data/bind/localconnect.png", "com/fr/design/images/gui/tab_add_normal.png", "com/fr/design/images/m_help/demo.png", + "com/fr/design/images/m_help/demo_normal.svg", "com/fr/design/images/gui/tab_add_hover.png", "com/fr/design/images/gui/tab_add_click.png", "com/fr/design/images/gui/tab_delete.png", @@ -149,6 +165,17 @@ public class ImagePreLoader { "com/fr/design/images/update.png", "com/fr/design/images/need.png", "com/fr/design/images/bug.png", + "/com/fr/design/images/bbs/video_normal.svg", + "/com/fr/design/images/bbs/help_normal.svg", + "/com/fr/design/images/bbs/bbs_normal.svg", + "/com/fr/design/images/bbs/question_normal.svg", + "/com/fr/design/images/bbs/solution_normal.svg", + "/com/fr/design/images/bbs/bug_normal.svg", + "/com/fr/design/images/bbs/need_normal.svg", + "/com/fr/design/images/bbs/center_normal.svg", + "/com/fr/design/images/bbs/sign_normal.svg", + "/com/fr/design/images/bbs/facebook_normal.svg", + "/com/fr/design/images/update/update_new_normal.svg", "com/fr/design/images/signature.png", "com/fr/design/images/m_file/switch.png", "com/fr/design/images/gui/blank.gif", @@ -167,13 +194,17 @@ public class ImagePreLoader { "com/fr/design/images/gui/frm.png", "com/fr/design/images/gui/cht.png", "com/fr/design/images/chart/ChartType.png", + "com/fr/design/images/chart/ChartType_normal.svg", "com/fr/van/chart/map/images/mapData.png", + "com/fr/van/chart/map/images/mapData_normal.svg", "com/fr/design/images/buttonicon/add.png", "com/fr/base/images/cell/control/remove.png", "com/fr/design/images/control/up.png", "com/fr/design/images/control/down.png", "com/fr/design/images/control/sortAsc.png", "com/fr/design/images/m_insert/formula.png", + "com/fr/design/images/m_insert/formula_normal.svg", + "com/fr/design/images/m_insert/formula_disabled.svg", "com/fr/design/images/calender/year_reduce.png", "com/fr/design/images/calender/year_reduce_hover.png", "com/fr/design/images/calender/year_reduce_click.png", @@ -189,27 +220,43 @@ public class ImagePreLoader { "com/fr/design/images/buttonicon/type_string.png", "com/fr/base/images/cell/control/add.png", "com/fr/design/images/expand/cellAttr.gif", + "com/fr/design/images/expand/cellAttr_normal.svg", "com/fr/design/images/expand/none16x16.png", "com/fr/design/images/expand/asc.png", "com/fr/design/images/expand/des.png", "com/fr/design/images/form/toolbar/pie.png", "com/fr/design/images/buttonicon/widget/date_16.png", + "com/fr/design/images/buttonicon/widget/date_16_normal.svg", "com/fr/design/images/buttonicon/widget/tree_16.png", + "com/fr/design/images/buttonicon/widget/tree_16_normal.svg", "com/fr/design/images/buttonicon/widget/comboboxtree.png", + "com/fr/design/images/buttonicon/widget/comboboxtree16_normal.svg", "com/fr/design/images/buttonicon/widget/checkbox_group_16.png", + "com/fr/design/images/buttonicon/widget/checkbox_group_16_normal.svg", "com/fr/design/images/buttonicon/widget/button_group_16.png", + "com/fr/design/images/buttonicon/widget/button_group_16_normal.svg", "com/fr/design/images/buttonicon/widget/number_field_16.png", + "com/fr/design/images/buttonicon/widget/number_field_16_normal.svg", "com/fr/design/images/buttonicon/widget/label_16.png", + "com/fr/design/images/buttonicon/widget/label_16_normal.svg", "com/fr/web/images/form/resources/button_16.png", "com/fr/design/images/buttonicon/widget/button_16.png", + "com/fr/design/images/buttonicon/widget/button_16_normal.svg", "com/fr/design/images/buttonicon/widget/files_up.png", + "com/fr/design/images/buttonicon/widget/files_up_normal.svg", "com/fr/design/images/buttonicon/widget/combo_box_16.png", + "com/fr/design/images/buttonicon/widget/combo_box_16_normal.svg", "com/fr/design/images/buttonicon/widget/combo_check_16.png", + "com/fr/design/images/buttonicon/widget/combo_check_16_normal.svg", "com/fr/design/images/buttonicon/widget/check_box_16.png", + "com/fr/design/images/buttonicon/widget/check_box_16_normal.svg", "com/fr/web/images/form/resources/list_16.png", "com/fr/design/images/buttonicon/widget/text_field_16.png", + "com/fr/design/images/buttonicon/widget/text_field_16_normal.svg", "com/fr/design/images/buttonicon/widget/text_area_16.png", + "com/fr/design/images/buttonicon/widget/text_area_16_normal.svg", "com/fr/design/images/buttonicon/widget/password_field_16.png", + "com/fr/design/images/buttonicon/widget/password_field_16_normal.svg", "com/fr/web/images/form/resources/iframe_16.png", "com/fr/design/images/form/toolbar/column.png", "com/fr/design/images/form/toolbar/bar.png", @@ -233,8 +280,14 @@ public class ImagePreLoader { "com/fr/web/images/form/forbid.png", "com/fr/web/images/form/resources/layout_absolute.png", "com/fr/design/images/m_edit/cut.png", + "com/fr/design/images/m_edit/cut_normal.svg", + "com/fr/design/images/m_edit/cut_disabled.svg", "com/fr/design/images/m_edit/paste.png", + "com/fr/design/images/m_edit/paste_normal.svg", + "com/fr/design/images/m_edit/paste_disabled.svg", "com/fr/design/images/m_report/delete.png", + "com/fr/design/images/m_report/delete_normal.svg", + "com/fr/design/images/m_report/delete_disabled.svg", "com/fr/design/images/toolbarbtn/parametersetting.png", "com/fr/base/images/oem/addworksheet.png", "com/fr/design/images/sheet/addpolysheet.png", @@ -249,6 +302,7 @@ public class ImagePreLoader { "com/fr/design/images/data/source/normalUp20.png", "com/fr/design/images/data/source/hoverUp20.png", "com/fr/design/images/m_edit/formatBrush.png", + "com/fr/design/images/m_edit/formatBrush_normal.svg", "com/fr/design/images/expand/none16x16_selected@1x.png", "com/fr/design/images/expand/vertical.png", "com/fr/design/images/expand/vertical_selected@1x.png", @@ -258,8 +312,14 @@ public class ImagePreLoader { "com/fr/design/images/expand/asc_selected.png", "com/fr/design/images/expand/des_selected.png", "com/fr/design/images/m_format/cellstyle/bold.png", + "com/fr/design/images/m_format/cellstyle/bold_normal.svg", + "com/fr/design/images/m_format/cellstyle/bold_selected.svg", "com/fr/design/images/m_format/cellstyle/italic.png", + "com/fr/design/images/m_format/cellstyle/italic_normal.svg", + "com/fr/design/images/m_format/cellstyle/italic_selected.svg", "com/fr/design/images/m_format/cellstyle/underline.png", + "com/fr/design/images/m_format/cellstyle/underline_normal.svg", + "com/fr/design/images/m_format/cellstyle/underline_selected.svg", "com/fr/design/images/m_format/cellstyle/strikethrough.png", "com/fr/design/images/m_format/cellstyle/shadow.png", "com/fr/design/images/m_format/cellstyle/sup.png", @@ -282,10 +342,16 @@ public class ImagePreLoader { "com/fr/design/images/m_format/cellstyle/in_white.png", "com/fr/design/images/m_format/cellstyle/h_left_normal.png", "com/fr/design/images/m_format/cellstyle/h_left_normal_white.png", + "com/fr/design/images/m_format/cellstyle/h_left_normal.svg", + "com/fr/design/images/m_format/cellstyle/h_left_selected.svg", "com/fr/design/images/m_format/cellstyle/h_center_normal.png", "com/fr/design/images/m_format/cellstyle/h_center_normal_white.png", + "com/fr/design/images/m_format/cellstyle/h_center_normal.svg", + "com/fr/design/images/m_format/cellstyle/h_center_selected.svg", "com/fr/design/images/m_format/cellstyle/h_right_normal.png", "com/fr/design/images/m_format/cellstyle/h_right_normal_white.png", + "com/fr/design/images/m_format/cellstyle/h_right_normal.svg", + "com/fr/design/images/m_format/cellstyle/h_right_selected.svg", "com/fr/design/images/m_format/cellstyle/h_s_normal.png", "com/fr/design/images/m_format/cellstyle/h_s_normal_white.png", "com/fr/design/images/m_format/cellstyle/defaultAlignment.png", @@ -299,8 +365,12 @@ public class ImagePreLoader { "com/fr/design/images/control/refresh.png", "com/fr/design/images/toolbarbtn/close.png", "com/fr/design/images/buttonicon/new_form3.png", + "com/fr/design/images/buttonicon/new_form3_normal.svg", "com/fr/design/images/m_file/save.png", + "com/fr/design/images/m_file/save_normal.svg", + "com/fr/design/images/m_file/save_disabled.svg", "com/fr/design/images/m_file/saveAs.png", + "com/fr/design/images/m_file/saveAs_normal.svg", "com/fr/design/images/m_edit/undo.png", "com/fr/design/images/m_edit/redo.png", "com/fr/design/images/m_file/excel.png", @@ -311,61 +381,104 @@ public class ImagePreLoader { "com/fr/design/images/m_file/text.png", "com/fr/design/images/m_web/datasource.png", "com/fr/design/images/m_report/webreportattribute.png", + "com/fr/design/images/m_report/webreportattribute_normal.svg", "com/fr/design/images/m_report/exportAttr.png", "com/fr/design/images/m_report/p.png", + "com/fr/design/images/m_report/p_normal.svg", "com/fr/design/images/m_report/mobile.png", + "com/fr/design/images/m_report/mobile_normal.svg", "com/fr/web/images/print.png", + "com/fr/web/images/print_normal.svg", "com/fr/design/images/m_report/watermark.png", + "com/fr/design/images/m_report/watermark_normal.svg", "com/fr/design/images/m_file/pageSetup.png", - "com/fr/design/images/m_file/repeatAndFrozen.png", + "com/fr/design/images/m_file/pageSetup_normal.svg", + "com/fr/design/images/m_file/repeatAndFrozen_normal.svg", "com/fr/design/images/m_report/header.png", + "com/fr/design/images/m_report/header_normal.svg", "com/fr/design/images/m_report/footer.png", + "com/fr/design/images/m_report/footer_normal.svg", "com/fr/design/images/m_report/background.png", + "com/fr/design/images/m_report/background_normal.svg", "com/fr/design/images/m_report/reportWriteAttr.png", + "com/fr/design/images/m_report/reportWriteAttr_normal.svg", "com/fr/design/images/m_report/linearAttr.png", + "com/fr/design/images/m_report/linearAttr_normal.svg", "com/fr/design/images/m_report/reportEngineAttr.png", + "com/fr/design/images/m_report/reportEngineAttr_normal.svg", "com/fr/design/images/m_report/allow_authority_edit.png", + "com/fr/design/images/m_report/allow_authority_edit_normal.svg", "com/fr/design/images/m_insert/bindColumn.png", + "com/fr/design/images/m_insert/bindColumn_normal.svg", + "com/fr/design/images/m_insert/bindColumn_disabled.svg", "com/fr/design/images/m_insert/text.png", + "com/fr/design/images/m_insert/text_normal.svg", + "com/fr/design/images/m_insert/text_disabled.svg", "com/fr/design/images/m_insert/richtext.png", + "com/fr/design/images/m_insert/richtext_normal.svg", + "com/fr/design/images/m_insert/richtext_disabled.svg", "com/fr/design/images/m_insert/chart.png", + "com/fr/design/images/m_insert/chart_normal.svg", + "com/fr/design/images/m_insert/chart_disabled.svg", "com/fr/design/images/m_insert/image.png", + "com/fr/design/images/m_insert/image_normal.svg", + "com/fr/design/images/m_insert/image_disabled.svg", "com/fr/design/images/m_insert/bias.png", + "/com/fr/design/images/m_insert/bias_normal.svg", + "/com/fr/design/images/m_insert/bias_disabled.svg", "com/fr/design/images/arrow/arrow_up.png", "com/fr/design/images/m_insert/subReport.png", + "com/fr/design/images/m_insert/subReport_normal.svg", + "com/fr/design/images/m_insert/subReport_disabled.svg", "com/fr/design/images/arrow/arrow_down.png", "com/fr/design/images/toolbarbtn/toolbarbtnsetting.png", "com/fr/design/images/control/addPopup.png", "com/fr/design/images/toolbarbtn/toolbarbtnclear.png", "com/fr/design/images/m_insert/insertRow.png", + "com/fr/design/images/m_insert/insertRow_normal.svg", "com/fr/design/images/m_insert/insertColumn.png", + "com/fr/design/images/m_insert/insertColumn_normal.svg", "com/fr/design/images/m_format/modified.png", + "com/fr/design/images/m_format/modified_normal.svg", "com/fr/design/images/m_format/highlight.png", + "com/fr/design/images/m_format/highlight_normal.svg", "com/fr/web/images/form/resources/preview_16.png", + "com/fr/web/images/form/resources/preview_16_normal.svg", "com/fr/web/images/save.png", "com/fr/design/images/m_insert/hyperLink.png", + "com/fr/design/images/m_insert/hyperLink_normal.svg", "com/fr/web/images/flashPrint.png", "com/fr/design/images/m_edit/merge.png", + "com/fr/design/images/m_edit/merge_normal.svg", + "com/fr/design/images/m_edit/merge_disabled.svg", "com/fr/web/images/appletPrint.png", "com/fr/design/images/m_edit/unmerge.png", + "com/fr/design/images/m_edit/unmerge_normal.svg", + "com/fr/design/images/m_edit/unmerge_disabled.svg", "com/fr/web/images/pdf.png", "com/fr/design/images/m_format/cellAttr.png", + "com/fr/design/images/m_format/cellAttr_normal.svg", "com/fr/web/images/pdfPrint.png", "com/fr/web/images/serverPrint.png", "com/fr/web/images/email.png", "com/fr/web/images/preview.png", "com/fr/design/images/server/platform_16_16.png", + "com/fr/design/images/server/platform_16_16_normal.svg", "com/fr/design/images/data/user_widget.png", "com/fr/design/images/server/plugin.png", + "com/fr/design/images/server/plugin_normal.svg", "com/fr/web/images/excel.png", "com/fr/design/images/m_web/function.png", + "com/fr/design/images/m_web/function_normal.svg", "com/fr/web/images/word.png", "com/fr/web/images/pageSetup.png", "com/fr/web/images/export.png", "com/fr/design/images/m_web/edit.png", + "com/fr/design/images/m_web/edit_normal.svg", "com/fr/web/images/pageNumber.png", "com/fr/web/images/first.png", "com/fr/design/images/m_web/style.png", + "com/fr/design/images/m_web/style_normal.svg", "com/fr/web/images/last.png", "com/fr/web/images/previous.png", "com/fr/web/images/next.png", @@ -375,22 +488,29 @@ public class ImagePreLoader { "com/fr/web/images/verify.png", "com/fr/web/images/save2.png", "com/fr/design/images/m_file/export.png", + "com/fr/design/images/m_file/export_normal.svg", "com/fr/web/images/showValue.png", "com/fr/web/images/pianyi.png", "com/fr/web/images/writeOffline.png", "com/fr/web/images/edit/stash.png", "com/fr/web/images/edit/clearstash.png", "com/fr/design/images/m_insert/cell.png", + "com/fr/design/images/m_insert/cell_normal.svg", "com/fr/design/images/m_insert/float.png", "com/fr/design/images/gui/color/background.png", + "com/fr/design/images/gui/color/background_normal.svg", "com/fr/design/images/m_format/cell.png", "com/fr/design/images/data/source/dataDictionary.png", + "com/fr/design/images/data/source/dataDictionary_normal.svg", "com/fr/design/images/m_format/cellstyle/bold_white.png", "com/fr/design/images/m_format/cellstyle/italic_white.png", "com/fr/design/images/m_format/cellstyle/underline_white.png", "com/fr/design/images/m_format/noboder.png", + "com/fr/design/images/m_format/noborder_normal.svg", "com/fr/design/images/gui/popup.gif", + "com/fr/design/images/gui/popup_normal.svg", "com/fr/design/images/m_insert/floatPop.png", + "com/fr/design/images/m_insert/floatPop_normal.svg", "com/fr/web/images/platform/demo.png", "com/fr/base/images/dialog/pagesetup/down.png", "com/fr/base/images/dialog/pagesetup/over.png", @@ -406,6 +526,17 @@ public class ImagePreLoader { "com/fr/design/images/condition/unBracket.png", "com/fr/design/images/buttonicon/user_search_normal.png", "com/fr/design/remote/images/icon_Member_normal@1x.png", - "/com/fr/design/images/buttonicon/add.png" + "/com/fr/design/images/buttonicon/add.png", + "com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/remove_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/rename_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg", + "com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg", + "com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg" }; } diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg new file mode 100644 index 0000000000..673548dfaf --- /dev/null +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/smallsearch_normal.svg @@ -0,0 +1,7 @@ + + + icon_搜索_normal + + + + diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java b/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java new file mode 100644 index 0000000000..f4c9c1b7a2 --- /dev/null +++ b/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java @@ -0,0 +1,25 @@ +package com.fr.design.mainframe.alphafine.search.manager.impl; + + +import com.fr.invoke.Reflect; +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2020/12/17 + */ +public class PluginSearchManagerTest { + + @Test + public void testIsCompatibleCurrentEnv() { + + Assert.assertFalse(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "~9.0").get()); + Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "9.0").get()); + Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "9~").get()); + Assert.assertTrue(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "10").get()); + Assert.assertFalse(Reflect.on(PluginSearchManager.class).call("isCompatibleCurrentEnv", "11").get()); + } + +} diff --git a/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java b/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java new file mode 100644 index 0000000000..d058ee8de9 --- /dev/null +++ b/designer-realize/src/test/java/com/fr/start/module/DesignerWorkspaceProviderTest.java @@ -0,0 +1,50 @@ +package com.fr.start.module; + +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.event.EventDispatcher; +import com.fr.invoke.Reflect; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2021/1/7 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({WorkContext.class}) +public class DesignerWorkspaceProviderTest { + + @Test + public void testPluginErrorRemind() { + + try { + Workspace workspace = EasyMock.mock(Workspace.class); + EasyMock.expect(workspace.isLocal()).andReturn(false).once(); + PowerMock.mockStatic(WorkContext.class); + EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); + + EasyMock.replay(workspace); + PowerMock.replayAll(); + + DesignerWorkspaceProvider provider = new DesignerWorkspaceProvider(); + Reflect.on(provider).call("pluginErrorRemind"); + EventDispatcher.fire(DesignerLaunchStatus.STARTUP_COMPLETE); + + EasyMock.verify(workspace); + PowerMock.verifyAll(); + + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + + + } +}