Browse Source

REPORT-42550 预定义样式优化及与图表统一迭代

feature/big-screen
kerry 4 years ago
parent
commit
c286c649b9
  1. 1
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 4
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 38
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  4. 2
      designer-realize/src/main/java/com/fr/design/actions/server/predefined/ServerPredefinedStyleAction.java

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

@ -126,6 +126,7 @@ public class EnvChangeEntrance {
public void done() { public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName); DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame(); DesignUtils.refreshDesignerFrame();
DesignUtils.checkDesignerEnvMatch();
DesignTableDataManager.fireDSChanged(new HashMap<String, String>()); DesignTableDataManager.fireDSChanged(new HashMap<String, String>());
if (WorkContext.getCurrent().isLocal()) { if (WorkContext.getCurrent().isLocal()) {
//初始化一下serverTray //初始化一下serverTray

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

@ -163,7 +163,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private void setPredefinedInfo(boolean isNewFile){ private void setPredefinedInfo(boolean isNewFile){
if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) { if (this.template.getAttrMark(PredefinedStyleAttrMark.XML_TAG) == null) {
PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark(); PredefinedStyleAttrMark attrMark = PredefinedStyleAttrMark.createDefaultStyleMark();
if (!isNewFile || !DesignUtils.checkDesignerRemoteVersion()) { if (!isNewFile || !DesignUtils.isDesignerEnvMatch()) {
attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility")); attrMark.setPreferenceStyleName(InterProviderFactory.getProvider().getLocText("Fine-Engine_Predefined_Style_Compatibility"));
} }
this.template.addAttrMark(attrMark); this.template.addAttrMark(attrMark);
@ -1362,7 +1362,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
}); });
preferenceButton.setEnabled(DesignUtils.checkDesignerRemoteVersion()); preferenceButton.setEnabled(DesignUtils.isDesignerEnvMatch());
return preferenceButton; return preferenceButton;
} }

38
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -5,12 +5,17 @@ import com.fr.base.ServerConfig;
import com.fr.concurrent.NamedThreadFactory; import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -61,12 +66,27 @@ import java.util.concurrent.TimeoutException;
public class DesignUtils { public class DesignUtils {
private static int port = DesignerPort.getInstance().getMessagePort(); private static int port = DesignerPort.getInstance().getMessagePort();
static {
EventDispatcher.listen(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null aNull) {
checkDesignerEnvMatch();
}
});
}
private static boolean started = false; private static boolean started = false;
/**
* 设计器和工作目录环境版本是否匹配标志
*/
private static boolean designerEnvMatch = true;
private DesignUtils() { private DesignUtils() {
} }
public synchronized static void setPort(int port) { public synchronized static void setPort(int port) {
DesignUtils.port = port; DesignUtils.port = port;
} }
@ -75,6 +95,10 @@ public class DesignUtils {
return port; return port;
} }
public static boolean isDesignerEnvMatch() {
return designerEnvMatch;
}
/** /**
* 判断设计器有没有启动 * 判断设计器有没有启动
* *
@ -250,7 +274,6 @@ public class DesignUtils {
} }
public static void refreshDesignerFrame() { public static void refreshDesignerFrame() {
// 刷新DesignerFrame里面的面板 // 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@ -421,10 +444,10 @@ public class DesignUtils {
return true; return true;
} }
public static void checkDesignerEnvMatch(){
public static boolean checkDesignerRemoteVersion() {
if (WorkContext.getCurrent().isLocal()){ if (WorkContext.getCurrent().isLocal()){
return true; designerEnvMatch = true;
return;
} }
String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
DesignerWorkspaceInfo selectedEnv = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); DesignerWorkspaceInfo selectedEnv = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
@ -435,8 +458,9 @@ public class DesignUtils {
try { try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch(); remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (Exception e) { } catch (Exception e) {
return false; designerEnvMatch = false;
return;
} }
return localBranch.contains("#") && localBranch.equals(remoteBranch); designerEnvMatch = localBranch.contains("#") && localBranch.equals(remoteBranch);
} }
} }

2
designer-realize/src/main/java/com/fr/design/actions/server/predefined/ServerPredefinedStyleAction.java

@ -21,7 +21,7 @@ public class ServerPredefinedStyleAction extends SnapChatUpdateAction {
public ServerPredefinedStyleAction(SnapChatKey uniqueKey) { public ServerPredefinedStyleAction(SnapChatKey uniqueKey) {
super(uniqueKey); super(uniqueKey);
this.setEnabled(DesignUtils.checkDesignerRemoteVersion()); this.setEnabled(DesignUtils.isDesignerEnvMatch());
this.setMenuKeySet(PREDEFINED_STYLES); this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());

Loading…
Cancel
Save