xiaoxia 8 years ago
parent
commit
cb2d8a6303
  1. 17
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java
  2. 9
      designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java

17
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java

@ -1,6 +1,7 @@
package com.fr.design.actions.help.AlphaFine; package com.fr.design.actions.help.AlphaFine;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -11,6 +12,7 @@ import javax.swing.*;
* Created by XiaXiang on 2017/4/5. * Created by XiaXiang on 2017/4/5.
*/ */
public class AlphafineConfigManager implements XMLable { public class AlphafineConfigManager implements XMLable {
/** /**
* 是否开启alphafine * 是否开启alphafine
*/ */
@ -19,12 +21,12 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 是否联网搜索 * 是否联网搜索
*/ */
private boolean isSearchOnLine; private boolean isSearchOnLine = true;
/** /**
* 快捷键设置 * 快捷键设置
*/ */
private String shortcuts = OperatingSystem.isMacOS()? "meta + F" : "ctr + F"; private String shortcuts;
/** /**
* 搜索范围 * 搜索范围
@ -43,7 +45,7 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 帮助文档 * 帮助文档
*/ */
private boolean isContainDocument; private boolean isContainDocument = true;
/** /**
* 模板 * 模板
@ -58,7 +60,7 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 应用中心 * 应用中心
*/ */
private boolean isContainPlugin; private boolean isContainPlugin = true;
/** /**
* 快捷键 * 快捷键
@ -122,9 +124,16 @@ public class AlphafineConfigManager implements XMLable {
} }
public String getShortcuts() { public String getShortcuts() {
if (StringUtils.isBlank(shortcuts)) {
return getDefaultShortCuts();
}
return shortcuts; return shortcuts;
} }
private String getDefaultShortCuts() {
return OperatingSystem.isMacOS()? "meta + F" : "ctrl + F";
}
public void setShortcuts(String shortcuts) { public void setShortcuts(String shortcuts) {
this.shortcuts = shortcuts; this.shortcuts = shortcuts;
this.shortCutKeyStore = convert2KeyStroke(this.shortcuts); this.shortCutKeyStore = convert2KeyStroke(this.shortcuts);

9
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java

@ -45,6 +45,11 @@ public class AlphafineConfigPane extends BasicPane {
private static final String DISPLAY_EQUALS = "+"; private static final String DISPLAY_EQUALS = "+";
private static final String MINUS = "MINUS"; private static final String MINUS = "MINUS";
private static final String DISPLAY_MINUS = "-"; private static final String DISPLAY_MINUS = "-";
private static final String COMMAND = "META";
private static final String SMALL_COMMAND = "meta";
private static final String DISPLAY_COMMAND = "\u2318";
private static final double COLUMN_GAP = 180; private static final double COLUMN_GAP = 180;
private static final double ROW_GAP = 25; private static final double ROW_GAP = 25;
private KeyStroke shortCutKeyStore = null; private KeyStroke shortCutKeyStore = null;
@ -160,7 +165,7 @@ public class AlphafineConfigPane extends BasicPane {
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine()); this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainConcludeCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.shortcutsField.setText(alphafineConfigManager.getShortcuts()); this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts());
} }
@ -191,7 +196,7 @@ public class AlphafineConfigPane extends BasicPane {
return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH)
.replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET)
.replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE) .replace(COMMA, DISPLAY_COMMA).replace(PERIOD, DISPLAY_PERIOD).replace(SEMICOLON, DISPLAY_SEMICOLON).replace(QUOTE, DISPLAY_QUOTE)
.replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS); .replace(EQUALS, DISPLAY_EQUALS).replace(MINUS, DISPLAY_MINUS).replace(COMMAND, DISPLAY_COMMAND).replace(SMALL_COMMAND, DISPLAY_COMMAND);
} }

Loading…
Cancel
Save