Browse Source

REPORT-28830 提示优化

feature/big-screen
hades 5 years ago
parent
commit
630e28c147
  1. 21
      designer-base/src/main/java/com/fr/common/report/ReportState.java
  2. 11
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 9
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java
  4. 26
      designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

21
designer-base/src/main/java/com/fr/common/report/ReportState.java

@ -0,0 +1,21 @@
package com.fr.common.report;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/27
*/
public enum ReportState {
STOP("stop"), ACTIVE("active");
private String value;
ReportState(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
}

11
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -1,5 +1,6 @@
package com.fr.design; package com.fr.design;
import com.fr.common.report.ReportState;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -24,6 +25,9 @@ import com.fr.json.JSONArray;
import com.fr.license.exception.RegistEditionException; import com.fr.license.exception.RegistEditionException;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.rpc.Result; import com.fr.rpc.Result;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
@ -407,6 +411,10 @@ public class EnvChangeEntrance {
@Override @Override
public void doOk() { public void doOk() {
ProcessEventPipe pipe = FineProcessContext.getParentPipe();
if (FineProcessContext.getParentPipe() != null) {
pipe.fire(new CarryMessageEvent(ReportState.ACTIVE.getValue()));
}
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
} }
@ -414,7 +422,8 @@ public class EnvChangeEntrance {
@Override @Override
public void doCancel() { public void doCancel() {
DesignerExiter.getInstance().execute(); } DesignerExiter.getInstance().execute();
}
}); });
envListDialog.setVisible(true); envListDialog.setVisible(true);
} }

9
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -1,5 +1,6 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.common.report.ReportState;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -8,6 +9,9 @@ import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage; import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -67,6 +71,10 @@ public class DesignerWorkspaceGenerator {
enum RemoteHandler { enum RemoteHandler {
SELF; SELF;
public static void handle(DesignerWorkspaceInfo config) { public static void handle(DesignerWorkspaceInfo config) {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getId(), StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getId(),
DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getMessage(), DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getMessage(),
StringUtils.EMPTY); StringUtils.EMPTY);
@ -85,7 +93,6 @@ public class DesignerWorkspaceGenerator {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
} }
} }
} }

26
designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

@ -1,5 +1,6 @@
package com.fr.start; package com.fr.start;
import com.fr.common.report.ReportState;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.dialog.ErrorDialog; import com.fr.design.dialog.ErrorDialog;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -9,12 +10,14 @@ import com.fr.design.utils.DesignUtils;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.general.ComparatorUtils;
import com.fr.process.FineProcess; import com.fr.process.FineProcess;
import com.fr.process.ProcessEventPipe; import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
@ -33,10 +36,12 @@ public class DesignerSuperListener {
private static final int FIXED_FREQ = 2; private static final int FIXED_FREQ = 2;
private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener")); private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener"));
private final ExecutorService helpService = Executors.newSingleThreadExecutor( new NamedThreadFactory("DesignerSuperListener-Help"));
private FineProcess process; private FineProcess process;
private ScheduledFuture fixedFuture; private ScheduledFuture fixedFuture;
private ScheduledFuture onceFuture; private ScheduledFuture onceFuture;
private volatile boolean cancel = false;
private DesignerSuperListener() { private DesignerSuperListener() {
@ -49,6 +54,7 @@ public class DesignerSuperListener {
public void start() { public void start() {
process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE); process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE);
startExitListener(); startExitListener();
startHelpLister();
startFrameListener(); startFrameListener();
startFallBackListener(); startFallBackListener();
} }
@ -62,6 +68,24 @@ public class DesignerSuperListener {
}); });
} }
private void startHelpLister() {
helpService.submit(new Runnable() {
@Override
public void run() {
while (!cancel) {
ProcessEventPipe pipe = process.getPipe();
String msg = pipe.info();
if (ComparatorUtils.equals(ReportState.STOP.getValue(), msg)) {
onceFuture.cancel(false);
}
if (ComparatorUtils.equals(ReportState.ACTIVE.getValue(), msg)) {
startFrameListener();
}
}
}
});
}
private void startFrameListener() { private void startFrameListener() {
onceFuture = service.schedule(new Runnable() { onceFuture = service.schedule(new Runnable() {
@Override @Override
@ -138,10 +162,12 @@ public class DesignerSuperListener {
public void stopTask() { public void stopTask() {
onceFuture.cancel(false); onceFuture.cancel(false);
fixedFuture.cancel(false); fixedFuture.cancel(false);
cancel = true;
} }
public void stop() { public void stop() {
stopTask(); stopTask();
service.shutdown(); service.shutdown();
helpService.shutdown();
} }
} }

Loading…
Cancel
Save