zack 6 years ago
parent
commit
b0b89fb5f6
  1. 16
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  2. 19
      designer-base/src/main/java/com/fr/design/fun/Feedback.java
  3. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  4. 24
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  5. 9
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  6. 10
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java
  7. 243
      designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java
  8. 3
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  9. 34
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java
  10. 2
      designer-realize/src/main/java/com/fr/design/webattr/ReportWebWidgetConstants.java
  11. 25
      designer-realize/src/main/java/com/fr/start/Designer.java
  12. 41
      designer-realize/src/main/java/com/fr/start/SplashContext.java
  13. 20
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  14. 2
      designer-realize/src/main/java/com/fr/start/preload/ImagePreLoader.java

16
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.base.BaseUtils;
import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.CellWidgetOptionProvider; import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.fun.Feedback;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider; import com.fr.design.fun.ParameterWidgetOptionProvider;
import com.fr.design.fun.ServerTableDataDefineProvider; 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.Appearance;
import com.fr.design.widget.mobile.WidgetMobilePane; import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.plugin.AbstractExtraClassManager; import com.fr.plugin.AbstractExtraClassManager;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
@ -210,19 +207,6 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return map; 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 @Override
protected boolean demountSpecific(PluginSingleInjection injection) { protected boolean demountSpecific(PluginSingleInjection injection) {

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

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

3
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -249,7 +249,8 @@ abstract class UIControlPane extends JControlPane {
checkValid(); checkValid();
} catch (Exception exp) { } catch (Exception exp) {
// 存在非法输入 拒绝隐藏 // 存在非法输入 拒绝隐藏
JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage()); this.setAlwaysOnTop(true);
JOptionPane.showMessageDialog(this, exp.getMessage());
this.requestFocus(); this.requestFocus();
return; return;
} }

24
designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -56,21 +56,15 @@ public class UpdateActionManager {
} }
public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) { public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) {
threadPoolExecutor.allowCoreThreadTimeOut(true); JPanel panel = null;
threadPoolExecutor.execute(new Runnable() { try {
@Override panel = (JPanel) StableUtils.classForName(paneClass).newInstance();
public void run() { if (panel instanceof LoadingBasicPane) {
JPanel panel = null; panel = ((LoadingBasicPane) panel).getAllComponents();
try {
panel = (JPanel) StableUtils.classForName(paneClass).newInstance();
if (panel instanceof LoadingBasicPane) {
panel = ((LoadingBasicPane) panel).getAllComponents();
}
updateAction.setSearchText(updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
}); updateAction.setSearchText(updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} }
} }

9
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.CoreGraphHelper;
import com.fr.stable.ListMap; import com.fr.stable.ListMap;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -283,6 +285,13 @@ public class CustomIconPane extends BasicPane {
} }
public String update() { public String update() {
//把图标信息入库
Configurations.update(new WorkerFacade(WidgetInfoConfig.class) {
@Override
public void run() {
WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager());
}
});
return selectedIconName; return selectedIconName;
} }

10
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.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout; import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -54,11 +54,11 @@ public abstract class AbstractExtendedChartReportDataPane<T extends AbstractData
Arrays.fill(rowSize, p); Arrays.fill(rowSize, p);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15)); panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 8));
this.setLayout(new FlowLayout()); this.setLayout(new BorderLayout());
this.add(panel); this.add(panel, BorderLayout.CENTER);
this.add(addSouthPane()); this.add(addSouthPane(), BorderLayout.SOUTH);
} }
protected JPanel addSouthPane() { protected JPanel addSouthPane() {

243
designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java

@ -23,124 +23,131 @@ import java.util.ArrayList;
public class EventPropertyTable extends UIListControlPane { public class EventPropertyTable extends UIListControlPane {
private XCreator creator; private XCreator creator;
private FormDesigner designer; private FormDesigner designer;
public EventPropertyTable(FormDesigner designer) { public EventPropertyTable(FormDesigner designer) {
super(); super();
this.designer = designer; this.designer = designer;
} }
@Override @Override
public String getAddItemText() { public String getAddItemText() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Event"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Event");
} }
public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane {
@Override @Override
protected JavaScriptActionPane createJavaScriptActionPane() { protected JavaScriptActionPane createJavaScriptActionPane() {
return new JavaScriptActionPane() { return new JavaScriptActionPane() {
@Override @Override
protected DBManipulationPane createDBManipulationPane() { protected DBManipulationPane createDBManipulationPane() {
return new DBManipulationPane(ValueEditorPaneFactory.formEditors()); return new DBManipulationPane(ValueEditorPaneFactory.formEditors());
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Callback_Function"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Callback_Function");
} }
@Override
protected EmailPane initEmaiPane() { @Override
return new FormEmailPane(); protected EmailPane initEmaiPane() {
} return new FormEmailPane();
@Override }
public boolean isForm() {
return true; @Override
} public boolean isForm() {
return true;
protected String[] getDefaultArgs() { }
return new String[0];
} protected String[] getDefaultArgs() {
return new String[0];
}; }
}
};
@Override }
protected boolean supportCellAction() {
return false; @Override
} protected boolean supportCellAction() {
} return false;
}
private String switchLang(String eventName) { }
// 在 properties 文件中找到相应的 key 值
private String switchLang(String eventName) {
// 在 properties 文件中找到相应的 key 值
String localeKey = ReportEngineEventMapping.getLocaleName(eventName); String localeKey = ReportEngineEventMapping.getLocaleName(eventName);
return com.fr.design.i18n.Toolkit.i18nText(localeKey); return com.fr.design.i18n.Toolkit.i18nText(localeKey);
} }
/** /**
* 刷新 * 刷新
*/ */
public void refresh() { public void refresh() {
int selectionSize = designer.getSelectionModel().getSelection().size(); int selectionSize = designer.getSelectionModel().getSelection().size();
if (selectionSize == 0 || selectionSize == 1) { if (selectionSize == 0 || selectionSize == 1) {
this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel()
.getSelection().getSelectedCreator(); .getSelection().getSelectedCreator();
} else { } else {
this.creator = null; this.creator = null;
((DefaultListModel) nameableList.getModel()).removeAllElements(); ((DefaultListModel) nameableList.getModel()).removeAllElements();
checkButtonEnabled(); checkButtonEnabled();
return; return;
} }
Widget widget = creator.toData(); Widget widget = creator.toData();
refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class));
}
ArrayList<NameObject> nameObjectList = new ArrayList<>();
for (int i = 0, size = widget.getListenerSize(); i < size; i++) { public void populateNameObjects() {
Listener listener = widget.getListener(i); Widget widget = creator.toData();
if (!listener.isDefault()) {
nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); ArrayList<NameObject> nameObjectList = new ArrayList<>();
} for (int i = 0, size = widget.getListenerSize(); i < size; i++) {
} Listener listener = widget.getListener(i);
populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); if (!listener.isDefault()) {
checkButtonEnabled(); nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener));
this.repaint(); }
} }
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++) { * @param creator 控件
NameObject nameObject = (NameObject)res[i]; */
(creator.toData()).addListener((Listener) nameObject.getObject()); public void updateWidgetListener(XCreator creator) {
} (creator.toData()).clearListeners();
Nameable[] res = this.update();
designer.fireTargetModified(); for (int i = 0; i < res.length; i++) {
checkButtonEnabled(); NameObject nameObject = (NameObject) res[i];
} (creator.toData()).addListener((Listener) nameObject.getObject());
}
@Override
protected String title4PopupWindow() { designer.fireTargetModified();
return "Event"; checkButtonEnabled();
} }
@Override @Override
public NameableCreator[] createNameableCreators() { protected String title4PopupWindow() {
return new NameableCreator[]{ return "Event";
new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) }
};
} @Override
public NameableCreator[] createNameableCreators() {
@Override return new NameableCreator[]{
public void saveSettings() { new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class)
if (isPopulating) { };
return; }
}
updateWidgetListener(creator); @Override
} public void saveSettings() {
if (isPopulating) {
return;
}
updateWidgetListener(creator);
}
} }

3
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() { private void initTables() {
formWidgetCardPane.populate(); formWidgetCardPane.populate();
eventTable.refresh();
if (mobileExtraPropertyPanes != null) { if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
@ -233,7 +234,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
public void tabChanged(int index) { public void tabChanged(int index) {
//切换的时候再populate //切换的时候再populate
if (index == 1) { if (index == 1) {
eventTable.refresh(); eventTable.populateNameObjects();
} else if (index == 2) { } else if (index == 2) {
if (mobileExtraPropertyPanes != null) { if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {

34
designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSConstants.java

@ -26,29 +26,51 @@ public class BBSConstants {
private static Properties PROP = null; private static Properties PROP = null;
/**
* 获取所有的感谢对象无法获取在线使用默认
* @return 感谢对象的数组
*/
public static String[] getAllGuest() { public static String[] getAllGuest() {
return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY)); return loadAllGuestsInfoOnline(GUEST_KEY_ONLINE, loadAllGuestsInfo(GUEST_KEY));
} }
/**
* 获取所有的链接无法获取在线使用默认
* @return 链接的数组
*/
public static String[] getAllLink() { public static String[] getAllLink() {
return loadAllGuestsInfoOnline(LINK_KEY_ONLINE, loadAllGuestsInfo(LINK_KEY)); 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) { private static String loadAllGuestsInfo(String key) {
return loadAttribute(key, StringUtils.EMPTY); return loadAttribute(key, StringUtils.EMPTY);
} }
//加载所有用户的信息, 用户名, 论坛连接
private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) { private static String[] loadAllGuestsInfoOnline(String key, String defaultValue) {
String[] allGuests = new String[0];
String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue); String guest = CloudCenter.getInstance().acquireUrlByKind(key, defaultValue);
if (StringUtils.isNotEmpty(guest)) { if (StringUtils.isNotEmpty(guest)) {
allGuests = guest.split("\\|"); return guest.split("\\|");
} }
return allGuests; return new String[0];
} }
//如果要定制, 直接改bbs.properties就行了 //如果要定制, 直接改bbs.properties就行了
private static String loadAttribute(String key, String defaultValue) { private static String loadAttribute(String key, String defaultValue) {
if (PROP == null) { if (PROP == null) {

2
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); 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"), 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); 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); Verify.class);
public static final WidgetOption SUBMITFORCIBLY = WidgetOptionFactory.createByWidgetClass(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Submit_Forcibly"), 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); BaseUtils.readIcon("/com/fr/web/images/save2.png"), SubmitForcibly.class);

25
designer-realize/src/main/java/com/fr/start/Designer.java

@ -29,7 +29,6 @@ import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.alphafine.component.AlphaFinePane; import com.fr.design.mainframe.alphafine.component.AlphaFinePane;
import com.fr.design.mainframe.bbs.UserInfoLabel; import com.fr.design.mainframe.bbs.UserInfoLabel;
import com.fr.design.mainframe.bbs.UserInfoPane; import com.fr.design.mainframe.bbs.UserInfoPane;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
@ -54,7 +53,6 @@ import com.fr.stable.xml.XMLTools;
import com.fr.start.fx.SplashFx; import com.fr.start.fx.SplashFx;
import com.fr.start.jni.SplashMac; import com.fr.start.jni.SplashMac;
import com.fr.start.module.StartupArgs; import com.fr.start.module.StartupArgs;
import com.fr.start.preload.ImagePreLoader;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -69,8 +67,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
@ -110,8 +106,6 @@ public class Designer extends BaseDesigner {
RestartHelper.deleteRecordFilesWhenStart(); RestartHelper.deleteRecordFilesWhenStart();
preloadResource();
SplashContext.getInstance().registerSplash(createSplash()); SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show(); SplashContext.getInstance().show();
@ -131,25 +125,6 @@ public class Designer extends BaseDesigner {
} }
private static void preloadResource() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
new ImagePreLoader();
}
});
service.submit(new Runnable() {
@Override
public void run() {
TemplateInfoCollector.getInstance();
}
});
service.shutdown();
}
private static SplashStrategy createSplash() { private static SplashStrategy createSplash() {
// 这里可以开接口加载自定义启动画面 // 这里可以开接口加载自定义启动画面
if (OperatingSystem.isWindows()) { if (OperatingSystem.isWindows()) {

41
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_PATH = "/com/fr/design/images/splash_10.gif";
public static final String SPLASH_CACHE_NAME = "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(); private static final SplashContext SPLASH_CONTEXT = new SplashContext();
@ -33,7 +34,8 @@ public class SplashContext {
private int loadingIndex = 0; private int loadingIndex = 0;
private String[] loading = new String[]{"..", "....", "......"}; 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); private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
@ -81,6 +83,7 @@ public class SplashContext {
scheduler.scheduleAtFixedRate(new Runnable() { scheduler.scheduleAtFixedRate(new Runnable() {
@Override @Override
public void run() { public void run() {
showThanks();
loadingIndex++; loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
} }
@ -90,7 +93,6 @@ public class SplashContext {
@Override @Override
public void on(Event event, String i18n) { public void on(Event event, String i18n) {
showThanks();
moduleID = i18n; moduleID = i18n;
loadingIndex++; loadingIndex++;
updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]);
@ -110,21 +112,42 @@ public class SplashContext {
/** /**
* 获取随机感谢人员 * 获取随机感谢人员
*/ */
private static String getRandomUser() { private String getRandomUser(String[] allGuest) {
String[] allGuest = BBSConstants.getAllGuest();
if (allGuest.length == 0) {
return StringUtils.EMPTY;
}
int num = new Random().nextInt(allGuest.length); int num = new Random().nextInt(allGuest.length);
return StringUtils.BLANK + allGuest[num]; 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() { private void showThanks() {
if (shouldShowThanks()) { 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);
}
} }
} }

20
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -52,6 +52,7 @@ import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.ParameterPropertyPane;
@ -98,9 +99,10 @@ import com.fr.stable.script.ValueConverter;
import com.fr.stable.xml.ObjectTokenizer; import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder; import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider; import com.fr.start.BBSGuestPaneProvider;
import com.fr.start.preload.ImagePreLoader;
import com.fr.xml.ReportXMLUtils; import com.fr.xml.ReportXMLUtils;
import java.awt.*; import java.awt.Image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -170,12 +172,24 @@ public class DesignerActivator extends Activator {
designerRegister(); designerRegister();
InformationCollector.getInstance().collectStartTime(); InformationCollector.getInstance().collectStartTime();
ExtraDesignClassManager.getInstance().getFeedback().didFeedback();
} }
private static void preLoadPane() { private static void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool(); ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
new ImagePreLoader();
}
});
service.submit(new Runnable() {
@Override
public void run() {
TemplateInfoCollector.getInstance();
}
});
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {

2
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/scale.png",
"com/fr/web/images/appendRow.png", "com/fr/web/images/appendRow.png",
"com/fr/web/images/deleteRow.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/web/images/save2.png",
"com/fr/design/images/m_file/export.png", "com/fr/design/images/m_file/export.png",
"com/fr/web/images/showValue.png", "com/fr/web/images/showValue.png",

Loading…
Cancel
Save