diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index dcc588fa35..7370d4d55d 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -14,6 +14,7 @@ import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; @@ -23,6 +24,8 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.general.xml.GeneralXMLTools; import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; @@ -688,7 +691,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * @return 是否加入产品改良 */ public boolean isJoinProductImprove() { - return joinProductImprove; + LocaleMark localeMark = LocaleCenter.getMark(ProductImproveMark.class); + return localeMark.getValue() && this.joinProductImprove; } /** 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 8e9fd5b32e..f3cb21bc70 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,15 +1,16 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; 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.CloudCenter; -import com.fr.general.GeneralContext; +import com.fr.general.IOUtils; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import javax.swing.*; import java.awt.event.ActionEvent; -import java.util.Locale; + public class VideoAction extends UpdateAction { @@ -19,21 +20,15 @@ public class VideoAction extends UpdateAction this.setMenuKeySet(VIDEO); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/bbs/video.png")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/bbs/video.png")); } @Override public void actionPerformed(ActionEvent arg0) { - String url; - if (GeneralContext.getLocale().equals(Locale.US)) { - url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); - } else { - url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); - } - BrowseUtils.browser(url); - + LocaleMark localeMark = LocaleCenter.getMark(VideoMark.class); + BrowseUtils.browser(localeMark.getValue()); } public static final MenuKeySet VIDEO = new MenuKeySet() { @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 447e6652b8..2a856f159d 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -8,6 +8,7 @@ import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.DialogActionListener; import com.fr.design.editor.editor.IntegerEditor; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; @@ -31,6 +32,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; @@ -79,6 +81,7 @@ public class PreferencePane extends BasicPane { private static final int CACHING_DEFAULT = 5; private static final int CACHING_GAP = 5; private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230; + private static final int OFFSET_HEIGHT = 50; private static final String TYPE = "pressed"; private static final String DISPLAY_TYPE = "+"; @@ -133,7 +136,6 @@ public class PreferencePane extends BasicPane { private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; private UIDictionaryComboBox languageComboBox; private IntegerEditor portEditor; - private UITextField jdkHomeTextField; private UICheckBox oracleSpace; private UISpinner cachingTemplateSpinner; private UICheckBox openDebugComboBox; @@ -232,8 +234,8 @@ public class PreferencePane extends BasicPane { enableVcsPanel.add(vcsEnableCheckBox); enableVcsPanel.add(remindVcsLabel); JPanel intervalPanel = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); - UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); - UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); + final UILabel everyLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Every")); + final UILabel delayLabel = new UILabel(Toolkit.i18nText("Fine-Design_Vcs_Delay")); intervalPanel.add(useIntervalCheckBox); intervalPanel.add(everyLabel); intervalPanel.add(saveIntervalEditor); @@ -246,10 +248,14 @@ public class PreferencePane extends BasicPane { saveCommitCheckBox.setEnabled(true); saveIntervalEditor.setEnabled(true); useIntervalCheckBox.setEnabled(true); + everyLabel.setEnabled(true); + delayLabel.setEnabled(true); } else { saveCommitCheckBox.setEnabled(false); saveIntervalEditor.setEnabled(false); useIntervalCheckBox.setEnabled(false); + everyLabel.setEnabled(false); + delayLabel.setEnabled(false); } } }); @@ -389,10 +395,10 @@ public class PreferencePane extends BasicPane { new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Pagination_Line_Color")); - gridLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); + gridLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); gridLineColorTBButton.setEnabled(this.isEnabled()); - paginationLineColorTBButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); + paginationLineColorTBButton = new UIColorButton(IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); paginationLineColorTBButton.setEnabled(this.isEnabled()); JPanel leftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -786,4 +792,9 @@ public class PreferencePane extends BasicPane { } }); } + + @Override + public BasicDialog showWindow(Window window, DialogActionListener l) { + return showWindowWithCustomSize(window, l, new Dimension(BasicDialog.DEFAULT.width, this.getPreferredSize().height + OFFSET_HEIGHT)); + } } diff --git a/designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java b/designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java new file mode 100644 index 0000000000..d62a84f786 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java @@ -0,0 +1,34 @@ +package com.fr.design.constants; + +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Null; + +/** + * 设计器启动事件类型 + * + * @author vito + * @date 2019-06-18 + */ +public enum DesignerLaunchStatus implements Event { + /** + * 初始化环境完成 + */ + WORKSPACE_INIT_COMPLETE, + + /** + * 设计器模块启动完成 + */ + DESIGNER_INIT_COMPLETE; + + private static DesignerLaunchStatus status; + + public static DesignerLaunchStatus getStatus() { + return status; + } + + public static void setStatus(DesignerLaunchStatus state) { + status = state; + EventDispatcher.fire(DesignerLaunchStatus.getStatus()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index 9ec67adb64..413a0f00d1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -32,6 +32,7 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -331,7 +332,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha DBUtils.refreshDatabase(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Refresh_Database"), + JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"), JOptionPane.INFORMATION_MESSAGE); } @@ -343,7 +344,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; Object userObj = node.getUserObject(); if (userObj instanceof String) { - this.setIcon(BaseUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); + this.setIcon(IOUtils.readIcon("com/fr/design/images/m_insert/expandCell.gif")); } else if (userObj instanceof TableProcedure) { this.setText(((TableProcedure) userObj).getName()); } diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java index c01daff70e..4809e536c6 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java @@ -40,21 +40,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - - dg.setBasicDialogSize(BasicDialog.DEFAULT); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.DEFAULT); } /** @@ -100,21 +86,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - - dg.setBasicDialogSize(BasicDialog.CHART); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.CHART); } /** @@ -125,20 +97,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showSmallWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.SMALL); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.SMALL); } /** @@ -149,20 +108,7 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showMediumWindow(Window window, DialogActionListener l) { - BasicDialog dg; - if (window instanceof Frame) { - dg = new DIALOG((Frame) window); - } else { - dg = new DIALOG((Dialog) window); - } - - if (l != null) { - dg.addDialogActionListener(l); - } - dg.setBasicDialogSize(BasicDialog.MEDIUM); - GUICoreUtils.centerWindow(dg); - dg.setResizable(false); - return dg; + return showWindowWithCustomSize(window, l, BasicDialog.MEDIUM); } /** @@ -173,6 +119,17 @@ public abstract class BasicPane extends JPanel { * @return 对话框 */ public BasicDialog showLargeWindow(Window window, DialogActionListener l) { + return showWindowWithCustomSize(window, l, BasicDialog.LARGE); + } + + /** + * 以自定义的宽高显示窗口 + * @param window 窗口 + * @param l 对话框监听器 + * @param dimension 自定义尺寸 + * @return 对话框 + */ + protected BasicDialog showWindowWithCustomSize(Window window, DialogActionListener l, Dimension dimension) { BasicDialog dg; if (window instanceof Frame) { dg = new DIALOG((Frame) window); @@ -183,7 +140,7 @@ public abstract class BasicPane extends JPanel { if (l != null) { dg.addDialogActionListener(l); } - dg.setBasicDialogSize(BasicDialog.LARGE); + dg.setBasicDialogSize(dimension); GUICoreUtils.centerWindow(dg); dg.setResizable(false); return dg; @@ -350,6 +307,7 @@ public abstract class BasicPane extends JPanel { } } + @Override public void setVisible(boolean isVisible) { this.nameTextField.setVisible(isVisible); this.Name.setVisible(isVisible); @@ -377,6 +335,7 @@ public abstract class BasicPane extends JPanel { * * @throws Exception 异常 */ + @Override public void checkValid() throws Exception { super.checkValid(); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java index 36183f1078..19823d8b42 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/ImgChooseWrapper.java @@ -7,7 +7,6 @@ import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewer; import com.fr.design.utils.ImageUtils; import com.fr.general.ImageWithSuffix; - import com.fr.stable.CoreGraphHelper; import com.fr.stable.StringUtils; @@ -16,6 +15,7 @@ import javax.swing.SwingWorker; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Image; +import java.awt.image.BufferedImage; import java.io.File; /** @@ -103,7 +103,7 @@ public class ImgChooseWrapper { if (imageFileChooser.isCheckSelected()) { imageWithSuffix = ImageUtils.defaultImageCompWithSuff(selectedFile); } else { - Image image = BaseUtils.readImage(selectedFile.getPath()); + BufferedImage image = BaseUtils.readImage(selectedFile.getPath()); String type = ImageUtils.getImageType(selectedFile); imageWithSuffix = new ImageWithSuffix(image, type); } diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java new file mode 100644 index 0000000000..b7a05975cb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java @@ -0,0 +1,31 @@ +package com.fr.design.locale.impl; + +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class ProductImproveMark implements LocaleMark { + + private Map map = new HashMap<>(); + + public ProductImproveMark() { + map.put(Locale.CHINA, true); + map.put(Locale.TAIWAN, false); + map.put(Locale.US, false); + map.put(Locale.KOREA, false); + map.put(Locale.JAPAN, false); + } + + @Override + public Boolean getValue() { + Boolean result = map.get(GeneralContext.getLocale()); + return result == null ? false : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java new file mode 100644 index 0000000000..790108978f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java @@ -0,0 +1,35 @@ +package com.fr.design.locale.impl; + +import com.fr.design.DesignerEnvManager; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class SplashMark implements LocaleMark { + + private Map map = new HashMap(); + private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; + private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.gif"; + private static final String SPLASH_JP_PATH = "/com/fr/design/images/splash_10_jp.gif"; + + public SplashMark() { + map.put(Locale.CHINA, SPLASH_PATH); + map.put(Locale.KOREA, SPLASH_EN_PATH); + map.put(Locale.JAPAN, SPLASH_JP_PATH); + map.put(Locale.US, SPLASH_EN_PATH); + map.put(Locale.TAIWAN, SPLASH_EN_PATH); + } + + @Override + public String getValue() { + String result = map.get(DesignerEnvManager.getEnvManager().getLanguage()); + return result == null ? SPLASH_EN_PATH : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java new file mode 100644 index 0000000000..61de25937c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java @@ -0,0 +1,44 @@ +package com.fr.design.locale.impl; + +import com.fr.general.locale.SupportLocale; + +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; + +/** + * 某些国际化环境支持的操作 + * 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码 + * 后续有新的不同语言下的差异操作 添加新的枚举 + * @author Hades + * @date 2019/6/24 + */ +public enum SupportLocaleImpl implements SupportLocale { + + /** + * 社区菜单支持的国际化环境 + */ + COMMUNITY { + @Override + public Set support() { + Set set = new HashSet(); + set.add(Locale.CHINA); + set.add(Locale.TAIWAN); + return set; + } + }, + + /** + * Facebook支持的国际化环境 + */ + FACEBOOK { + @Override + public Set support() { + Set set = new HashSet(); + set.add(Locale.TAIWAN); + return set; + } + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java new file mode 100644 index 0000000000..3739c49f6a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java @@ -0,0 +1,36 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class UserInfoMark implements LocaleMark { + + private Map map = new HashMap<>(); + private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); + private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); + private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); + private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); + + public UserInfoMark() { + map.put(Locale.CHINA, CN_LOGIN_HTML); + map.put(Locale.KOREA, EN_LOGIN_HTML); + map.put(Locale.JAPAN, JP_LOGIN_HTML); + map.put(Locale.US, EN_LOGIN_HTML); + map.put(Locale.TAIWAN, TW_LOGIN_HTML); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? EN_LOGIN_HTML : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java new file mode 100644 index 0000000000..2071faba3f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java @@ -0,0 +1,35 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class VideoMark implements LocaleMark { + + private Map map = new HashMap<>(); + private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); + private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); + private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw"); + + public VideoMark() { + map.put(Locale.CHINA, VIDEO_CN); + map.put(Locale.KOREA, VIDEO_EN); + map.put(Locale.JAPAN, VIDEO_EN); + map.put(Locale.US, VIDEO_EN); + map.put(Locale.TAIWAN, VIDEO_TW); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? VIDEO_EN : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java index 7f794b708b..afa6fc9077 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java @@ -114,7 +114,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane { @Override public Background updateBean() { - ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImage(), suffix); + ImageFileBackground imageBackground = new ImageFileBackground(previewPane.getImageWithSuffix()); imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(imageLayoutPane.getSelectedItem()); imageBackground.setLayout(imageStyle.getImageLayout()); return imageBackground; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java index 6b9882397f..24b3ebfc42 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImagePreviewPane.java @@ -304,7 +304,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre @Override public void setImage(Image image) { - setImageWithSuffix(image == null ? null : new ImageWithSuffix(image)); + setImageWithSuffix(ImageWithSuffix.build(image)); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 7e0d6b3597..8a739f54f1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -58,6 +58,9 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleAction; +import com.fr.general.locale.LocaleCenter; +import com.fr.design.locale.impl.SupportLocaleImpl; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; @@ -240,7 +243,7 @@ public abstract class ToolBarMenuDock { public MenuDef[] menus(final ToolBarMenuDockPlus plus) { //删除之前创建的插件菜单监听 clearPluginListeners(); - java.util.List menuList = new java.util.ArrayList(); + final java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -258,10 +261,13 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) { - // 添加社区菜单 - addCommunityMenuDef(menuList); - } + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + addCommunityMenuDef(menuList); + } + }, SupportLocaleImpl.COMMUNITY); + // 添加全部UpdateAction到actionmanager中 addAllUpdateActionsToList(menuList); @@ -532,7 +538,7 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { - java.util.List shortCuts = new ArrayList(); + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); @@ -543,9 +549,12 @@ public abstract class ToolBarMenuDock { shortCuts.add(new CusDemandAction()); shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); - if (Locale.TAIWAN.equals(GeneralContext.getLocale())) { - shortCuts.add(new FacebookFansAction()); - } + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new FacebookFansAction()); + } + }, SupportLocaleImpl.FACEBOOK); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java b/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java index 0e5cbe4635..bc4f3f41cc 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/style/background/image/ImagePreviewPane.java @@ -63,7 +63,7 @@ public class ImagePreviewPane extends JComponent implements Scrollable, ImagePre @Override public void setImage(Image image) { - setImageWithSuffix(image == null ? null : new ImageWithSuffix(image)); + setImageWithSuffix(ImageWithSuffix.build(image)); } diff --git a/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java b/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java index 33f928a466..389b9981e9 100644 --- a/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/ImageUtils.java @@ -1,6 +1,7 @@ package com.fr.design.utils; import com.fr.base.BaseUtils; +import com.fr.base.frpx.util.ImageIOHelper; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.ImageWithSuffix; @@ -70,7 +71,7 @@ public class ImageUtils { return null; } BufferedImage srcImg = BaseUtils.readImage(imageFile.getPath()); - Image desImg = srcImg; + BufferedImage desImg = srcImg; try { if (canbeCompressedToJPEG(imageFile)) { @@ -186,11 +187,23 @@ public class ImageUtils { /** * 获取图片类型 + * 先根据ImageReader获取,ImageReader获取不到就拿后缀 * * @param imageFile 图片文件 * @return 图片类型(JPEG, PNG, GIF) */ public static String getImageType(File imageFile) { + String imageType = getImageTypeByImageReader(imageFile); + return StringUtils.EMPTY.equals(imageType) ? ImageIOHelper.getSuffix(imageFile) : imageType; + } + + /** + * 根据ImageReader获取图片类型 + * + * @param imageFile 图片文件 + * @return 图片类型(JPEG, PNG, GIF) + */ + public static String getImageTypeByImageReader(File imageFile) { try { ImageInputStream iis = ImageIO.createImageInputStream(imageFile); Iterator iter = ImageIO.getImageReaders(iis); @@ -226,7 +239,7 @@ public class ImageUtils { * @param scale 缩放比例。比例大于1时为放大,小于1大于0为缩小 * @param opacityCompatible 是否处理背景透明 */ - public static Image scale(BufferedImage srcImg, float scale, boolean opacityCompatible) { + public static BufferedImage scale(BufferedImage srcImg, float scale, boolean opacityCompatible) { if (scale < 0) { // 自动修正负数 scale = -scale; @@ -234,7 +247,7 @@ public class ImageUtils { int width = mul(Integer.toString(srcImg.getWidth(null)), Float.toString(scale)).intValue(); // 得到源图宽 int height = mul(Integer.toString(srcImg.getHeight(null)), Float.toString(scale)).intValue(); // 得到源图长 - return scale(srcImg, width, height, opacityCompatible); + return CoreGraphHelper.toBufferedImage(scale(srcImg, width, height, opacityCompatible)); } private static BigDecimal mul(String v1, String v2) { 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 78accb96b3..42bcfae0aa 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 @@ -9,13 +9,15 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; - import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -23,6 +25,7 @@ import java.awt.event.ActionListener; * Created by kerry on 2017/9/10. */ public class NumberEditorValidatePane extends JPanel { + private UICheckBox allowDecimalsCheckBox; private UICheckBox allowNegativeCheckBox; private UICheckBox setMaxValueCheckBox; @@ -104,6 +107,7 @@ public class NumberEditorValidatePane extends JPanel { private void initListeners() { allowDecimalsListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (allowDecimalsCheckBox.isSelected()) { limitNumberPane.setVisible(true); @@ -129,8 +133,8 @@ public class NumberEditorValidatePane extends JPanel { if (!setMinValueCheckBox.isSelected()) { maxValueSpinner.getTextField().setMinValue(0.0); } - Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); - Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); + double minValue = Double.parseDouble("" + minValueSpinner.getValue()); + double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); if (minValue < 0.0) { minValueSpinner.setValue(0.0); } @@ -143,10 +147,11 @@ public class NumberEditorValidatePane extends JPanel { setMaxListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (setMaxValueCheckBox.isSelected()) { maxValueSpinner.setEnabled(true); - Double value = new Double(0); + Double value = (double) 0; if (setMinValueCheckBox.isSelected()) { Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); if (minValue > value) { @@ -163,10 +168,11 @@ public class NumberEditorValidatePane extends JPanel { setMinListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (setMinValueCheckBox.isSelected()) { minValueSpinner.setEnabled(true); - Double value = new Double(0); + Double value = (double) 0; if (setMaxValueCheckBox.isSelected()) { Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); if (maxValue < value) { @@ -177,7 +183,7 @@ public class NumberEditorValidatePane extends JPanel { maxValueSpinner.getTextField().setMinValue(value); } else { minValueSpinner.setEnabled(false); - maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); + maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : (double) 0); } } }; @@ -222,28 +228,28 @@ public class NumberEditorValidatePane extends JPanel { allowNegativeCheckBox.setSelected(e.isAllowNegative()); if (e.getMaxValue() == Double.MAX_VALUE) { setMaxValueCheckBox.setSelected(false); - maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); + maxValueSpinner.setValue(Double.MAX_VALUE); maxValueSpinner.setEnabled(false); } else { setMaxValueCheckBox.setSelected(true); maxValueSpinner.setEnabled(true); - maxValueSpinner.setValue(new Double(e.getMaxValue())); + maxValueSpinner.setValue(e.getMaxValue()); } if (e.getMinValue() == -Double.MAX_VALUE) { setMinValueCheckBox.setSelected(false); - minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); + minValueSpinner.setValue(-Double.MAX_VALUE); minValueSpinner.setEnabled(false); } else { setMinValueCheckBox.setSelected(true); minValueSpinner.setEnabled(true); - minValueSpinner.setValue(new Double(e.getMinValue())); + minValueSpinner.setValue(e.getMinValue()); } - if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) { errorMsgTextFieldPane.setVisible(true); errorMsgTextField.setText(e.getRegErrorMessage()); - }else{ + } else { errorMsgTextFieldPane.setVisible(false); errorMsgTextField.setText(StringUtils.EMPTY); } @@ -259,15 +265,19 @@ public class NumberEditorValidatePane extends JPanel { if (setMinValueCheckBox.isSelected()) { ob.setMinValue(minValueSpinner.getValue()); + } else { + ob.setMinValue(-Double.MAX_VALUE); } if (setMaxValueCheckBox.isSelected()) { ob.setMaxValue(maxValueSpinner.getValue()); + } else { + ob.setMaxValue(Double.MAX_VALUE); } - if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) { errorMsgTextFieldPane.setVisible(true); - }else{ + } else { errorMsgTextFieldPane.setVisible(false); errorMsgTextField.setText(StringUtils.EMPTY); } diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 0d4839d6da..9b97c43599 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -3,9 +3,11 @@ package com.fr.env; import com.fr.base.FRContext; import com.fr.base.ServerConfig; import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.border.UITitledBorder; import com.fr.design.env.RemoteDesignerWorkspaceInfo; +import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -303,10 +305,17 @@ public class RemoteEnvPane extends BasicBeanPane { @Override public RemoteDesignerWorkspaceInfo updateBean() { + String url = this.remoteWorkspaceURL.getURL(); + String username = this.usernameInput.getText(); + String password = new String(this.passwordInput.getPassword()); + DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); + if (envProcessor != null) { + url = envProcessor.changeEnvPathBeforeConnect(username, password, url); + } WorkspaceConnectionInfo connection = new WorkspaceConnectionInfo( - this.remoteWorkspaceURL.getURL(), - this.usernameInput.getText(), - new String(this.passwordInput.getPassword()), + url, + username, + password, this.certPathInput.getText(), new String(this.certSecretKeyInput.getPassword())); 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 5fa180ffe6..10664b3405 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 @@ -2,6 +2,7 @@ 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.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListPane; @@ -19,6 +20,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; +import com.fr.geojson.helper.GEOJSONHelper; import com.fr.plugin.chart.base.GisLayer; import com.fr.plugin.chart.base.ViewCenter; import com.fr.plugin.chart.map.VanChartMapPlot; @@ -26,9 +28,7 @@ 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.geojson.helper.GEOJSONHelper; import com.fr.plugin.chart.map.server.MapLayerConfigManager; -import com.fr.plugin.chart.service.WMSFactory; import com.fr.plugin.chart.type.GISLayerType; import com.fr.plugin.chart.type.MapType; import com.fr.plugin.chart.type.ZoomLevel; @@ -57,6 +57,7 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; +import java.util.List; /** * Created by Mitisky on 16/5/11. @@ -380,7 +381,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { public void actionPerformed(ActionEvent e) { new SwingWorker() { - private java.util.List list; + private java.util.List list = new ArrayList<>(); @Override protected Void doInBackground() throws Exception { @@ -392,7 +393,11 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { } String res = httpClient.getResponseText(); - list = WMSFactory.readLayers(res); + List layers = WMSFactory.readLayers(res); + list.clear(); + for (String layer : layers) { + list.add(new WMSLayer(layer, false)); + } return null; } diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java index 313b571470..051c7bd494 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPaneNoPop.java @@ -23,4 +23,9 @@ public class FormHyperlinkGroupPaneNoPop extends FormHyperlinkGroupPane{ protected boolean isNewStyle() { return false; } + + @Override + public void saveSettings() { + // do nothing + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index d5753ce155..5e57557e7f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -225,7 +225,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { return; } widgetPropertyPane.update(widget); - xCreator.resetCreatorName(currentWidgetName); + // 上面一行更新了组件 这里必须重新调用getWidgetName + xCreator.resetCreatorName(widget.getWidgetName()); xCreator.resetVisible(widget.isVisible()); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); return; diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 04864c98a6..ff8ef4411f 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -195,7 +195,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { Component[] components = xWFitLayout.getComponents(); xWFitLayout.removeAll(); layout.resetStyle(); - XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); + XWAbsoluteBodyLayout xwAbsoluteBodyLayout = xWFitLayout.getBackupParent() == null ? new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)) : (XWAbsoluteBodyLayout) xWFitLayout.getBackupParent(); xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { XCreator xCreator = (XCreator) component; @@ -208,6 +208,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { } xwAbsoluteBodyLayout.add(component); } + xWFitLayout.setBackupParent(xwAbsoluteBodyLayout); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); formDesigner.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{wAbsoluteBodyLayout})); 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 07136bc1ef..6e72e98fef 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 @@ -68,6 +68,7 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.general.ImageWithSuffix; import com.fr.general.ModuleContext; import com.fr.grid.Grid; import com.fr.grid.GridUtils; @@ -89,6 +90,7 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.poly.PolyWorkSheet; import com.fr.report.worksheet.WorkSheet; import com.fr.stable.ArrayUtils; +import com.fr.stable.CoreGraphHelper; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.module.Module; @@ -621,7 +623,7 @@ public class JWorkBook extends JTemplate { if (workBook instanceof WorkBookAdapter) { elem.setValue(new CellImagePainter(cellImage)); } else { - elem.setValue(cellImage.getImage()); + elem.setValue(ImageWithSuffix.build(cellImage.getImage(),cellImage.getSuffix())); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java index c8ac3b32c0..4497a0b28f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java @@ -2,12 +2,9 @@ package com.fr.design.mainframe.messagecollect.entity; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; -import com.fr.general.CloudCenter; import com.fr.general.CloudClient; import com.fr.general.IOUtils; -import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; -import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; import com.fr.stable.CoreConstants; @@ -22,7 +19,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; -import java.util.HashMap; import java.util.UUID; /** @@ -32,11 +28,7 @@ import java.util.UUID; public class FileEntityBuilder { private static final String FOCUS_POINT_FILE_ROOT_PATH = "FocusPoint"; - private static final String FOCUS_POINT_FILE_UPLOAD_TOPIC = "__fine_intelli_file_upload__"; private static final String FILE_FROM = "design"; - private static final String FOCUS_POINT_FILE_UPLOAD_TYPE = "FocusPoint"; - private static final String FOCUS_POINT_FILE_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.feedback"); - private static final String FOCUS_POINT_URL_KEY = "focuspoint"; /** * 文件夹路径 @@ -109,29 +101,8 @@ public class FileEntityBuilder { String filePath = FOCUS_POINT_FILE_ROOT_PATH + CoreConstants.SEPARATOR + today + CoreConstants.SEPARATOR + keyFileName; String bbsUserName = MarketConfig.getInstance().getBbsUsername(); String uuid = DesignerEnvManager.getEnvManager().getUUID(); - String name = bbsUserName == null ? uuid : bbsUserName; + String name = StringUtils.isEmpty(bbsUserName) ? uuid : bbsUserName; - client.uploadFile(file, filePath, name, FILE_FROM); - addMessageQueue(filePath, bbsUserName, uuid); - } - - private static void addMessageQueue(String filePath, String userName, String uuid) { - JSONObject uploadInfo = new JSONObject(FOCUS_POINT_FILE_UPLOAD_URL); - String focusPointUrl = uploadInfo.optString(FOCUS_POINT_URL_KEY); - try { - HashMap params = new HashMap<>(); - params.put("topic", FOCUS_POINT_FILE_UPLOAD_TOPIC); - params.put("username", URLEncoder.encode(userName, EncodeConstants.ENCODING_UTF_8)); - params.put("uuid", uuid); - params.put("filepath", filePath); - params.put("timestamp", String.valueOf(System.currentTimeMillis())); - params.put("signature", String.valueOf(CommonUtils.signature())); - params.put("type", FOCUS_POINT_FILE_UPLOAD_TYPE); - if(StringUtils.isNotEmpty(focusPointUrl)){ - HttpToolbox.post(focusPointUrl, params); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + client.uploadFile(file, filePath, URLEncoder.encode(name, EncodeConstants.ENCODING_UTF_8), FILE_FROM); } } diff --git a/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java b/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java index 77a662d6d1..ba57676ecd 100644 --- a/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/SelectImagePane.java @@ -2,16 +2,15 @@ package com.fr.design.report; import com.fr.base.BaseUtils; import com.fr.base.Style; -import com.fr.base.frpx.pack.PictureCollection; -import com.fr.base.frpx.util.ImageIOHelper; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.style.background.image.ImageFileChooser; import com.fr.design.style.background.image.ImagePreviewPane; +import com.fr.design.utils.ImageUtils; import com.fr.design.utils.gui.GUICoreUtils; - +import com.fr.general.ImageWithSuffix; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.painter.CellImagePainter; @@ -28,6 +27,7 @@ import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.File; /** @@ -46,11 +46,6 @@ public class SelectImagePane extends BasicPane { private Image previewImage = null; - /** - * 默认格式 - */ - private String suffix = PictureCollection.DEFAULT_SUFFIX; - private File imageFile; public SelectImagePane() { @@ -127,13 +122,12 @@ public class SelectImagePane extends BasicPane { if (selectedFile != null && selectedFile.isFile()) { String filePath = selectedFile.getPath(); - suffix = ImageIOHelper.getSuffix(filePath); - Image image = BaseUtils.readImage(filePath); + BufferedImage image = BaseUtils.readImage(filePath); CoreGraphHelper.waitForImage(image); imageFile = selectedFile; setImageStyle(); - previewPane.setImage(image); + previewPane.setImageWithSuffix(ImageWithSuffix.build(image, ImageUtils.getImageType(selectedFile))); previewPane.setImageStyle(imageStyle); previewImage = image; } else { @@ -184,7 +178,6 @@ public class SelectImagePane extends BasicPane { setImage((Image) value); } else if (value instanceof CellImagePainter) { setImage(((CellImagePainter) value).getImage()); - suffix = ((CellImagePainter) value).getSuffix(); } style = cell.getStyle(); @@ -214,11 +207,8 @@ public class SelectImagePane extends BasicPane { public CellImage update() { CellImage cellImage = new CellImage(); - cellImage.setImage(previewPane.getImage()); + cellImage.setImage(previewPane.getImageWithSuffix()); cellImage.setStyle(this.imageStyle); - if (suffix != null) { - cellImage.setSuffix(suffix); - } return cellImage; } diff --git a/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java b/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java index 4c4342291b..e68bd907b9 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java +++ b/designer-realize/src/main/java/com/fr/grid/GridCornerMouseHandler.java @@ -29,6 +29,8 @@ public class GridCornerMouseHandler extends MouseInputAdapter { private void doSelectAll() { ElementCasePane reportPane = this.gridCorner.getElementCasePane(); + // 全选时,停止编辑状态 + reportPane.getGrid().stopEditing(); ColumnRow lastColumnRow = GridUtils.getAdjustLastColumnRowOfReportPane(reportPane); reportPane.setSelection(new CellSelection(0, 0, lastColumnRow.getColumn(), lastColumnRow.getRow())); diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index c32c2307d2..139030642c 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -8,11 +8,14 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.locale.impl.UserInfoMark; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import javax.swing.*; import javax.swing.border.TitledBorder; @@ -31,11 +34,6 @@ public class CollectUserInformationDialog extends UIDialog { private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000; - private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); - private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); - private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); - private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); - private UITextField keyTextField; private ActionListener actionListener = new ActionListener() { @@ -129,19 +127,9 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { - Locale locale = GeneralContext.getLocale(); - String url = EN_LOGIN_HTML; - if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { - url = TW_LOGIN_HTML; - } - if (ComparatorUtils.equals(locale, Locale.CHINA)) { - url = CN_LOGIN_HTML; - } - if (ComparatorUtils.equals(locale, Locale.JAPAN)) { - url = JP_LOGIN_HTML; - } + LocaleMark localeMark = LocaleCenter.getMark(UserInfoMark.class); try { - Desktop.getDesktop().browse(new URI(url)); + Desktop.getDesktop().browse(new URI(localeMark.getValue())); } catch (Exception ignored) { } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 8ae77ee090..e45eee48f1 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,12 +1,15 @@ package com.fr.start; import com.fr.concurrent.NamedThreadFactory; -import com.fr.design.DesignerEnvManager; +import com.fr.design.i18n.Toolkit; +import com.fr.design.locale.impl.SplashMark; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.module.ModuleEvent; import com.fr.stable.StringUtils; @@ -27,6 +30,7 @@ public class SplashContext { public static final String SPLASH_PATH = getSplashPath(); public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); private static final int FETCH_ONLINE_MAX_TIMES = 50; + private static final String THANKS = Toolkit.i18nText("Fine-Design_Report_Thanks_To"); private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -148,7 +152,7 @@ public class SplashContext { if (shouldShowThanks()) { tryFetchOnline(); if (StringUtils.isNotEmpty(guest)) { - updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + guest); + updateThanksLog(THANKS + guest); } } } @@ -167,13 +171,7 @@ public class SplashContext { } private static String getSplashPath() { - Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); - if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) { - return "/com/fr/design/images/splash_10_en.gif"; - } else if (Locale.JAPAN.equals(locale)) { - return "/com/fr/design/images/splash_10_jp.gif"; - } else { - return "/com/fr/design/images/splash_10.gif"; - } + LocaleMark localeMark = LocaleCenter.getMark(SplashMark.class); + return localeMark.getValue(); } -} +} \ No newline at end of file