Browse Source

REPORT-19946 Linux设计器

persist/11.0
pengda 5 years ago
parent
commit
0bb7a68b48
  1. 4
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 4
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  3. 4
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  5. 4
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  6. 5
      designer-base/src/main/java/com/fr/design/os/OSBasedAction.java
  7. 24
      designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java
  8. 6
      designer-base/src/main/java/com/fr/design/os/SupportOS.java
  9. 8
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  10. 59
      designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java
  11. 8
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  12. 20
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  13. 9
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  14. 4
      designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java
  15. 53
      designer-base/src/main/java/com/fr/start/Demo.java
  16. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

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

@ -7,8 +7,8 @@ import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.gui.NameInspector;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.os.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;

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

@ -2,10 +2,10 @@ package com.fr.design.actions.server;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.os.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.design.os.impl.PMDialogAction;
import com.fr.general.IOUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.*;
import java.awt.event.ActionEvent;

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

@ -3,8 +3,8 @@ 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.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;

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

@ -40,8 +40,6 @@ 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.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
@ -61,6 +59,8 @@ 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.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;

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

@ -54,8 +54,6 @@ 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.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
@ -73,6 +71,8 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.Nullable;

5
designer-base/src/main/java/com/fr/design/os/OSBasedAction.java

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

24
designer-base/src/main/java/com/fr/design/os/OSSupportCenter.java

@ -1,24 +0,0 @@
package com.fr.design.os;
import com.fr.invoke.Reflect;
import java.util.HashMap;
import java.util.Map;
public class OSSupportCenter {
private static Map<Class<? extends OSBasedAction>,OSBasedAction> osBasedActionMap = new HashMap<Class<? extends OSBasedAction>,OSBasedAction>();
public static void buildAction(OSBasedAction action, SupportOS supportOS){
if(supportOS.support()){
action.execute();
}
}
public static <T extends OSBasedAction> T getAction(Class<T> 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/main/java/com/fr/design/os/SupportOS.java

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

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

@ -7,15 +7,19 @@ 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.design.os.OSBasedAction;
import com.fr.file.ConnectionConfig;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager;
//数据连接窗口
/**
* 数据连接窗口
* @author pengda
* @date 2019/10/9
*/
public class DatabaseDialogAction implements OSBasedAction {
@Override

59
designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java

@ -0,0 +1,59 @@
package com.fr.design.os.impl;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import java.io.IOException;
/**
* @author pengda
* @date 2019/10/9
*/
public class DemoAction implements OSBasedAction {
@Override
public void execute() {
String installHome = StableUtils.getInstallHome();
if (installHome == null) {
FineLoggerFactory.getLogger().error("Can not find the install home, please check it.");
return;
}
String executorPath;
if (OperatingSystem.isMacos()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else if(OperatingSystem.isWindows()){
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}else{
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo");
}
if (OperatingSystem.isMacos()) {
ProcessBuilder builder = new ProcessBuilder();
builder.command("open", "-a", executorPath, "--args", "demo");
try {
builder.start();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else if(OperatingSystem.isWindows()){
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}else{
//先用和win一样的方式
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}

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

@ -2,13 +2,17 @@ package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.os.OSBasedAction;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
//插件管理窗口
/**
* 插件管理窗口
* @author pengda
* @date 2019/10/9
*/
public class PMDialogAction implements OSBasedAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
@Override

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

@ -1,23 +1,33 @@
package com.fr.design.os.impl;
import com.fr.design.os.SupportOS;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.SupportOS;
/**
* @author pengda
* @date 2019/10/9
*/
public enum SupportOSImpl implements SupportOS {
//登录
/**
* ARM下屏蔽登录
*/
USERINFOPANE{
public boolean support(){
return Arch.getArch() != Arch.ARM;
}
},
//透明度
/**
* Linux系统屏蔽透明度
*/
OPACITY{
public boolean support(){
return !OperatingSystem.isLinux();
}
},
//FineUI选项
/**
* Linux系统屏蔽FineUI选项
*/
FINEUI{
public boolean support(){
return !OperatingSystem.isLinux();

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

@ -1,12 +1,16 @@
package com.fr.design.os.impl;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.OSBasedAction;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
//更新升级窗口
/**
* 更新升级窗口
* @author pengda
* @date 2019/10/9
*/
public class UpdateDialogAction implements OSBasedAction {
private static String UPDATE_ROUTE = "#management/backup";
@Override
@ -18,5 +22,4 @@ public class UpdateDialogAction implements OSBasedAction {
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
}
}

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

@ -2,9 +2,9 @@ package com.fr.design.update.actions;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.os.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.design.os.impl.UpdateDialogAction;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import java.awt.event.ActionEvent;

53
designer-base/src/main/java/com/fr/start/Demo.java

@ -1,56 +1,13 @@
package com.fr.start;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.StableUtils;
import java.io.IOException;
import com.fr.design.os.impl.DemoAction;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
public class Demo {
public static void main(String[] args) {
String installHome = StableUtils.getInstallHome();
if (installHome == null) {
FineLoggerFactory.getLogger().error("Can not find the install home, please check it.");
return;
}
String executorPath;
if (OperatingSystem.isMacos()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else if(OperatingSystem.isWindows()){
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}else{
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo");
}
if (OperatingSystem.isMacos()) {
ProcessBuilder builder = new ProcessBuilder();
builder.command("open", "-a", executorPath, "--args", "demo");
try {
builder.start();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else if(OperatingSystem.isWindows()){
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}else{
//先用和win一样的方式
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(DemoAction.class);
osBasedAction.execute();
System.exit(0);
}
}

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

@ -54,8 +54,6 @@ 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.OSBasedAction;
import com.fr.design.os.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane;
@ -94,6 +92,8 @@ import com.fr.report.cell.painter.CellImagePainter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import com.fr.stable.script.CalculatorProviderContext;
import com.fr.stable.script.ValueConverter;

Loading…
Cancel
Save