diff --git a/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java b/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java index 9529994f5..beb62c06e 100644 --- a/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java +++ b/designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java @@ -7,7 +7,6 @@ package com.fr.design; import com.fr.base.BaseUtils; import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.fun.CellWidgetOptionProvider; -import com.fr.design.fun.Feedback; import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.ParameterWidgetOptionProvider; import com.fr.design.fun.ServerTableDataDefineProvider; @@ -19,8 +18,6 @@ import com.fr.design.menu.ShortCut; import com.fr.design.widget.Appearance; import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.form.ui.Widget; -import com.fr.general.FRLogger; -import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; import com.fr.plugin.AbstractExtraClassManager; import com.fr.plugin.injectable.PluginModule; @@ -210,19 +207,6 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement return map; } - - public Feedback getFeedback() { - try { - Class clazz = GeneralUtils.classForName("com.fr.design.feedback.CurrentFeedback"); - if (clazz != null) { - return (Feedback) clazz.newInstance(); - } - } catch (Exception e) { - FRLogger.getLogger().info("no feed back support"); - } - return Feedback.EMPTY; - } - @Override protected boolean demountSpecific(PluginSingleInjection injection) { diff --git a/designer-base/src/main/java/com/fr/design/fun/Feedback.java b/designer-base/src/main/java/com/fr/design/fun/Feedback.java deleted file mode 100644 index f1e3c7971..000000000 --- a/designer-base/src/main/java/com/fr/design/fun/Feedback.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.fr.design.fun; - -/** - * @author richie - * @date 2015-03-31 - * @since 8.0 - */ -public interface Feedback { - String MARK_STRING = "FineReport_Feedback"; - - void didFeedback(); - - Feedback EMPTY = new Feedback() { - @Override - public void didFeedback() { - - } - }; -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index cd3c3a5ba..27ab268dc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -249,7 +249,8 @@ abstract class UIControlPane extends JControlPane { checkValid(); } catch (Exception exp) { // 存在非法输入 拒绝隐藏 - JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage()); + this.setAlwaysOnTop(true); + JOptionPane.showMessageDialog(this, exp.getMessage()); this.requestFocus(); return; } diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index 90d5874ec..edce02c7a 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -24,6 +24,8 @@ import com.fr.stable.Constants; import com.fr.stable.CoreGraphHelper; import com.fr.stable.ListMap; import com.fr.stable.StringUtils; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -283,6 +285,13 @@ public class CustomIconPane extends BasicPane { } public String update() { + //把图标信息入库 + Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { + @Override + public void run() { + WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); + } + }); return selectedIconName; } diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java index aa6bbf1a0..950d71e8c 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java @@ -12,7 +12,7 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import java.awt.Component; -import java.awt.FlowLayout; +import java.awt.BorderLayout; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -54,11 +54,11 @@ public abstract class AbstractExtendedChartReportDataPane nameObjectList = new ArrayList<>(); - for (int i = 0, size = widget.getListenerSize(); i < size; i++) { - Listener listener = widget.getListener(i); - if (!listener.isDefault()) { - nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); - } - } - populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); - checkButtonEnabled(); - this.repaint(); - } - - /** - * 更新控件事件 - * @param creator 控件 - */ - public void updateWidgetListener(XCreator creator) { - (creator.toData()).clearListeners(); - Nameable[] res = this.update(); - for (int i = 0; i < res.length; i++) { - NameObject nameObject = (NameObject)res[i]; - (creator.toData()).addListener((Listener) nameObject.getObject()); - } - - designer.fireTargetModified(); - checkButtonEnabled(); - } - - @Override - protected String title4PopupWindow() { - return "Event"; - } - - @Override - public NameableCreator[] createNameableCreators() { - return new NameableCreator[]{ - new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) - }; - } - - @Override - public void saveSettings() { - if (isPopulating) { - return; - } - updateWidgetListener(creator); - } + } + + /** + * 刷新 + */ + public void refresh() { + int selectionSize = designer.getSelectionModel().getSelection().size(); + if (selectionSize == 0 || selectionSize == 1) { + this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() + .getSelection().getSelectedCreator(); + } else { + this.creator = null; + ((DefaultListModel) nameableList.getModel()).removeAllElements(); + checkButtonEnabled(); + return; + } + Widget widget = creator.toData(); + + refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); + } + + public void populateNameObjects() { + Widget widget = creator.toData(); + + ArrayList nameObjectList = new ArrayList<>(); + for (int i = 0, size = widget.getListenerSize(); i < size; i++) { + Listener listener = widget.getListener(i); + if (!listener.isDefault()) { + nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); + } + } + populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); + checkButtonEnabled(); + this.repaint(); + } + + /** + * 更新控件事件 + * + * @param creator 控件 + */ + public void updateWidgetListener(XCreator creator) { + (creator.toData()).clearListeners(); + Nameable[] res = this.update(); + for (int i = 0; i < res.length; i++) { + NameObject nameObject = (NameObject) res[i]; + (creator.toData()).addListener((Listener) nameObject.getObject()); + } + + designer.fireTargetModified(); + checkButtonEnabled(); + } + + @Override + protected String title4PopupWindow() { + return "Event"; + } + + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) + }; + } + + @Override + public void saveSettings() { + if (isPopulating) { + return; + } + updateWidgetListener(creator); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 0cf740dbe..af17389be 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -108,6 +108,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper */ private void initTables() { formWidgetCardPane.populate(); + eventTable.refresh(); if (mobileExtraPropertyPanes != null) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { @@ -233,7 +234,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper public void tabChanged(int index) { //切换的时候再populate if (index == 1) { - eventTable.refresh(); + eventTable.populateNameObjects(); } else if (index == 2) { if (mobileExtraPropertyPanes != null) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java index bb600b1ce..5e12f224f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java @@ -26,29 +26,51 @@ public class BBSConstants { private static Properties PROP = null; + /** + * 获取所有的感谢对象,无法获取在线使用默认 + * @return 感谢对象的数组 + */ public static String[] getAllGuest() { return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY)); } + /** + * 获取所有的链接,无法获取在线使用默认 + * @return 链接的数组 + */ public static String[] getAllLink() { return loadAllGuestsInfoOnline(LINK_KEY_ONLINE, loadAllGuestsInfo(LINK_KEY)); } - //加载所有用户的信息, 用户名, 论坛连接 + /** + * 获取所有的感谢对象,手动选择策略 + * @return 感谢对象的数组 + */ + public static String[] getAllGuestManual(boolean isOnline) { + String guest; + if (isOnline) { + guest = CloudCenter.getInstance().acquireUrlByKind(GUEST_KEY_ONLINE, StringUtils.EMPTY); + } else { + guest = loadAllGuestsInfo(GUEST_KEY); + } + if (StringUtils.isNotEmpty(guest)) { + return guest.split("\\|"); + } + return new String[0]; + } + private static String loadAllGuestsInfo(String key) { return loadAttribute(key, StringUtils.EMPTY); } - //加载所有用户的信息, 用户名, 论坛连接 private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { - String[] allGuests = new String[0]; String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue); if (StringUtils.isNotEmpty(guest)) { - allGuests = guest.split("\\|"); + return guest.split("\\|"); } - return allGuests; + return new String[0]; } - + //如果要定制, 直接改bbs.properties就行了 private static String loadAttribute(String key, String defaultValue) { if (PROP == null) { diff --git a/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java b/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java index 9fc67c3fc..ebfb53b80 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java @@ -129,7 +129,7 @@ public class ReportWebWidgetConstants { BaseUtils.readIcon("/com/fr/web/images/appendRow.png"), AppendColumnRow.class); public static final WidgetOption DELETECOLUMNROW = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Delete_Record"), BaseUtils.readIcon("/com/fr/web/images/deleteRow.png"), DeleteColumnRow.class); - public static final WidgetOption VERIFY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Data_Verify"), BaseUtils.readIcon("/com/fr/web/images/verify.gif"), + public static final WidgetOption VERIFY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Verify_Data_Verify"), BaseUtils.readIcon("/com/fr/web/images/verify.png"), Verify.class); public static final WidgetOption SUBMITFORCIBLY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Submit_Forcibly"), BaseUtils.readIcon("/com/fr/web/images/save2.png"), SubmitForcibly.class); 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 3eb3ac105..2e5467557 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,6 +24,7 @@ public class SplashContext { public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; public static final String SPLASH_CACHE_NAME = "splash_10.gif"; + private static final int FETCH_ONLINE_MAX_TIMES = 10; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -33,7 +34,8 @@ public class SplashContext { private int loadingIndex = 0; private String[] loading = new String[]{"..", "....", "......"}; - private static final String GUEST = getRandomUser(); + private int fetchOnlineTimes = 0; + private String guest = StringUtils.EMPTY; private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); @@ -81,6 +83,7 @@ public class SplashContext { scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { + showThanks(); loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); } @@ -90,7 +93,6 @@ public class SplashContext { @Override public void on(Event event, String i18n) { - showThanks(); moduleID = i18n; loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); @@ -110,21 +112,42 @@ public class SplashContext { /** * 获取随机感谢人员 */ - private static String getRandomUser() { - String[] allGuest = BBSConstants.getAllGuest(); - if (allGuest.length == 0) { - return StringUtils.EMPTY; - } + private String getRandomUser(String[] allGuest) { int num = new Random().nextInt(allGuest.length); return StringUtils.BLANK + allGuest[num]; } /** - * 展示感谢信息 + * 尝试获取在线资源,达到尝试上限之后使用默认值 + */ + private void tryFetchOnline() { + if (StringUtils.isNotEmpty(guest)) { + return; + } + String[] allGuest; + if (fetchOnlineTimes < FETCH_ONLINE_MAX_TIMES) { + allGuest = BBSConstants.getAllGuestManual(true); + if (allGuest.length == 0) { + fetchOnlineTimes++; + return; + } + } else { + allGuest = BBSConstants.getAllGuestManual(false); + } + guest = getRandomUser(allGuest); + } + + /** + * 展示感谢信息。这里场景是优先使用在线名单, + * 甚至可以因此可以延迟几秒显示。目前是尝试 + * 获取10次在线资源,最大时间3秒 */ private void showThanks() { if (shouldShowThanks()) { - updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + GUEST); + tryFetchOnline(); + if (StringUtils.isNotEmpty(guest)) { + updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + guest); + } } } 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 2b8e77ac4..5e977f312 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 @@ -172,8 +172,6 @@ public class DesignerActivator extends Activator { designerRegister(); InformationCollector.getInstance().collectStartTime(); - - ExtraDesignClassManager.getInstance().getFeedback().didFeedback(); } private static void preLoadPane() { 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 a1b73f8d1..c53bbb6db 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 @@ -370,7 +370,7 @@ public class ImagePreLoader { "com/fr/web/images/scale.png", "com/fr/web/images/appendRow.png", "com/fr/web/images/deleteRow.png", - "com/fr/web/images/verify.gif", + "com/fr/web/images/verify.png", "com/fr/web/images/save2.png", "com/fr/design/images/m_file/export.png", "com/fr/web/images/showValue.png",