Browse Source

Merge pull request #131 in DESIGN/design from ~ZACK/design:release/10.0 to release/10.0

* commit 'bf12471c63d847db213738e77d8b77f2258e0cdb':
  REPORT-8706 10.0启动后,设计器没有显示在最前端
master
zack 7 years ago
parent
commit
d6456a981a
  1. 28
      designer-base/src/com/fr/start/BaseDesigner.java
  2. 13
      designer-base/src/com/fr/start/SplashFxActionListener.java
  3. 8
      designer-realize/src/com/fr/start/fx/SplashFx.java
  4. 18
      designer-realize/src/com/fr/start/fx/SplashFxWindow.java
  5. 6
      designer-realize/src/com/fr/start/module/DesignerStartup.java

28
designer-base/src/com/fr/start/BaseDesigner.java

@ -25,8 +25,6 @@ import com.fr.module.ModuleEvent;
import com.fr.stable.OperatingSystem;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.lang.reflect.Method;
import java.util.concurrent.ExecutorService;
@ -76,20 +74,12 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
}
public void show(final String[] args) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.submit(new Runnable() {
@Override
public void run() {
collectUserInformation();
showDesignerFrame(args, DesignerContext.getDesignerFrame(), false);
DesignerContext.getDesignerFrame().refreshEnv();
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh();
}
}
});
executorService.shutdown();
DesignerContext.getDesignerFrame().setVisible(true);
collectUserInformation();
showDesignerFrame(args, DesignerContext.getDesignerFrame(), false);
DesignerContext.getDesignerFrame().refreshEnv();
for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) {
TemplateTreePane.getInstance().getTemplateFileTree().refresh();
}
}
@ -160,11 +150,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
if (OperatingSystem.isMacOS()) {
enableFullScreenMode(df);
}
df.addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent e) {
df.getSelectedJTemplate().requestGridFocus();
}
});
df.getSelectedJTemplate().requestGridFocus();
return isException;
}

13
designer-base/src/com/fr/start/SplashFxActionListener.java

@ -0,0 +1,13 @@
package com.fr.start;
/**
* 启动动画监听
* Created by zack on 2018/6/14.
*/
public interface SplashFxActionListener {
/**
* 启动动画关闭
*/
void splashClose();
}

8
designer-realize/src/com/fr/start/fx/SplashFx.java

@ -1,5 +1,7 @@
package com.fr.start.fx;
import com.fr.design.mainframe.DesignerContext;
import com.fr.start.SplashFxActionListener;
import com.fr.start.SplashStrategy;
import javafx.application.Application;
import javafx.application.Platform;
@ -31,6 +33,12 @@ public class SplashFx implements SplashStrategy {
}
});
fxWindow = SplashFxWindow.waitForStartUpTest();
fxWindow.addSplashActionListener(new SplashFxActionListener() {
@Override
public void splashClose() {
DesignerContext.getDesignerFrame().setVisible(true);
}
});
}
@Override

18
designer-realize/src/com/fr/start/fx/SplashFxWindow.java

@ -4,6 +4,7 @@ import com.bulenkov.iconloader.util.JBUI;
import com.fr.base.FRContext;
import com.fr.stable.OperatingSystem;
import com.fr.start.SplashContext;
import com.fr.start.SplashFxActionListener;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
@ -16,6 +17,8 @@ import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@ -46,6 +49,7 @@ public class SplashFxWindow extends Application {
private Text moduleInfo;
private Text thanks;
private List<SplashFxActionListener> listeners = new ArrayList<SplashFxActionListener>();
private static int uiScale(int i) {
return (int) (i * JBUI_INIT_SCALE);
@ -121,6 +125,7 @@ public class SplashFxWindow extends Application {
public void run() {
try {
((Stage) moduleInfo.getScene().getWindow()).close();
fireSplashClose();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
@ -161,4 +166,17 @@ public class SplashFxWindow extends Application {
});
}
/**
* 添加一个动画状态监听
* @param listener
*/
public void addSplashActionListener(SplashFxActionListener listener) {
listeners.add(listener);
}
public void fireSplashClose() {
for (SplashFxActionListener listener : listeners) {
listener.splashClose();
}
}
}

6
designer-realize/src/com/fr/start/module/DesignerStartup.java

@ -2,6 +2,7 @@ package com.fr.start.module;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvEvent;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.Listener;
import com.fr.module.Activator;
@ -27,10 +28,11 @@ public class DesignerStartup extends Activator {
startSub(EnvBasedModule.class);
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv();
registerEnvListener();
//启动设计器界面
designer.show(args);
DesignerContext.getDesignerFrame().setVisible(true);
//启动画面结束
SplashContext.getInstance().hide();
//启动设计器界面
designer.show(args);
startSub(StartFinishActivator.class);
}

Loading…
Cancel
Save