Browse Source

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

research/11.0
Bruce.Deng 5 years ago
parent
commit
c88ef0363d
  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. 10
      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. 23
      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. 13
      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. 5
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  25. 29
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  26. 69
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  27. 43
      designer-base/src/main/java/com/fr/start/Demo.java
  28. 6
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java
  29. 10
      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; package com.fr.design;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; 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.StableUtils;
import com.fr.stable.StringUtils; 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.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -168,11 +171,8 @@ public class RestartHelper {
}catch (Exception e){ }catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (OperatingSystem.isMacOS()) { OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class);
restartInMacOS(installHome, filesToBeDelete); osBasedAction.execute(filesToBeDelete);
} else {
restartInWindows(installHome, filesToBeDelete);
}
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally { } 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(); ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>(); List<String> commands = new ArrayList<String>();
commands.add("open"); commands.add("open");
@ -210,4 +210,16 @@ public class RestartHelper {
builder.command(commands); builder.command(commands);
builder.start(); 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.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper; 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.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -213,10 +213,15 @@ public class PreferencePane extends BasicPane {
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox); improvePane.add(joinProductImproveCheckBox);
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) { if(SupportOSImpl.AUTOPUSHUPDATE.support()){
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox); 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(); JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH); spaceUpPane.add(oraclePane, BorderLayout.NORTH);
@ -305,7 +310,6 @@ public class PreferencePane extends BasicPane {
gcButton.setEnabled(gcEnableCheckBox.isSelected()); gcButton.setEnabled(gcEnableCheckBox.isSelected());
} }
}); });
//集群下禁用 //集群下禁用
if (ClusterBridge.isClusterMode()) { if (ClusterBridge.isClusterMode()) {
gcEnableCheckBox.setEnabled(false); 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; package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction; 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.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.NameInspector; 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.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.file.ConnectionConfig;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -60,14 +53,11 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件 * @param evt 事件
*/ */
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) { OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
UniversalDatabaseOpener.showUniverseDatabaseDialog(); osBasedAction.execute();
} else {
openDesignDatabaseManager();
}
} }
private void openDesignDatabaseManager() { /* private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
@ -108,7 +98,7 @@ public class ConnectionListAction extends UpdateAction {
}); });
databaseListDialog.setVisible(true); databaseListDialog.setVisible(true);
} }
*/
/** /**
* 更新datasourceManager * 更新datasourceManager

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

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

10
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.constants.UIConstants;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel; 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.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
@ -28,7 +31,12 @@ public class ProgressDialog extends UIDialog {
setUndecorated(true); setUndecorated(true);
setSize(parent.getSize()); setSize(parent.getSize());
setLocationRelativeTo(null); setLocationRelativeTo(null);
setOpacity(0.5f); OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
setOpacity(0.5f);
}
}, SupportOSImpl.OPACITY);
initComponent(); 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()) { if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount(); visibleLineCount -= host.getFoldManager().getHiddenLineCount();
} }
return visibleLineCount * lineHeight; return (float) visibleLineCount * lineHeight;
default: default:
throw new IllegalArgumentException("Invalid axis: " + axis); 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) { public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
Font font = textArea.getFont(); Font font = textArea.getFont();
float oldSize = font.getSize2D(); float oldSize = font.getSize2D();
float newSize = oldSize - decreaseAmount; double newSize = (double)oldSize - (double)decreaseAmount;
if (newSize>=MINIMUM_SIZE) { if (newSize>=MINIMUM_SIZE) {
// Shrink by decreaseAmount. // Shrink by decreaseAmount.
font = font.deriveFont(newSize); font = font.deriveFont((float)newSize);
textArea.setFont(font); textArea.setFont(font);
} }
else if (oldSize>MINIMUM_SIZE) { else if (oldSize>MINIMUM_SIZE) {
@ -1329,10 +1329,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit {
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
Font font = textArea.getFont(); Font font = textArea.getFont();
float oldSize = font.getSize2D(); float oldSize = font.getSize2D();
float newSize = oldSize + increaseAmount; double newSize = (double)oldSize + (double)increaseAmount;
if (newSize<=MAXIMUM_SIZE) { if (newSize<=MAXIMUM_SIZE) {
// Grow by increaseAmount. // Grow by increaseAmount.
font = font.deriveFont(newSize); font = font.deriveFont((float)newSize);
textArea.setFont(font); textArea.setFont(font);
} }
else if (oldSize<MAXIMUM_SIZE) { 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()) { if (textArea.getFadeCurrentLineHighlight()) {
Graphics2D g2d = (Graphics2D)g; Graphics2D g2d = (Graphics2D)g;
Color bg = textArea.getBackground(); Color bg = textArea.getBackground();
float visibleWidth = (float)(visibleRect.x + visibleRect.width);
GradientPaint paint = new GradientPaint( GradientPaint paint = new GradientPaint(
visibleRect.x,0, highlight, visibleRect.x,0, highlight,
visibleRect.x+visibleRect.width,0, visibleWidth,0,
bg==null ? Color.WHITE : bg); bg==null ? Color.WHITE : bg);
g2d.setPaint(paint); g2d.setPaint(paint);
g2d.fillRect(visibleRect.x,textArea.currentCaretY, 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() / 2));
int x = (int) (owner.getLocation().getX() + owner.getWidth() - textWidth); 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)); setLocation(new Point(x, y));
@ -110,7 +110,7 @@ public class Toast extends JFrame {
try { try {
Toast toastFrame = new Toast(owner, toastText); Toast toastFrame = new Toast(owner, toastText);
toastFrame.fadeIn(); toastFrame.fadeIn();
Thread.sleep(durationSec * 1000); Thread.sleep((long)durationSec * 1000);
toastFrame.fadeOut(); toastFrame.fadeOut();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); 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) { public static int caculateWidth(int width) {
int w = 0; int w = 0;
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; double m = (double)(width + WIDTH_OFFSET_M) / (double)WIDTH_PARA_F;
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; double n = (double)(width + WIDTH_OFFSET_N ) / (double)WIDTH_PARA_F;
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); double i = Math.abs(((double) ((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); double j = Math.abs(((double) ((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j; double x = i > j ? i : j;
if (AssistUtils.equals(x, i)) { 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)) { } 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; return w;
} }
@ -579,7 +579,7 @@ public class FRGUIPaneFactory {
*/ */
public static int caculateHeight(int height) { public static int caculateHeight(int height) {
int h = 0; int h = 0;
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; double x = (double)(height + HEIGHT_OFFSET) / HEIGHT_PARA;
h = ((int) x + 1) * HEIGHT_PARA; h = ((int) x + 1) * HEIGHT_PARA;
return h; 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 p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE); 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"), JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"),
new double[]{f, p, f, p}, new double[]{f, f}, 4, 4); new double[]{f, p, f, p}, new double[]{f, f}, 4, 4);
JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"), JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"),

23
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.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
@ -58,6 +59,8 @@ import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; 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.stable.project.ProjectConstants;
import com.fr.start.OemHandler; import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -83,6 +86,7 @@ import java.awt.Graphics;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants; import java.awt.dnd.DnDConstants;
@ -449,20 +453,33 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return northEastPane; return northEastPane;
} }
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) {
northEastPane.removeAll(); northEastPane.removeAll();
northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
northEastPane.add(LogMessageBar.getInstance()); northEastPane.add(LogMessageBar.getInstance());
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor != null) { 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()); northEastPane.add(ad.createAlphaFinePane());
if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
ad.createAlphaFinePane().setVisible(false); ad.createAlphaFinePane().setVisible(false);
} }
northEastPane.add(ad.createBBSLoginPane()); OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
northEastPane.add(ad.createBBSLoginPane());
}
}, SupportOSImpl.USERINFOPANE);
} }
public void initTitleIcon() { 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; Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize(); 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. if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(UIConstants.LINE_COLOR); 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(); Dimension d = getSize();
g2d.setPaint(this.buttonTexturePaint); 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 if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected. // selected.
@ -109,7 +109,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
} else { } else {
g2d.setPaint(null); 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() { public Dimension getPreferredSize() {

13
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.SeparatorDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction; import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils; 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.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; 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.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -524,7 +527,7 @@ public abstract class ToolBarMenuDock {
* @return 帮组菜单的子菜单 * @return 帮组菜单的子菜单
*/ */
public ShortCut[] createHelpShortCuts() { public ShortCut[] createHelpShortCuts() {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>(); final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new WebDemoAction()); shortCuts.add(new WebDemoAction());
// 英文,把 video 和帮助文档放到 Help 下面 // 英文,把 video 和帮助文档放到 Help 下面
if (GeneralContext.getLocale().equals(Locale.US)) { if (GeneralContext.getLocale().equals(Locale.US)) {
@ -541,7 +544,13 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) { if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
shortCuts.add(new FineUIAction()); OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
} }
shortCuts.add(new AboutAction()); shortCuts.add(new AboutAction());

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.base.BaseUtils;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.os.impl.UpdateDialogAction;
import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -12,7 +13,6 @@ import java.awt.event.ActionEvent;
*/ */
public class SoftwareUpdateAction extends UpdateAction { public class SoftwareUpdateAction extends UpdateAction {
public SoftwareUpdateAction() { public SoftwareUpdateAction() {
setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade")); setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_UpdateAndUpgrade"));
setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png")); setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/update/update_new.png"));
@ -26,8 +26,9 @@ public class SoftwareUpdateAction extends UpdateAction {
*/ */
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); //说之后更新升级要用jxbrowser,Linux下进平台
dialog.showDialog(); 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.event.DesignerOpenedListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
@ -12,6 +13,9 @@ import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; 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 com.fr.workspace.WorkContext;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -81,21 +85,6 @@ public class DesignerPushUpdateManager {
return StringUtils.EMPTY; 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); initUpdateInfo(currentVersion, latestVersion);
} }
} }
return SupportOSImpl.AUTOPUSHUPDATE.support() && updateInfo.hasNewPushVersion();
return isAutoPushUpdateSupported() && updateInfo.hasNewPushVersion();
} }
private boolean isValidJarVersion(String fullCurrentVersion, String fullLatestVersion) { private boolean isValidJarVersion(String fullCurrentVersion, String fullLatestVersion) {

5
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -54,6 +54,7 @@ import java.util.Locale;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import static java.nio.charset.StandardCharsets.*; import static java.nio.charset.StandardCharsets.*;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
/** /**
* Created by XINZAI on 2018/8/21. * Created by XINZAI on 2018/8/21.
@ -584,7 +585,9 @@ public class UpdateMainDialog extends UIDialog {
updateButton.addActionListener(new ActionListener() { updateButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int a = JOptionPane.showConfirmDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Information"),Toolkit.i18nText("Fine-Design_Update_Info_Title"), JOptionPane.OK_CANCEL_OPTION); String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")};
int a = JOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Information"),
Toolkit.i18nText("Fine-Design_Update_Info_Title"),JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1);
if (a == 0) { if (a == 0) {
progressBar.setVisible(true); progressBar.setVisible(true);
progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message")); progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message"));

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

@ -1,6 +1,7 @@
package com.fr.design.upm; package com.fr.design.upm;
import com.fr.base.FRContext; 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.dialog.UIDialog;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; 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.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
@ -60,11 +62,30 @@ public class UpmFinder {
flag = false; flag = false;
} }
if (flag) { if (flag) {
UpmShowPane upmPane = new UpmShowPane(); if (!checkUPMResourcesExist()){
if (dialog == null) { // upm下载
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); 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);
} }
dialog.setVisible(true);
} else { } else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message")); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());

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

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

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

@ -1,46 +1,13 @@
package com.fr.start; package com.fr.start;
import com.fr.design.os.impl.DemoAction;
import com.fr.log.FineLoggerFactory; import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.OperatingSystem; import com.fr.stable.os.support.OSSupportCenter;
import com.fr.stable.StableUtils;
import java.io.IOException;
public class Demo { public class Demo {
public static void main(String[] args) { public static void main(String[] args) {
String installHome = StableUtils.getInstallHome(); OSBasedAction osBasedAction = OSSupportCenter.getAction(DemoAction.class);
if (installHome == null) { osBasedAction.execute();
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);
}
}
System.exit(0); 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.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.upm.event.CertificateEvent; import com.fr.design.upm.event.CertificateEvent;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; 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.general.http.HttpClient;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop; import java.awt.Desktop;
@ -142,7 +141,8 @@ public class UserInfoLabel extends UILabel {
@Override @Override
public void run() { public void run() {
// vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。 // vito:最新mac10.12和javafx弹出框初始化时会有大几率卡死在native方法,这里先屏蔽一下。
if (!FRContext.isChineseEnv() || OperatingSystem.isMacOS()) { //ARM下暂时也不能用javafx
if (!SupportOSImpl.BBSDIALOG.support()) {
return; return;
} }
String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime(); String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime();

10
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.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.parameter.WorkBookParameterReader; 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.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.bridge.StableFactory; 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.plugin.ExtraDesignClassManagerProvider;
import com.fr.stable.script.CalculatorProviderContext; import com.fr.stable.script.CalculatorProviderContext;
import com.fr.stable.script.ValueConverter; import com.fr.stable.script.ValueConverter;
@ -127,7 +130,12 @@ public class DesignerActivator extends Activator {
designerModuleStart(); designerModuleStart();
loadLogAppender(); loadLogAppender();
DesignerSocketIO.update(); DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo(); OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
UserInfoPane.getInstance().updateBBSUserInfo();
}
}, SupportOSImpl.USERINFOPANE);
storePassport(); storePassport();
AlphaFineHelper.switchConfig4Locale(); AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner()); RecoverManager.register(new RecoverForDesigner());

Loading…
Cancel
Save