Browse Source

REPORT-19946 Linux设计器

persist/11.0
pengda 5 years ago
parent
commit
37ac363312
  1. 25
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 21
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  3. 13
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  4. 34
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 15
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  6. 73
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  7. 26
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  8. 27
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  9. 22
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  10. 17
      designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java
  11. 6
      designer-base/src/test/java/com/fr/design/OSBasedAction.java
  12. 25
      designer-base/src/test/java/com/fr/design/OSSupportCenter.java
  13. 6
      designer-base/src/test/java/com/fr/design/SupportOS.java
  14. 13
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

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

@ -1,26 +1,17 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import com.fr.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.Map;
@ -61,14 +52,16 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) {
/* if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}*/
OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
osBasedAction.execute();
}
private void openDesignDatabaseManager() {
/* private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
@ -109,7 +102,7 @@ public class ConnectionListAction extends UpdateAction {
});
databaseListDialog.setVisible(true);
}
*/
/**
* 更新datasourceManager

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

@ -1,15 +1,11 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.design.os.impl.PMDialogAction;
import com.fr.general.IOUtils;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -29,15 +25,8 @@ public class PluginManagerAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
// 可以启用新版本的插件商店(使用JxBrowser作为容器)
if(Arch.getArch() == Arch.ARM){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(PMDialogAction.class);
osBasedAction.execute();
}
public static final MenuKeySet PLUGIN_MANAGER = new MenuKeySet() {

13
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -3,8 +3,12 @@ package com.fr.design.gui.iprogressbar;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import com.fr.stable.os.OperatingSystem;
import javax.swing.JDialog;
@ -29,9 +33,12 @@ public class ProgressDialog extends UIDialog {
setUndecorated(true);
setSize(parent.getSize());
setLocationRelativeTo(null);
if(!OperatingSystem.isLinux()) {
setOpacity(0.5f);
}
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute() {
setOpacity(0.5f);
}
}, SupportOSImpl.OPACITY);
initComponent();
}

34
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -40,6 +40,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.exception.DecryptTemplateException;
@ -48,6 +49,8 @@ import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
@ -58,7 +61,6 @@ import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.os.Arch;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
@ -84,6 +86,7 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
@ -450,27 +453,36 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return northEastPane;
}
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) {
northEastPane.removeAll();
northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
northEastPane.add(LogMessageBar.getInstance());
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor != null) {
if(Arch.getArch() != Arch.ARM) {
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
}else{
//暂时不知道具体插件,先传null
processor.hold(northEastPane, LogMessageBar.getInstance(), null);
}
final Component[] bbsLoginPane = {null};
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute() {
bbsLoginPane[0] = ad.createBBSLoginPane();
}
}, SupportOSImpl.USERINFOPANE);
processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]);
}
northEastPane.add(ad.createAlphaFinePane());
if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
ad.createAlphaFinePane().setVisible(false);
}
if(Arch.getArch() != Arch.ARM) {
northEastPane.add(ad.createBBSLoginPane());
}
/*if(Arch.getArch() != Arch.ARM) {
}*/
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute() {
northEastPane.add(ad.createBBSLoginPane());
}
}, SupportOSImpl.USERINFOPANE);
}
public void initTitleIcon() {

15
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -54,6 +54,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils;
@ -61,6 +62,8 @@ 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.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
@ -525,7 +528,7 @@ public abstract class ToolBarMenuDock {
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new WebDemoAction());
// 英文,把 video 和帮助文档放到 Help 下面
if (GeneralContext.getLocale().equals(Locale.US)) {
@ -541,8 +544,14 @@ public abstract class ToolBarMenuDock {
}
shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug() && !OperatingSystem.isLinux()) {
shortCuts.add(new FineUIAction());
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute() {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
}
shortCuts.add(new AboutAction());

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

@ -0,0 +1,73 @@
package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.ConnectionConfig;
import com.fr.general.os.OSBasedAction;
import com.fr.stable.os.OperatingSystem;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager;
//数据连接窗口
public class DatabaseDialogAction implements OSBasedAction {
@Override
public void execute() {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}
private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
public void complete() {
ConnectionConfig connectionConfig = datasourceManager.mirror();
populate(connectionConfig);
}
protected void renameConnection(String oldName, String newName) {
datasourceManager.renameConnection(oldName, newName);
}
};
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override
public void run() {
databaseManagerPane.update(datasourceManager);
}
}.addCallBack(new CallBackAdaptor() {
@Override
public boolean beforeCommit() {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog);
}
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
}));
}
});
databaseListDialog.setVisible(true);
}
}

26
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -0,0 +1,26 @@
package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.general.os.OSBasedAction;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
//插件管理窗口
public class PMDialogAction implements OSBasedAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
@Override
public void execute() {
if(Arch.getArch() == Arch.ARM){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
}
}

27
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -0,0 +1,27 @@
package com.fr.design.os.impl;
import com.fr.general.os.SupportOS;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
public enum SupportOSImpl implements SupportOS {
//登录
USERINFOPANE{
public boolean support(){
return Arch.getArch() != Arch.ARM;
}
},
//透明度
OPACITY{
public boolean support(){
return !OperatingSystem.isLinux();
}
},
//FineUI选项
FINEUI{
public boolean support(){
return !OperatingSystem.isLinux();
}
}
}

22
designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java

@ -0,0 +1,22 @@
package com.fr.design.os.impl;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.general.os.OSBasedAction;
import com.fr.stable.os.OperatingSystem;
//更新升级窗口
public class UpdateDialogAction implements OSBasedAction {
private static String UPDATE_ROUTE = "#management/backup";
@Override
public void execute() {
if(!OperatingSystem.isLinux()) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
}
}

17
designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java

@ -2,11 +2,9 @@ package com.fr.design.update.actions;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.design.os.impl.UpdateDialogAction;
import com.fr.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import java.awt.event.ActionEvent;
/**
@ -14,7 +12,6 @@ import java.awt.event.ActionEvent;
*/
public class SoftwareUpdateAction extends UpdateAction {
private static String UPDATE_ROUTE = "#management/backup";
public SoftwareUpdateAction() {
setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade"));
setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png"));
@ -29,12 +26,8 @@ public class SoftwareUpdateAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
//说之后更新升级要用jxbrowser,Linux下进平台
if(!OperatingSystem.isLinux()) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(UpdateDialogAction.class);
osBasedAction.execute();
}
}

6
designer-base/src/test/java/com/fr/design/OSBasedAction.java

@ -0,0 +1,6 @@
package com.fr.design;
public interface OSBasedAction {
void execute();
}

25
designer-base/src/test/java/com/fr/design/OSSupportCenter.java

@ -0,0 +1,25 @@
package com.fr.design;
import com.fr.invoke.Reflect;
import java.util.HashMap;
import java.util.Map;
public class OSSupportCenter {
private static Map<Class,OSBasedAction> osBasedActionMap = new HashMap<Class,OSBasedAction>();
public static void buildAction(OSBasedAction action, SupportOS supportOS){
if(supportOS.support()){
action.execute();
}
}
public static <T extends OSBasedAction> T getAction(Class clazz) {
OSBasedAction action = osBasedActionMap.get(clazz);
if(action == null){
action = Reflect.on(clazz).create().get();
osBasedActionMap.put(clazz,action);
}
return (T) action;
}
}

6
designer-base/src/test/java/com/fr/design/SupportOS.java

@ -0,0 +1,6 @@
package com.fr.design;
public interface SupportOS {
//判断是否支持
boolean support();
}

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

@ -54,11 +54,14 @@ import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.general.os.OSBasedAction;
import com.fr.general.os.OSSupportCenter;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScriptImpl;
@ -126,9 +129,13 @@ public class DesignerActivator extends Activator {
designerModuleStart();
loadLogAppender();
DesignerSocketIO.update();
if(Arch.getArch() != Arch.ARM) {
UserInfoPane.getInstance().updateBBSUserInfo();
}
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute() {
UserInfoPane.getInstance().updateBBSUserInfo();
}
}, SupportOSImpl.USERINFOPANE);
storePassport();
AlphaFineHelper.switchConfig4Locale();
}

Loading…
Cancel
Save