Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

research/11.0
Bryant 5 years ago
parent
commit
1e0a7af2fb
  1. 26
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  2. 10
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 24
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  4. 16
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  5. 8
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  6. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  7. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java
  8. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaUI.java
  9. 4
      designer-base/src/main/java/com/fr/design/gui/toast/Toast.java
  10. 16
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  11. 2
      designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java
  12. 21
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  13. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  14. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java
  15. 11
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  16. 77
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  17. 59
      designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java
  18. 30
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  19. 74
      designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java
  20. 63
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  21. 25
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  22. 11
      designer-base/src/main/java/com/fr/design/update/actions/SoftwareUpdateAction.java
  23. 22
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java
  24. 21
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  25. 37
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  26. 43
      designer-base/src/main/java/com/fr/start/Demo.java
  27. 6
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java
  28. 8
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

26
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -1,13 +1,16 @@
package com.fr.design;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.OperatingSystem;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import java.io.File;
import java.io.FileInputStream;
@ -168,11 +171,8 @@ public class RestartHelper {
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (OperatingSystem.isMacOS()) {
restartInMacOS(installHome, filesToBeDelete);
} else {
restartInWindows(installHome, filesToBeDelete);
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class);
osBasedAction.execute(filesToBeDelete);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
@ -187,7 +187,7 @@ public class RestartHelper {
}
}
private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception {
/* private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add("open");
@ -210,4 +210,16 @@ public class RestartHelper {
builder.command(commands);
builder.start();
}
private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
//现在先写的是restart.sh
commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}*/
}

10
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -28,7 +28,7 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.update.push.DesignerPushUpdateManager;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
@ -213,10 +213,15 @@ public class PreferencePane extends BasicPane {
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) {
if(SupportOSImpl.AUTOPUSHUPDATE.support()){
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}
/*
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}*/
JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH);
@ -305,7 +310,6 @@ public class PreferencePane extends BasicPane {
gcButton.setEnabled(gcEnableCheckBox.isSelected());
}
});
//集群下禁用
if (ClusterBridge.isClusterMode()) {
gcEnableCheckBox.setEnabled(false);

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

@ -1,24 +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.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;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -60,14 +53,11 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
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() {
@ -108,7 +98,7 @@ public class ConnectionListAction extends UpdateAction {
});
databaseListDialog.setVisible(true);
}
*/
/**
* 更新datasourceManager

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

@ -1,11 +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.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;
@ -16,22 +16,18 @@ import java.awt.event.ActionEvent;
* @since 8.0
*/
public class PluginManagerAction extends UpdateAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
public PluginManagerAction() {
this.setMenuKeySet(PLUGIN_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
// 可以启用新版本的插件商店(使用JxBrowser作为容器)
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(PMDialogAction.class);
osBasedAction.execute();
}
public static final MenuKeySet PLUGIN_MANAGER = new MenuKeySet() {

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

@ -3,6 +3,9 @@ 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.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;
@ -28,7 +31,12 @@ public class ProgressDialog extends UIDialog {
setUndecorated(true);
setSize(parent.getSize());
setLocationRelativeTo(null);
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
setOpacity(0.5f);
}
}, SupportOSImpl.OPACITY);
initComponent();
}

2
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java

@ -374,7 +374,7 @@ public class SyntaxView extends View implements TabExpander,
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
return (float) visibleLineCount * lineHeight;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java

@ -741,10 +741,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit {
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
Font font = textArea.getFont();
float oldSize = font.getSize2D();
float newSize = oldSize - decreaseAmount;
double newSize = (double)oldSize - (double)decreaseAmount;
if (newSize>=MINIMUM_SIZE) {
// Shrink by decreaseAmount.
font = font.deriveFont(newSize);
font = font.deriveFont((float)newSize);
textArea.setFont(font);
}
else if (oldSize>MINIMUM_SIZE) {
@ -1329,10 +1329,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit {
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
Font font = textArea.getFont();
float oldSize = font.getSize2D();
float newSize = oldSize + increaseAmount;
double newSize = (double)oldSize + (double)increaseAmount;
if (newSize<=MAXIMUM_SIZE) {
// Grow by increaseAmount.
font = font.deriveFont(newSize);
font = font.deriveFont((float)newSize);
textArea.setFont(font);
}
else if (oldSize<MAXIMUM_SIZE) {

3
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaUI.java

@ -463,9 +463,10 @@ public class RTextAreaUI extends BasicTextAreaUI {
if (textArea.getFadeCurrentLineHighlight()) {
Graphics2D g2d = (Graphics2D)g;
Color bg = textArea.getBackground();
float visibleWidth = (float)(visibleRect.x + visibleRect.width);
GradientPaint paint = new GradientPaint(
visibleRect.x,0, highlight,
visibleRect.x+visibleRect.width,0,
visibleWidth,0,
bg==null ? Color.WHITE : bg);
g2d.setPaint(paint);
g2d.fillRect(visibleRect.x,textArea.currentCaretY,

4
designer-base/src/main/java/com/fr/design/gui/toast/Toast.java

@ -42,7 +42,7 @@ public class Toast extends JFrame {
//int x = (int) (owner.getLocation().getX() + (owner.getWidth() / 2));
int x = (int) (owner.getLocation().getX() + owner.getWidth() - textWidth);
int y = (int) (owner.getLocation().getY() + owner.getHeight() / 2);
int y = (int) (owner.getLocation().getY() + (double)owner.getHeight() / 2);
setLocation(new Point(x, y));
@ -110,7 +110,7 @@ public class Toast extends JFrame {
try {
Toast toastFrame = new Toast(owner, toastText);
toastFrame.fadeIn();
Thread.sleep(durationSec * 1000);
Thread.sleep((long)durationSec * 1000);
toastFrame.fadeOut();
} catch (Exception ex) {
ex.printStackTrace();

16
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -558,15 +558,15 @@ public class FRGUIPaneFactory {
*/
public static int caculateWidth(int width) {
int w = 0;
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F;
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F;
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j;
double m = (double)(width + WIDTH_OFFSET_M) / (double)WIDTH_PARA_F;
double n = (double)(width + WIDTH_OFFSET_N ) / (double)WIDTH_PARA_F;
double i = Math.abs(((double) ((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
double j = Math.abs(((double) ((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
double x = i > j ? i : j;
if (AssistUtils.equals(x, i)) {
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M;
w = (int) (Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M);
} else if (AssistUtils.equals(x, j)) {
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
w = (int) (Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N);
}
return w;
}
@ -579,7 +579,7 @@ public class FRGUIPaneFactory {
*/
public static int caculateHeight(int height) {
int h = 0;
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA;
double x = (double)(height + HEIGHT_OFFSET) / HEIGHT_PARA;
h = ((int) x + 1) * HEIGHT_PARA;
return h;
}

2
designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java

@ -372,7 +372,7 @@ public class TableLayoutHelper {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, 2 * TEN, 2 * TEN);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, (double)2 * TEN, (double)2 * TEN);
JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"),
new double[]{f, p, f, p}, new double[]{f, f}, 4, 4);
JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"),

21
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;
@ -58,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;
@ -83,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;
@ -449,21 +453,34 @@ 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) {
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
final Component[] bbsLoginPane = {null};
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
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);
}
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
northEastPane.add(ad.createBBSLoginPane());
}
}, SupportOSImpl.USERINFOPANE);
}
public void initTitleIcon() {

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

@ -164,11 +164,11 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double)d.height - 1));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(UIConstants.LINE_COLOR);
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double)d.height - 1));
}
}

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

@ -101,7 +101,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
Dimension d = getSize();
g2d.setPaint(this.buttonTexturePaint);
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, (double) d.width - 1, (double)d.height - 1));
if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected.
@ -109,7 +109,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
} else {
g2d.setPaint(null);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double) d.height - 1));
}
public Dimension getPreferredSize() {

11
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;
@ -70,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;
@ -524,7 +527,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()) {
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
}
shortCuts.add(new AboutAction());
return shortCuts.toArray(new ShortCut[0]);

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

@ -0,0 +1,77 @@
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.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
public void execute(Object... objects) {
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);
}
}

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(Object... objects) {
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);
}
}
}
}

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

@ -0,0 +1,30 @@
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.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
public void execute(Object... objects) {
if(Arch.getArch() == Arch.ARM){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
}
}

74
designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java

@ -0,0 +1,74 @@
package com.fr.design.os.impl;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class RestartAction implements OSBasedAction {
@Override
public void execute(Object... objects) {
String[] filesToBeDelete = (String[])objects;
String installHome = StableUtils.getInstallHome();
try{
if (OperatingSystem.isMacos()) {
restartInMacOS(installHome, filesToBeDelete);
} else if(OperatingSystem.isWindows()){
restartInWindows(installHome, filesToBeDelete);
}else{
//增加一个Linux系统
restartInLinux(installHome,filesToBeDelete);
}
}catch(Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add("open");
commands.add(installHome + File.separator + "bin" + File.separator + "restart.app");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add("--args");
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
private static void restartInWindows(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add(installHome + File.separator + "bin" + File.separator + "restart.exe");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
//现在先写的是restart.sh
commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
}

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

@ -0,0 +1,63 @@
package com.fr.design.os.impl;
import com.fr.base.FRContext;
import com.fr.general.GeneralContext;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.SupportOS;
import com.fr.workspace.WorkContext;
/**
* @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();
}
},
/**
* Linux系统屏蔽FineUI选项
*/
FINEUI{
public boolean support(){
return !OperatingSystem.isLinux();
}
},
/**
* 自动更新推送
*/
AUTOPUSHUPDATE{
@Override
public boolean support() {
boolean isLocalEnv = WorkContext.getCurrent().isLocal();
boolean isChineseEnv = GeneralContext.isChineseEnv();
boolean isLinux = OperatingSystem.isLinux();
// 远程设计和非中文环境以及Linux环境,都不生效
return isLocalEnv && isChineseEnv && !isLinux;
}
},
/**
* BBS窗口
*/
BBSDIALOG{
@Override
public boolean support() {
return FRContext.isChineseEnv() && !OperatingSystem.isMacos() && Arch.getArch() != Arch.ARM;
}
}
}

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

@ -0,0 +1,25 @@
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.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
public void execute(Object... objects) {
if(!OperatingSystem.isLinux()) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
}
}

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

@ -2,8 +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.os.impl.UpdateDialogAction;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import java.awt.event.ActionEvent;
@ -12,7 +13,6 @@ import java.awt.event.ActionEvent;
*/
public class SoftwareUpdateAction extends UpdateAction {
public SoftwareUpdateAction() {
setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade"));
setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png"));
@ -26,8 +26,9 @@ public class SoftwareUpdateAction extends UpdateAction {
*/
@Override
public void actionPerformed(ActionEvent e) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
//说之后更新升级要用jxbrowser,Linux下进平台
OSBasedAction osBasedAction = OSSupportCenter.getAction(UpdateDialogAction.class);
osBasedAction.execute();
}
}

22
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java

@ -4,6 +4,7 @@ import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
@ -12,6 +13,9 @@ import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.workspace.WorkContext;
import java.util.concurrent.ExecutorService;
@ -81,21 +85,6 @@ public class DesignerPushUpdateManager {
return StringUtils.EMPTY;
}
/**
* "自动更新推送"选项是否生效
*/
public boolean isAutoPushUpdateSupported() {
boolean isLocalEnv = WorkContext.getCurrent().isLocal();
boolean isChineseEnv = GeneralContext.isChineseEnv();
return isAutoPushUpdateSupported(isLocalEnv, isChineseEnv);
}
private boolean isAutoPushUpdateSupported(boolean isLocalEnv, boolean isChineseEnv) {
// 远程设计和非中文环境,都不生效
return isLocalEnv && isChineseEnv;
}
/**
* 检查更新如果有合适的更新版本则弹窗
*/
@ -129,8 +118,7 @@ public class DesignerPushUpdateManager {
initUpdateInfo(currentVersion, latestVersion);
}
}
return isAutoPushUpdateSupported() && updateInfo.hasNewPushVersion();
return SupportOSImpl.AUTOPUSHUPDATE.support() && updateInfo.hasNewPushVersion();
}
private boolean isValidJarVersion(String fullCurrentVersion, String fullLatestVersion) {

21
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -1,6 +1,7 @@
package com.fr.design.upm;
import com.fr.base.FRContext;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -8,6 +9,7 @@ import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
@ -60,11 +62,30 @@ public class UpmFinder {
flag = false;
}
if (flag) {
if (!checkUPMResourcesExist()){
// upm下载
int val = JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (val == JOptionPane.OK_OPTION){
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
}
}
}
else {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());

37
designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -29,7 +29,8 @@ public class UpmShowPane extends BasicPane {
UpmShowPane() {
setLayout(new BorderLayout());
if (UpmFinder.checkUPMResourcesExist()) {
// 先屏蔽掉这个判断,后续可能修改交互
// if (UpmFinder.checkUPMResourcesExist()) {
modernUIPane = new ModernUIPane.Builder<>()
.prepare(new ScriptContextAdapter() {
@Override
@ -46,23 +47,23 @@ public class UpmShowPane extends BasicPane {
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
}
});
} else {
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(WarnComponent.KEY)
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
}
}).build();
EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override
public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
}
});
}
// } else {
// modernUIPane = new ModernUIPane.Builder<>()
// .withComponent(WarnComponent.KEY)
// .prepare(new ScriptContextAdapter() {
// @Override
// public void onScriptContextCreated(ScriptContextEvent event) {
// JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
// window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
// }
// }).build();
// EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
// @Override
// public void on(Event event, String param) {
// modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
// }
// });
// }
add(modernUIPane, BorderLayout.CENTER);
}
}

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

@ -1,46 +1,13 @@
package com.fr.start;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.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 {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe 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 {
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
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);
}
}

6
designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -16,6 +16,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils;
@ -28,10 +29,8 @@ import com.fr.general.DateUtils;
import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.SwingConstants;
import java.awt.Cursor;
import java.awt.Desktop;
@ -142,7 +141,8 @@ public class UserInfoLabel extends UILabel {
@Override
public void run() {
// vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。
if (!FRContext.isChineseEnv() || OperatingSystem.isMacOS()) {
//ARM下暂时也不能用javafx
if (!SupportOSImpl.BBSDIALOG.support()) {
return;
}
String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime();

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

@ -55,6 +55,7 @@ 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;
@ -93,6 +94,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;
@ -127,7 +130,12 @@ public class DesignerActivator extends Activator {
designerModuleStart();
loadLogAppender();
DesignerSocketIO.update();
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
UserInfoPane.getInstance().updateBBSUserInfo();
}
}, SupportOSImpl.USERINFOPANE);
storePassport();
AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner());

Loading…
Cancel
Save