Browse Source

Merge branch 'feature/10.0' of ssh://cloud.finedevelop.com:7999/~lanlan/design into feature/10.0

feature/10.0
Lanlan 3 years ago
parent
commit
f15e9df331
  1. 11
      designer-base/src/main/java/com/fr/design/mod/ContentReplacerCenter.java
  2. 24
      designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java
  3. 26
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  4. 18
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  5. 26
      designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java
  6. 15
      designer-realize/src/main/java/com/fr/design/share/SharableManager.java

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

@ -30,6 +30,7 @@ import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -51,7 +52,7 @@ public class ContentReplacerCenter {
}
private List<ContentChange> contentChangeList = new ArrayList<>();
private List<ContentChangeItem> items = new ArrayList<>();
private Map<ChangeItem, ContentChangeItem> itemsMap = new HashMap<>();
private ContentReplacerCenter() {
@ -61,21 +62,21 @@ public class ContentReplacerCenter {
if (param.getChangeMap().isEmpty()) {
return;
}
items.add(param);
itemsMap.put(param.getChangeItem(), param);
}
});
EventDispatcher.listen(TableDataModifyEvent.INSTANCE, new Listener<ContentChangeItem>() {
@Override
public void on(Event event, ContentChangeItem param) {
items.add(param);
itemsMap.put(param.getChangeItem(), param);
long start = System.currentTimeMillis();
ContentObjectManager.getInstance().searchObject(param.getObject());
FineLoggerFactory.getLogger().debug("search object spend {} ms", (System.currentTimeMillis() - start));
FineLoggerFactory.getLogger().debug("search result: {}", ContentObjectManager.getInstance().getObjectMap() == null
? null : ContentObjectManager.getInstance().getObjectMap().keySet());
List<ContentChangeItem> itemsCopy = new ArrayList<>(items);
items.clear();
List<ContentChangeItem> itemsCopy = new ArrayList<>(itemsMap.values());
itemsMap.clear();
onRename(itemsCopy, contentChangeList);
}
});

24
designer-base/src/main/java/com/fr/design/update/actions/SyncFileProcess.java

@ -5,6 +5,7 @@ import com.fr.decision.update.info.UpdateCallBack;
import com.fr.decision.update.info.UpdateProgressCallBack;
import com.fr.design.i18n.Toolkit;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.env.SyncFailedPluginsDialog;
import com.fr.json.JSONArray;
import com.fr.log.FineLoggerFactory;
import java.util.concurrent.ExecutionException;
@ -14,11 +15,12 @@ import javax.swing.SwingWorker;
public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
private String buildNo;
private JProgressBar bar;
private JSONArray syncFailedPlugins;
private SyncFailedPluginsDialog syncFailedPluginsDialog;
public SyncFileProcess(JProgressBar bar, String buildNo) {
public SyncFileProcess(JProgressBar bar, String buildNo, SyncFailedPluginsDialog syncFailedPluginsDialog) {
this.bar = bar;
this.buildNo = buildNo;
this.syncFailedPluginsDialog = syncFailedPluginsDialog;
}
@Override
@ -26,8 +28,19 @@ public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
UpdateCallBack callBack = new UpdateProgressCallBack(bar);
bar.setValue(0);
bar.setString(Toolkit.i18nText("Fine-Design_Basic_Sync_Plugins"));
syncFailedPlugins = VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
return SyncExecutor.getInstance().execute(callBack, buildNo);
JSONArray syncFailedPlugins = VersionCheckUtils.syncPlugins(VersionCheckUtils.checkLocalAndRemotePlugin());
if (syncFailedPlugins.size() > 0) {
syncFailedPluginsDialog.showSyncFailedPluginsInfo(syncFailedPlugins);
}
RecoverForDesigner recoverForDesigner = new RecoverForDesigner();
if (!recoverForDesigner.backup()) {
return false;
}
boolean result = SyncExecutor.getInstance().execute(callBack, buildNo);
if (!result) {
recoverForDesigner.recover();
}
return result;
}
@Override
@ -48,9 +61,6 @@ public abstract class SyncFileProcess extends SwingWorker<Boolean, Void> {
}
}
public JSONArray getSyncFailedPlugins(){
return syncFailedPlugins;
}
/**
* 下载成功

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

@ -2,13 +2,11 @@ package com.fr.design.versioncheck;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.NotificationDialog;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.env.CheckServiceDialog;
import com.fr.env.VersionCheckMessageDialog;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
@ -24,6 +22,7 @@ import com.fr.plugin.manage.control.PluginControllerHelper;
import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.report.ReportHelper;
import com.fr.rpc.Result;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
@ -33,9 +32,6 @@ import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.lang.reflect.Method;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
@ -206,10 +202,7 @@ public class VersionCheckUtils {
}
private static boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv) {
if (selectedEnv.getType() == DesignerWorkspaceType.Remote) {
return true;
}
return false;
return selectedEnv.getType() == DesignerWorkspaceType.Remote;
}
public static JSONArray checkLocalAndRemotePlugin() {
@ -221,21 +214,26 @@ public class VersionCheckUtils {
localPluginsMap.put(pluginContext.getID(), pluginContext);
}
JSONObject remotePlugin;
Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap();
for (int i = 0; i < remotePlugins.size(); i++) {
remotePlugin = remotePlugins.getJSONObject(i);
if (localPluginsMap.containsKey(remotePlugin.getString(ID))) {
if (ComparatorUtils.equals(localPluginsMap.get(remotePlugin.getString(ID)).getVersion(), remotePlugin.getString(VERSION))) {
if (ComparatorUtils.equals(remotePlugin.getString("running"), "false")) {
continue;
}
String remotePluginID = remotePlugin.getString(ID);
if (localPluginsMap.containsKey(remotePluginID)) {
if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) {
continue;
} else {
if (remotePlugin.getString(NAME) == null) {
remotePlugin.put(NAME, localPluginsMap.get(remotePlugin.getString(ID)).getName());
remotePlugin.put(NAME, localPluginsMap.get(remotePluginID).getName());
}
remotePlugin.put("type", INCONSISTENCY);
}
} else {
remotePlugin.put("type", MISSING);
if (remotePlugin.getString(NAME) == null) {
remotePlugin.put(NAME, remotePlugin.getString("id"));
remotePlugin.put(NAME, pluginsNameMap.getOrDefault(remotePluginID, remotePluginID));
}
}
differentPlugins.put(remotePlugin);
@ -333,8 +331,10 @@ public class VersionCheckUtils {
@Override
public void done(PluginTaskResult result) {
latch.countDown();
if(result.isSuccess()) {
FineLoggerFactory.getLogger().info("installPlugin: " + result.getCurrentTask().getMarker().getPluginID());
}
}
});
}
try {

18
designer-base/src/main/java/com/fr/env/CheckServiceDialog.java vendored

@ -308,33 +308,31 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
private MouseListener syncButtonClickListener = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
ignoreButton.setEnabled(false);
String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")};
if (!jarConsistency) {
int a = FineJOptionPane.showOptionDialog(getParent(), Toolkit.i18nText("Fine-Design_Basic_Sync_Info_Information"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, IOUtils.readIcon("com/fr/design/icon/versioncheck/question.png"), option, 1);
if (0 == a) {
//jar包一致的话只更新插件
progressBar.setVisible(true);
progressBar.setString(Toolkit.i18nText("Fine-Design_Update_Info_Wait_Message"));
syncButton.setEnabled(false);
if (!jarConsistency) {
deletePreviousPropertyFile();
final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB);
final JFrame frame = DesignerContext.getDesignerFrame();
final RestartHelper helper = new RestartHelper();
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(DesignerContext.getDesignerFrame(),JSONArray.create());
new SyncFileProcess(progressBar, remoteBuildNo) {
SyncFailedPluginsDialog syncFailedPluginsDialog = new SyncFailedPluginsDialog(frame, JSONArray.create());
new SyncFileProcess(progressBar, remoteBuildNo, syncFailedPluginsDialog) {
@Override
public void onDownloadSuccess() {
deleteForDesignerUpdate(installLib);
progressBar.setVisible(false);
JSONArray syncFailedPlugins = getSyncFailedPlugins();
if (syncFailedPlugins.size() > 0) {
syncFailedPluginsDialog.showSyncFailedPluginsInfo(syncFailedPlugins);
syncFailedPluginsDialog.setVisible(true);
}
syncFailedPluginsDialog.showDialog();
if (!syncFailedPluginsDialog.restartClicked()) {
helper.restartForUpdate(frame);
}
}
@Override
public void onDownloadFailed() {
@ -345,6 +343,7 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
helper.restartForUpdate(frame);
}
}.execute();
}
} else {
//到这边说明主jar是一致的,就只尝试同步插件
new SwingWorker<JSONArray, Void>() {
@ -379,7 +378,6 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
}.execute();
}
}
}
};
private boolean deletePreviousPropertyFile() {

26
designer-base/src/main/java/com/fr/env/SyncFailedPluginsDialog.java vendored

@ -10,6 +10,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.json.JSONArray;
@ -25,6 +26,7 @@ import java.util.Locale;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@ -39,7 +41,11 @@ public class SyncFailedPluginsDialog extends JDialog {
private UILabel detailsLabel;
private JScrollPane scrollPane;
private UITextArea detailsTextArea;
public SyncFailedPluginsDialog(Frame parent, JSONArray syncFailedPlugins) {
private JFrame frame = DesignerContext.getDesignerFrame();
private RestartHelper restartHelper = new RestartHelper();
private UIButton restartButton;
private boolean show = false;
public SyncFailedPluginsDialog(JFrame parent, JSONArray syncFailedPlugins) {
super(parent, true);
JPanel body = FRGUIPaneFactory.createBorderLayout_L_Pane();
@ -79,7 +85,7 @@ public class SyncFailedPluginsDialog extends JDialog {
centerPanel.add(scrollPane,BorderLayout.CENTER);
JPanel southPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
UIButton restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Updater_Restart_Designer"));
restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Updater_Restart_Designer"));
restartButton.addMouseListener(restartButtonClickListener);
southPane.add(restartButton);
@ -104,6 +110,15 @@ public class SyncFailedPluginsDialog extends JDialog {
detailsText.append(plugin.getString("name")).append(",").append(Toolkit.i18nText("Fine-Design_Basic_Sync_Server_Version")).append(plugin.getString("version")).append("\n");
}
detailsTextArea.setText(detailsText.toString());
if(!ComparatorUtils.equals(detailsTextArea.getText(),StringUtils.EMPTY)){
show = true;
}
}
public void showDialog(){
if(show){
this.setVisible(true);
}
}
private MouseListener detailsLabelClickListener = new MouseAdapter() {
@ -119,10 +134,15 @@ public class SyncFailedPluginsDialog extends JDialog {
}
};
public boolean restartClicked(){
return !restartButton.isEnabled();
}
private MouseListener restartButtonClickListener = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
RestartHelper.restartForUpdate(DesignerContext.getDesignerFrame());
restartButton.setEnabled(false);
restartHelper.restartForUpdate(frame);
}
};
}

15
designer-realize/src/main/java/com/fr/design/share/SharableManager.java

@ -9,15 +9,21 @@ import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.collect.SharableCollectorManager;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler;
import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.share.utils.EffectItemUtils;
import com.fr.form.share.ShareLoader;
import com.fr.general.GeneralContext;
import com.fr.json.JSONArray;
import com.fr.stable.EnvChangedListener;
import java.util.List;
public class SharableManager {
public static void start() {
SharableCollectorManager.getInstance().execute();
listenEnv();
ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance());
ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance());
}
@ -44,4 +50,13 @@ public class SharableManager {
}
}
}
private static void listenEnv() {
GeneralContext.addEnvChangedListenerToLast(new EnvChangedListener() {
@Override
public void envChanged() {
LocalWidgetRepoPane.getInstance().refreshPane();
}
});
}
}

Loading…
Cancel
Save