kerry 8 years ago
parent
commit
6a32a6de24
  1. 10
      designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj
  2. 4
      designer/src/com/fr/design/actions/file/newReport/NewPolyReportAction.java
  3. 4
      designer/src/com/fr/design/actions/file/newReport/NewWorkBookAction.java
  4. 366
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  5. 12
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  6. 172
      designer/src/com/fr/design/mainframe/FormatBrushAction.java
  7. 7
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  8. 8
      designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  9. 28
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  10. 10
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java
  11. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine0.png
  12. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine1.png
  13. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine2.png
  14. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine3.png
  15. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine4.png
  16. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/alphafine5.png
  17. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/check.png
  18. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/open.png
  19. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/remind.png
  20. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/remind_close.png
  21. BIN
      designer/src/com/fr/design/mainframe/alphafine/images/uncheck.png
  22. 11
      designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java
  23. 4
      designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java
  24. 3
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java
  25. 8
      designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java
  26. 32
      designer/src/com/fr/grid/GridKeyListener.java
  27. 27
      designer/src/com/fr/grid/GridMouseAdapter.java
  28. 24
      designer_base/build.9.0.gradle
  29. 69
      designer_base/build.9.0.gradle.bak
  30. 53
      designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj
  31. 12
      designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj
  32. 21
      designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java
  33. 2
      designer_base/src/com/fr/design/DesignerEnvManager.java
  34. 4
      designer_base/src/com/fr/design/actions/edit/CopyAction.java
  35. 4
      designer_base/src/com/fr/design/actions/edit/CutAction.java
  36. 4
      designer_base/src/com/fr/design/actions/edit/PasteAction.java
  37. 3
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java
  38. 49
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java
  39. 20
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigPane.java
  40. 29
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java
  41. 8
      designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java
  42. 43
      designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java
  43. 146
      designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java
  44. 2
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  45. 30
      designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java
  46. 123
      designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java
  47. 59
      designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
  48. 8
      designer_base/src/com/fr/design/gui/frpane/UIAdvancedTextPane.java
  49. 8
      designer_base/src/com/fr/design/gui/icombobox/ExtendedComboBox.java
  50. 7
      designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java
  51. 49
      designer_base/src/com/fr/design/gui/ilist/CheckBoxList.java
  52. 1
      designer_base/src/com/fr/design/gui/ilist/UIList.java
  53. 14
      designer_base/src/com/fr/design/gui/itable/TableSorter.java
  54. 51
      designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
  55. 20
      designer_base/src/com/fr/design/gui/itextarea/UITextArea.java
  56. 38
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  57. 47
      designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java
  58. 3
      designer_base/src/com/fr/design/gui/itree/refreshabletree/UserObjectRefreshJTree.java
  59. 2
      designer_base/src/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaDefaultInputMap.java
  60. 24
      designer_base/src/com/fr/design/gui/syntax/ui/rtextarea/RTADefaultInputMap.java
  61. 3
      designer_base/src/com/fr/design/locale/designer.properties
  62. 3
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  63. 2
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  64. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  65. 5
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  66. 3
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  67. 35
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  68. 26
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  69. 8
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  70. 58
      designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java
  71. 20
      designer_base/src/com/fr/design/menu/KeySetUtils.java
  72. 3
      designer_base/src/com/fr/design/roleAuthority/UIRoleTreeUI.java
  73. 24
      designer_chart/build.9.0.gradle
  74. 69
      designer_chart/build.9.0.gradle.bak
  75. 8
      designer_chart/src/com/fr/aspectj/designerchart/TemplateProcessTracker.aj
  76. 42
      designer_form/build.9.0.gradle
  77. 83
      designer_form/build.9.0.gradle.bak
  78. 8
      designer_form/src/com/fr/aspectj/designerform/TemplateProcessTracker.aj
  79. 4
      designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java
  80. 4
      designer_form/src/com/fr/design/designer/beans/actions/CutAction.java
  81. 4
      designer_form/src/com/fr/design/designer/beans/actions/PasteAction.java
  82. 5
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java
  83. 4
      designer_form/src/com/fr/design/mainframe/actions/NewFormAction.java
  84. 15
      designer_form/src/com/fr/design/mainframe/widget/editors/DataTableConfigPane.java

10
designer/src/com/fr/aspectj/designer/TemplateProcessTracker.aj

@ -35,19 +35,19 @@ public aspect TemplateProcessTracker {
// String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); // String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
before(ActionEvent e) : onActionPerformed(e) { before(ActionEvent e) : onActionPerformed(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
// !within(LogHandlerBar) 没用, 手动过滤 // !within(LogHandlerBar) 没用, 手动过滤
if (e.getSource().toString().contains("javax.swing.Timer")) { if (e != null && e.getSource().toString().contains("javax.swing.Timer")) {
return; return;
} }
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
@ -56,7 +56,7 @@ public aspect TemplateProcessTracker {
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); //String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c);
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
@ -66,7 +66,7 @@ public aspect TemplateProcessTracker {
// String v = "test"; // String v = "test";
//String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement()); //String log = String.format("%s:\n%s\nset value: %s at %s\n\n", new Date(), sl, v, g.getEditingCellElement());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }

4
designer/src/com/fr/design/actions/file/newReport/NewPolyReportAction.java

@ -11,13 +11,15 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JPolyWorkBook; import com.fr.design.mainframe.JPolyWorkBook;
import com.fr.general.Inter; import com.fr.general.Inter;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class NewPolyReportAction extends UpdateAction { public class NewPolyReportAction extends UpdateAction {
public NewPolyReportAction() { public NewPolyReportAction() {
this.setName(Inter.getLocText("M-New_Multi_Report")); this.setName(Inter.getLocText("M-New_Multi_Report"));
this.setMnemonic('F'); this.setMnemonic('F');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/formExport.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/formExport.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, DEFAULT_MODIFIER));
} }
/** /**

4
designer/src/com/fr/design/actions/file/newReport/NewWorkBookAction.java

@ -12,6 +12,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class NewWorkBookAction extends UpdateAction { public class NewWorkBookAction extends UpdateAction {
public NewWorkBookAction() { public NewWorkBookAction() {
@ -47,7 +49,7 @@ public class NewWorkBookAction extends UpdateAction {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_N, DEFAULT_MODIFIER);
} }
}; };

366
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

File diff suppressed because one or more lines are too long

12
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -127,6 +127,8 @@ import com.fr.stable.ColumnRow;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* This class used to edit Report. * This class used to edit Report.
*/ */
@ -280,7 +282,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
} }
}); });
formatBrush.registerKeyboardAction(keyListener, KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); formatBrush.registerKeyboardAction(keyListener, KeyStroke.getKeyStroke(KeyEvent.VK_B, DEFAULT_MODIFIER), JComponent.WHEN_IN_FOCUSED_WINDOW);
formatBrush.registerKeyboardAction(escKey, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); formatBrush.registerKeyboardAction(escKey, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
} }
@ -855,7 +857,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
// clearReportPage old values. // clearReportPage old values.
inputMapAncestor.clear(); inputMapAncestor.clear();
actionMap.clear(); actionMap.clear();
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK), "cut"); inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), "cut");
actionMap.put("cut", new AbstractAction() { actionMap.put("cut", new AbstractAction() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (cut()) { if (cut()) {
@ -863,13 +865,13 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
} }
}); });
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), "copy"); inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy");
actionMap.put("copy", new AbstractAction() { actionMap.put("copy", new AbstractAction() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
copy(); copy();
} }
}); });
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), "paste"); inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), "paste");
actionMap.put("paste", new AbstractAction() { actionMap.put("paste", new AbstractAction() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (paste()) { if (paste()) {
@ -887,7 +889,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
} }
}); });
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK), "delete_all"); inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, DEFAULT_MODIFIER), "delete_all");
actionMap.put("delete_all", new AbstractAction() { actionMap.put("delete_all", new AbstractAction() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (clearAll()) { if (clearAll()) {

172
designer/src/com/fr/design/mainframe/FormatBrushAction.java

File diff suppressed because one or more lines are too long

7
designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -8,12 +8,15 @@ import com.fr.stable.StringUtils;
* Created by XiaXiang on 2017/5/8. * Created by XiaXiang on 2017/5/8.
*/ */
public class AlphaFineHelper { public class AlphaFineHelper {
private static AlphaFineDialog dialog;
/** /**
* 弹出alphafine搜索面板 * 弹出alphafine搜索面板
*/ */
public static void showAlphaFineDialog() { public static void showAlphaFineDialog(boolean forceOpen) {
AlphaFineDialog dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame()); if (dialog == null) {
dialog = new AlphaFineDialog(DesignerContext.getDesignerFrame(), forceOpen);
}
dialog.setVisible(true); dialog.setVisible(true);
} }

8
designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java

@ -11,7 +11,7 @@ import java.io.Serializable;
/** /**
* Created by XiaXiang on 2017/4/20. * Created by XiaXiang on 2017/4/20.
*/ */
public class ActionModel extends AlphaCellModel implements Serializable { public class ActionModel extends AlphaCellModel {
private Action action; private Action action;
private String actionName; private String actionName;
@ -38,6 +38,12 @@ public class ActionModel extends AlphaCellModel implements Serializable {
return action != null ? action.hashCode() : 0; return action != null ? action.hashCode() : 0;
} }
public ActionModel(String name, String description, Action action) {
super(name, null, CellType.ACTION);
this.action = action;
this.setDescription(description);
}
public ActionModel(String name, Action action) { public ActionModel(String name, Action action) {
super(name, null, CellType.ACTION); super(name, null, CellType.ACTION);
this.action = action; this.action = action;

28
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -68,8 +68,10 @@ public class AlphaFineDialog extends UIDialog {
private JList searchResultList; private JList searchResultList;
private SearchListModel searchListModel; private SearchListModel searchListModel;
private SwingWorker searchWorker; private SwingWorker searchWorker;
//是否强制打开,因为面板是否关闭绑定了全局鼠标事件,这里需要处理一下
private boolean foreOpen;
public AlphaFineDialog(Frame parent) { public AlphaFineDialog(Frame parent, boolean foreOpen) {
super(parent); super(parent);
initProperties(); initProperties();
initListener(); initListener();
@ -249,11 +251,9 @@ public class AlphaFineDialog extends UIDialog {
int selectedIndex = searchResultList.getSelectedIndex(); int selectedIndex = searchResultList.getSelectedIndex();
Object selectedValue = searchResultList.getSelectedValue(); Object selectedValue = searchResultList.getSelectedValue();
if (e.getClickCount() == 2) { if (e.getClickCount() == 2) {
final int i = searchResultList.locationToIndex(e.getPoint());
searchResultList.setSelectedIndex(i);
doNavigate(selectedIndex); doNavigate(selectedIndex);
if (selectedValue instanceof AlphaCellModel) { if (selectedValue instanceof AlphaCellModel) {
saveHistory(searchText, (AlphaCellModel) selectedValue); saveHistory((AlphaCellModel) selectedValue);
} }
} else if (e.getClickCount() == 1) { } else if (e.getClickCount() == 1) {
if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) { if (selectedValue instanceof MoreModel && ((MoreModel) selectedValue).isNeedMore()) {
@ -278,7 +278,11 @@ public class AlphaFineDialog extends UIDialog {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
Object selectedValue = searchResultList.getSelectedValue();
doNavigate(searchResultList.getSelectedIndex()); doNavigate(searchResultList.getSelectedIndex());
if (searchResultList.getSelectedValue() instanceof AlphaCellModel) {
saveHistory((AlphaCellModel) selectedValue);
}
} }
} }
}); });
@ -480,8 +484,9 @@ public class AlphaFineDialog extends UIDialog {
Point p = k.getLocationOnScreen(); Point p = k.getLocationOnScreen();
Rectangle dialogRectangle = AlphaFineDialog.this.getBounds(); Rectangle dialogRectangle = AlphaFineDialog.this.getBounds();
Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize()); Rectangle paneRectangle = new Rectangle(AlphaFinePane.createAlphaFinePane().getLocationOnScreen(), AlphaFinePane.createAlphaFinePane().getSize());
if (!dialogRectangle.contains(p) && !paneRectangle.contains(p)) { if (!dialogRectangle.contains(p) && !paneRectangle.contains(p) && !foreOpen) {
AlphaFineDialog.this.dispose(); AlphaFineDialog.this.dispose();
foreOpen = false;
} }
} }
} }
@ -512,7 +517,7 @@ public class AlphaFineDialog extends UIDialog {
} }
private static void doClickAction() { private static void doClickAction() {
AlphaFineHelper.showAlphaFineDialog(); AlphaFineHelper.showAlphaFineDialog(false);
} }
@ -553,10 +558,10 @@ public class AlphaFineDialog extends UIDialog {
/** /**
* 保存本地本地常用 * 保存本地本地常用
* @param searchText
* @param cellModel * @param cellModel
*/ */
private void saveHistory(String searchText, AlphaCellModel cellModel) { private void saveHistory(AlphaCellModel cellModel) {
String searchText = searchTextField.getText();
RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger(); RecentSearchManager recentSearchManager = RecentSearchManager.getRecentSearchManger();
recentSearchManager.addRecentModel(searchText, cellModel); recentSearchManager.addRecentModel(searchText, cellModel);
recentSearchManager.saveXMLFile(); recentSearchManager.saveXMLFile();
@ -661,4 +666,11 @@ public class AlphaFineDialog extends UIDialog {
} }
public boolean isForeOpen() {
return foreOpen;
}
public void setForeOpen(boolean foreOpen) {
this.foreOpen = foreOpen;
}
} }

10
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java

@ -2,6 +2,8 @@ package com.fr.design.mainframe.alphafine.component;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphafineContext;
import com.fr.design.actions.help.alphafine.AlphafineListener;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
@ -37,7 +39,13 @@ public class AlphaFinePane extends BasicPane {
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
AlphaFineHelper.showAlphaFineDialog(); AlphaFineHelper.showAlphaFineDialog(false);
}
});
AlphafineContext.addAlphafineContextListener(new AlphafineListener() {
@Override
public void showDialog() {
AlphaFineHelper.showAlphaFineDialog(true);
} }
}); });
} }

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine0.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 418 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 372 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 248 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 369 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/alphafine5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

BIN
designer/src/com/fr/design/mainframe/alphafine/images/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/open.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/remind.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/remind_close.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
designer/src/com/fr/design/mainframe/alphafine/images/uncheck.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

11
designer/src/com/fr/design/mainframe/alphafine/search/manager/ActionSearchManager.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.ActionModel;
import com.fr.design.mainframe.alphafine.model.SearchResult; import com.fr.design.mainframe.alphafine.model.SearchResult;
import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.mainframe.toolbar.UpdateActionModel;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -35,10 +36,12 @@ public class ActionSearchManager implements AlphaFineSearchProcessor {
lessModelList = new SearchResult(); lessModelList = new SearchResult();
moreModelList = new SearchResult(); moreModelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainAction()) {
List<UpdateAction> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions(); List<UpdateActionModel> updateActions = UpdateActionManager.getUpdateActionManager().getUpdateActions();
for (UpdateAction updateAction : updateActions) { for (UpdateActionModel updateActionModel : updateActions) {
if (updateAction.getName() != null && updateAction.getName().toLowerCase().contains(searchText.toLowerCase())) { if (updateActionModel.getActionName() != null) {
filterModelList.add(new ActionModel(updateAction.getName() ,updateAction)); if (updateActionModel.getActionName().toLowerCase().contains(searchText.toLowerCase()) || updateActionModel.getParentName().toLowerCase().contains(searchText.toLowerCase())) {
filterModelList.add(new ActionModel(updateActionModel.getActionName(), updateActionModel.getParentName(), updateActionModel.getAction()));
}
} }
} }
if (filterModelList != null && filterModelList.size() > 0) { if (filterModelList != null && filterModelList.size() > 0) {

4
designer/src/com/fr/design/mainframe/alphafine/search/manager/AlphaSearchManager.java

@ -37,12 +37,12 @@ public class AlphaSearchManager implements AlphaFineSearchProcessor {
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
SearchResult recentModelList = recentSearchManager.getLessSearchResult(searchText); SearchResult recentModelList = recentSearchManager.getLessSearchResult(searchText);
SearchResult concludeModelList = recommendSearchManager.getLessSearchResult(searchText); SearchResult recommendModelList = recommendSearchManager.getLessSearchResult(searchText);
SearchResult actionModelList = actionSearchManager.getLessSearchResult(searchText); SearchResult actionModelList = actionSearchManager.getLessSearchResult(searchText);
SearchResult fileModelList = fileSearchManager.getLessSearchResult(searchText); SearchResult fileModelList = fileSearchManager.getLessSearchResult(searchText);
SearchResult documentModelList = documentSearchManager.getLessSearchResult(searchText); SearchResult documentModelList = documentSearchManager.getLessSearchResult(searchText);
SearchResult pluginModelList = pluginSearchManager.getLessSearchResult(searchText); SearchResult pluginModelList = pluginSearchManager.getLessSearchResult(searchText);
recentModelList.addAll(concludeModelList); recentModelList.addAll(recommendModelList);
recentModelList.addAll(actionModelList); recentModelList.addAll(actionModelList);
recentModelList.addAll(fileModelList); recentModelList.addAll(fileModelList);
recentModelList.addAll(documentModelList); recentModelList.addAll(documentModelList);

3
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java

@ -97,7 +97,10 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear
private void addModelToList(List<AlphaCellModel> list, String name) { private void addModelToList(List<AlphaCellModel> list, String name) {
try { try {
AlphaCellModel model = CellModelHelper.getModelFromJson(new JSONObject(name));
if (model != null) {
list.add(CellModelHelper.getModelFromJson(new JSONObject(name))); list.add(CellModelHelper.getModelFromJson(new JSONObject(name)));
}
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error(e.getMessage());
} }

8
designer/src/com/fr/design/mainframe/alphafine/search/manager/RecommendSearchManager.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.alphafine.search.manager; package com.fr.design.mainframe.alphafine.search.manager;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.cell.CellModelHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper;
import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel;
import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel;
@ -29,8 +30,9 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
} }
@Override @Override
public synchronized SearchResult getLessSearchResult(String searchText) { public synchronized SearchResult getLessSearchResult(String searchText) {
String result;
this.modelList = new SearchResult(); this.modelList = new SearchResult();
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isContainRecommend()) {
String result;
HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText)); HttpClient httpClient = new HttpClient(SEARCHAPI + CodeUtils.cjkEncode(searchText));
httpClient.asGet(); httpClient.asGet();
httpClient.setTimeout(5000); httpClient.setTimeout(5000);
@ -53,11 +55,13 @@ public class RecommendSearchManager implements AlphaFineSearchProcessor {
} }
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FRLogger.getLogger().error("data transform error! :" + e.getMessage());
} }
if (modelList.size() > 0) { if (modelList.size() > 0) {
modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false)); modelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_AlphaFine_Conclude"), false));
} }
}
return modelList; return modelList;
} }

32
designer/src/com/fr/grid/GridKeyListener.java

@ -1,22 +1,23 @@
package com.fr.grid; package com.fr.grid;
import java.awt.Toolkit; import com.fr.common.inputevent.InputEventBaseOnOS;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/** /**
*
* @editor zhou * @editor zhou
* @since 2012-3-23上午10:55:36 * @since 2012-3-23上午10:55:36
*/ */
public class GridKeyListener implements KeyListener { public class GridKeyListener implements KeyListener {
private static final int DIFF = 48; // 103 - 55 = 48, 小键盘和大键盘数字的差值 48
private static final int DELAY = 32;
private Grid grid; private Grid grid;
// Keypressed last time // Keypressed last time
private long keyPressedLastTime = 0; private long keyPressedLastTime = 0;
@ -30,8 +31,7 @@ public class GridKeyListener implements KeyListener {
if (!grid.isEnabled() || evt.isConsumed()) {// 如果用户在自己的KyeListener里面consume了.就不执行下面的代码了. if (!grid.isEnabled() || evt.isConsumed()) {// 如果用户在自己的KyeListener里面consume了.就不执行下面的代码了.
return; return;
} }
KeyEvent newEvt = KeyEventWork.processKeyEvent(evt); if (KeyEventWork.processKeyEvent(evt) == null) {
if (newEvt == null) {
return; return;
} }
long systemCurrentTime = System.currentTimeMillis(); long systemCurrentTime = System.currentTimeMillis();
@ -46,17 +46,14 @@ public class GridKeyListener implements KeyListener {
keyPressedLastTime = systemCurrentTime; keyPressedLastTime = systemCurrentTime;
} }
dealWithFloatSelection(reportPane, code); dealWithFloatSelection(reportPane, code);
} else { } else {
if (systemCurrentTime - keyPressedLastTime <= 32) { if (systemCurrentTime - keyPressedLastTime <= DELAY) {
return; return;
} else { } else {
keyPressedLastTime = systemCurrentTime; keyPressedLastTime = systemCurrentTime;
} }
dealWithCellSelection(evt, code); dealWithCellSelection(evt, code);
} }
switch (code) { switch (code) {
case KeyEvent.VK_PAGE_UP: {// page up case KeyEvent.VK_PAGE_UP: {// page up
reportPane.getVerticalScrollBar().setValue(Math.max(0, grid.getVerticalValue() - grid.getVerticalExtent())); reportPane.getVerticalScrollBar().setValue(Math.max(0, grid.getVerticalValue() - grid.getVerticalExtent()));
@ -70,14 +67,12 @@ public class GridKeyListener implements KeyListener {
} }
// Richie:Ctrl + A全选单元格 // Richie:Ctrl + A全选单元格
case KeyEvent.VK_A: case KeyEvent.VK_A:
if (code == KeyEvent.VK_A && evt.isControlDown()) { if (InputEventBaseOnOS.isControlDown(evt)) {
reportPane.setSelection(new CellSelection(0, 0, report.getColumnCount(), report.getRowCount())); reportPane.setSelection(new CellSelection(0, 0, report.getColumnCount(), report.getRowCount()));
isNeedRepaint = true;
} }
isNeedRepaint = true; isNeedRepaint = true;
break; break;
} }
if (isNeedRepaint) { if (isNeedRepaint) {
reportPane.repaint(); reportPane.repaint();
} }
@ -166,7 +161,7 @@ public class GridKeyListener implements KeyListener {
return; return;
} }
KeyEvent newEvt = KeyEventWork.processKeyEvent(evt); KeyEvent newEvt = KeyEventWork.processKeyEvent(evt);
if (newEvt == null || evt.isControlDown()) {// uneditable. if (newEvt == null || InputEventBaseOnOS.isControlDown(evt)) {// uneditable.
return; return;
} }
char ch = evt.getKeyChar(); char ch = evt.getKeyChar();
@ -187,8 +182,7 @@ public class GridKeyListener implements KeyListener {
if (grid.getCellEditor() != null && grid.editorComponent != null) { if (grid.getCellEditor() != null && grid.editorComponent != null) {
if (IS_NUM_PAD_KEY(code)) { if (IS_NUM_PAD_KEY(code)) {
// 103 - 55 = 48, 小键盘和大键盘数字的差值 48 KeyEvent ke = new KeyEvent(grid, KeyEvent.KEY_PRESSED, 0, 0, code - DIFF, ch);
KeyEvent ke = new KeyEvent(grid, KeyEvent.KEY_PRESSED, 0, 0, code - 48, ch);
grid.editorComponent.dispatchEvent(ke); grid.editorComponent.dispatchEvent(ke);
ke.consume(); ke.consume();
} else { } else {
@ -200,8 +194,10 @@ public class GridKeyListener implements KeyListener {
} }
} }
} }
/** /**
* 小键盘 * 小键盘
*
* @param code * @param code
* @return * @return
*/ */

27
designer/src/com/fr/grid/GridMouseAdapter.java

@ -1,26 +1,14 @@
package com.fr.grid; package com.fr.grid;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.present.CellWriteAttrPane; import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
@ -37,7 +25,12 @@ import com.fr.stable.ColumnRow;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX; import com.fr.stable.unit.OLDPIX;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.HashMap;
import java.util.Map;
/** /**
* the MouseListener of the Grid * the MouseListener of the Grid
@ -172,7 +165,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
ElementCasePane reportPane = grid.getElementCasePane(); ElementCasePane reportPane = grid.getElementCasePane();
TemplateElementCase report = reportPane.getEditingElementCase(); TemplateElementCase report = reportPane.getEditingElementCase();
boolean isShiftDown = evt.isShiftDown(); boolean isShiftDown = evt.isShiftDown();
boolean isControlDown = evt.isControlDown(); boolean isControlDown = InputEventBaseOnOS.isControlDown(evt);
int clickCount = evt.getClickCount(); int clickCount = evt.getClickCount();
// peter:需要判断是否在可移动CellSelection的区域 // peter:需要判断是否在可移动CellSelection的区域
grid.setDragType(isMoveCellSelection(this.oldEvtX, this.oldEvtY)); grid.setDragType(isMoveCellSelection(this.oldEvtX, this.oldEvtY));
@ -344,7 +337,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
return; return;
} }
boolean isControlDown = evt.isControlDown(); boolean isControlDown = InputEventBaseOnOS.isControlDown(evt);
long systemCurrentTime = System.currentTimeMillis(); long systemCurrentTime = System.currentTimeMillis();
if (systemCurrentTime - lastMouseMoveTime <= DRAG_REFRESH_TIME) {// alex:Drag if (systemCurrentTime - lastMouseMoveTime <= DRAG_REFRESH_TIME) {// alex:Drag

24
designer_base/build.9.0.gradle

@ -1,8 +1,28 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "https://maven.eveoh.nl/content/repositories/releases"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.6"
}
}
repositories {
mavenCentral()
}
project.ext {
aspectjVersion = '1.8.4'
}
apply plugin: 'aspectj'
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本

69
designer_base/build.9.0.gradle.bak

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-core'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

53
designer_base/src/com/fr/aspectj/designerbase/AlphaFineReminder.aj

@ -0,0 +1,53 @@
package com.fr.aspectj.designerbase;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphafineConfigManager;
import com.fr.design.actions.help.alphafine.RemindDialog;
import com.fr.design.mainframe.DesignerContext;
import java.awt.event.ActionEvent;
/**
* Created by XiaXiang on 2017/5/25.
*/
public aspect AlphaFineReminder {
pointcut onActionPerformed(ActionEvent e) :
execution(* actionPerformed(ActionEvent)) && args(e);
before(ActionEvent e) : onActionPerformed(e) {
String point = thisJoinPoint.toString();
if (e != null && e.getSource().toString().contains("javax.swing.Timer")) {
return;
}
if (e != null && e.getSource().getClass().getName().equals("com.fr.design.gui.imenu.UIMenuItem") && point.contains("com.fr.design.actions")) {
remind();
}
}
/**
* 判断是否弹出广告框
*/
private static void remind() {
AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager();
if (manager.isNeedRemind()) {
if (manager.getOperateCount() > 4) {
showReminderDialog();
} else {
manager.setOperateCount(manager.getOperateCount() + 1);
}
}
}
/**
* 弹框提醒使用AlphaFine
*/
private static void showReminderDialog() {
RemindDialog remindDialog = new RemindDialog(DesignerContext.getDesignerFrame());
remindDialog.setVisible(true);
}
}

12
designer_base/src/com/fr/aspectj/designerbase/TemplateProcessTracker.aj

@ -5,12 +5,10 @@ package com.fr.aspectj.designerbase;
* Created by plough on 2017/3/3. * Created by plough on 2017/3/3.
*/ */
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import org.aspectj.lang.reflect.SourceLocation; import org.aspectj.lang.reflect.SourceLocation;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Date;
public aspect TemplateProcessTracker { public aspect TemplateProcessTracker {
//声明一个pointcut,匹配你需要的方法 //声明一个pointcut,匹配你需要的方法
@ -32,28 +30,28 @@ public aspect TemplateProcessTracker {
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
before(ActionEvent e): onActionPerformed(e) { before(ActionEvent e): onActionPerformed(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
// !within(LogHandlerBar) 没用, 手动过滤 // !within(LogHandlerBar) 没用, 手动过滤
if (e.getSource().toString().contains("javax.swing.Timer")) { if (e != null && e.getSource().toString().contains("javax.swing.Timer")) {
return; return;
} }
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
before(Object v, int r, int c): onSetValueAt(v, r, c) { before(Object v, int r, int c): onSetValueAt(v, r, c) {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); //String log getSourceLocation= String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c);
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); // TemplateInfoCollector.appendProcess(log);
} }

21
designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java

@ -0,0 +1,21 @@
package com.fr.common.inputevent;
import com.fr.stable.OperatingSystem;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
/**
* Created by hzzz on 2017/5/26.
*/
public class InputEventBaseOnOS {
private static final boolean IS_MACOS = OperatingSystem.isMacOS();
public static boolean isControlDown(MouseEvent e) {
return IS_MACOS ? e.isMetaDown() : e.isControlDown();
}
public static boolean isControlDown(KeyEvent e) {
return IS_MACOS ? e.isMetaDown() : e.isControlDown();
}
}

2
designer_base/src/com/fr/design/DesignerEnvManager.java

@ -5,7 +5,7 @@ package com.fr.design;
import com.fr.base.*; import com.fr.base.*;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.actions.help.AlphaFine.AlphafineConfigManager; import com.fr.design.actions.help.alphafine.AlphafineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.env.SignIn; import com.fr.env.SignIn;

4
designer_base/src/com/fr/design/actions/edit/CopyAction.java

@ -11,6 +11,8 @@ import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Copy. * Copy.
*/ */
@ -21,7 +23,7 @@ public class CopyAction extends TemplateComponentAction {
this.setName(Inter.getLocText("M_Edit-Copy")); this.setName(Inter.getLocText("M_Edit-Copy"));
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
} }
@Override @Override

4
designer_base/src/com/fr/design/actions/edit/CutAction.java

@ -12,6 +12,8 @@ import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.general.Inter; import com.fr.general.Inter;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Cut. * Cut.
*/ */
@ -25,7 +27,7 @@ public class CutAction extends TemplateComponentAction {
this.setName(Inter.getLocText("M_Edit-Cut")); this.setName(Inter.getLocText("M_Edit-Cut"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
} }
@Override @Override

4
designer_base/src/com/fr/design/actions/edit/PasteAction.java

@ -12,6 +12,8 @@ import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.general.Inter; import com.fr.general.Inter;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Paste. * Paste.
*/ */
@ -25,7 +27,7 @@ public class PasteAction extends TemplateComponentAction {
this.setName(Inter.getLocText("M_Edit-Paste")); this.setName(Inter.getLocText("M_Edit-Paste"));
this.setMnemonic('P'); this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER));
} }
@Override @Override

3
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineAction.java → designer_base/src/com/fr/design/actions/help/alphafine/AlphafineAction.java

@ -1,4 +1,4 @@
package com.fr.design.actions.help.AlphaFine; package com.fr.design.actions.help.alphafine;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -9,7 +9,6 @@ import com.fr.design.dialog.DialogActionListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;

49
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigManager.java → designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigManager.java

@ -1,4 +1,4 @@
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.StringUtils;
@ -35,7 +35,7 @@ public class AlphafineConfigManager implements XMLable {
/** /**
* 猜您需要 * 猜您需要
*/ */
private boolean isContainConclude; private boolean isContainRecommend;
/** /**
* 设置 * 设置
@ -67,6 +67,15 @@ public class AlphafineConfigManager implements XMLable {
*/ */
private KeyStroke shortCutKeyStore; private KeyStroke shortCutKeyStore;
/**
* 是否提醒
*/
private boolean isNeedRemind = true;
/**
* 直接操作菜单次数
*/
private int operateCount;
@ -88,11 +97,13 @@ public class AlphafineConfigManager implements XMLable {
this.setEnabled(reader.getAttrAsBoolean("isEnabled", true)); this.setEnabled(reader.getAttrAsBoolean("isEnabled", true));
this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true)); this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true));
this.setContainConclude(reader.getAttrAsBoolean("isContainConclude", true)); this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true));
this.setContainAction(reader.getAttrAsBoolean("isContainAction", true)); this.setContainAction(reader.getAttrAsBoolean("isContainAction", true));
this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true)); this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true));
this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false)); this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false));
this.setShortcuts(reader.getAttrAsString("shortcuts", "meta + f")); this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts()));
this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true));
this.setOperateCount(reader.getAttrAsInt("operateCount", 0));
} }
@ -104,12 +115,14 @@ public class AlphafineConfigManager implements XMLable {
writer.attr("isEnabled", this.isEnabled()) writer.attr("isEnabled", this.isEnabled())
.attr("isSearchOnline", this.isSearchOnLine()) .attr("isSearchOnline", this.isSearchOnLine())
.attr("shortcuts", this.getShortcuts()) .attr("shortcuts", this.getShortcuts())
.attr("isContainConclude", this.isContainConclude()) .attr("isContainRecommend", this.isContainRecommend())
.attr("isContainAction", this.isContainAction()) .attr("isContainAction", this.isContainAction())
.attr("isContainDocument", this.isContainDocument()) .attr("isContainDocument", this.isContainDocument())
.attr("isContainTemplate", this.isContainTemplate()) .attr("isContainTemplate", this.isContainTemplate())
.attr("isContainPlugin", this.isContainPlugin()) .attr("isContainPlugin", this.isContainPlugin())
.attr("isContainFileContent", this.isContainFileContent()); .attr("isContainFileContent", this.isContainFileContent())
.attr("isNeedRemind", this.isNeedRemind())
.attr("operateCount", this.getOperateCount());
writer.end(); writer.end();
} }
@ -176,12 +189,12 @@ public class AlphafineConfigManager implements XMLable {
this.isContainPlugin = containPlugin; this.isContainPlugin = containPlugin;
} }
public boolean isContainConclude() { public boolean isContainRecommend() {
return isContainConclude; return isContainRecommend;
} }
public void setContainConclude(boolean containConclude) { public void setContainRecommend(boolean containConclude) {
isContainConclude = containConclude; isContainRecommend = containConclude;
} }
public boolean isEnabled() { public boolean isEnabled() {
@ -214,4 +227,20 @@ public class AlphafineConfigManager implements XMLable {
public void setContainFileContent(boolean containFileContent) { public void setContainFileContent(boolean containFileContent) {
isContainFileContent = containFileContent; isContainFileContent = containFileContent;
} }
public boolean isNeedRemind() {
return isNeedRemind;
}
public void setNeedRemind(boolean needRemind) {
isNeedRemind = needRemind;
}
public int getOperateCount() {
return operateCount;
}
public void setOperateCount(int operateCount) {
this.operateCount = operateCount;
}
} }

20
designer_base/src/com/fr/design/actions/help/AlphaFine/AlphafineConfigPane.java → designer_base/src/com/fr/design/actions/help/alphafine/AlphafineConfigPane.java

@ -1,4 +1,4 @@
package com.fr.design.actions.help.AlphaFine; package com.fr.design.actions.help.alphafine;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -53,7 +53,7 @@ public class AlphafineConfigPane extends BasicPane {
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;
private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainConcludeCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox; private UICheckBox isEnabledCheckbox, isSearchOnlineCheckbox, isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox, isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox;
private UITextField shortcutsField; private UITextField shortcutsField;
public AlphafineConfigPane() { public AlphafineConfigPane() {
@ -73,7 +73,7 @@ public class AlphafineConfigPane extends BasicPane {
private Component[][] initsearchRangeComponents() { private Component[][] initsearchRangeComponents() {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isContainConcludeCheckbox, isContainActionCheckbox, isContainDocumentCheckbox}, new Component[]{isContainRecommendCheckbox, isContainActionCheckbox, isContainDocumentCheckbox},
new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox} new Component[]{isContainTemplateCheckbox, isContainPluginCheckbox, isContainFileContentCheckbox}
}; };
return components; return components;
@ -85,7 +85,7 @@ public class AlphafineConfigPane extends BasicPane {
double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP}; double[] columnSize = {COLUMN_GAP, COLUMN_GAP, COLUMN_GAP};
JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange")); JPanel northPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_AlphaFine_SearchRange"));
isContainConcludeCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Conclude")); isContainRecommendCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_AlphaFine_Conclude"));
isContainActionCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Set")); isContainActionCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_Set"));
isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon")); isContainPluginCheckbox = new UICheckBox(Inter.getLocText("FR-Designer-Plugin_Addon"));
isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP")); isContainDocumentCheckbox = new UICheckBox(Inter.getLocText("FR-Designer_COMMUNITY_HELP"));
@ -125,14 +125,14 @@ public class AlphafineConfigPane extends BasicPane {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (!isSearchOnlineCheckbox.isSelected()) { if (!isSearchOnlineCheckbox.isSelected()) {
isContainConcludeCheckbox.setEnabled(false); isContainRecommendCheckbox.setEnabled(false);
isContainPluginCheckbox.setEnabled(false); isContainPluginCheckbox.setEnabled(false);
isContainDocumentCheckbox.setEnabled(false); isContainDocumentCheckbox.setEnabled(false);
isContainConcludeCheckbox.setSelected(false); isContainRecommendCheckbox.setSelected(false);
isContainPluginCheckbox.setSelected(false); isContainPluginCheckbox.setSelected(false);
isContainDocumentCheckbox.setSelected(false); isContainDocumentCheckbox.setSelected(false);
} else { } else {
isContainConcludeCheckbox.setEnabled(true); isContainRecommendCheckbox.setEnabled(true);
isContainPluginCheckbox.setEnabled(true); isContainPluginCheckbox.setEnabled(true);
isContainDocumentCheckbox.setEnabled(true); isContainDocumentCheckbox.setEnabled(true);
} }
@ -163,8 +163,8 @@ public class AlphafineConfigPane extends BasicPane {
this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainDocumentCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setSelected(alphafineConfigManager.isContainPlugin() && alphafineConfigManager.isSearchOnLine());
this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainPluginCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setSelected(alphafineConfigManager.isContainConclude() && alphafineConfigManager.isSearchOnLine()); this.isContainRecommendCheckbox.setSelected(alphafineConfigManager.isContainRecommend() && alphafineConfigManager.isSearchOnLine());
this.isContainConcludeCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine()); this.isContainRecommendCheckbox.setEnabled(alphafineConfigManager.isSearchOnLine());
this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts())); this.shortcutsField.setText(getDisplayShortCut(alphafineConfigManager.getShortcuts()));
shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts()); shortCutKeyStore = convert2KeyStroke(alphafineConfigManager.getShortcuts());
} }
@ -175,7 +175,7 @@ public class AlphafineConfigPane extends BasicPane {
alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected()); alphafineConfigManager.setContainPlugin(this.isContainPluginCheckbox.isSelected());
alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected()); alphafineConfigManager.setContainAction(this.isContainActionCheckbox.isSelected());
alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected()); alphafineConfigManager.setContainDocument(this.isContainDocumentCheckbox.isSelected());
alphafineConfigManager.setContainConclude(this.isContainConcludeCheckbox.isSelected()); alphafineConfigManager.setContainRecommend(this.isContainRecommendCheckbox.isSelected());
alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected()); alphafineConfigManager.setEnabled(this.isEnabledCheckbox.isSelected());
alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected()); alphafineConfigManager.setSearchOnLine(this.isSearchOnlineCheckbox.isSelected());
alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected()); alphafineConfigManager.setContainTemplate(this.isContainTemplateCheckbox.isSelected());

29
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineContext.java

@ -0,0 +1,29 @@
package com.fr.design.actions.help.alphafine;
import java.util.ArrayList;
import java.util.List;
/**
* Created by XiaXiang on 2017/5/27.
*/
public class AlphafineContext {
private static List<AlphafineListener> fireLoginContextListener = new ArrayList<AlphafineListener>();
/**
* 触发AlphaFine弹窗
*/
public static void fireAlphaFineContextListener() {
for (AlphafineListener l : fireLoginContextListener) {
l.showDialog();
}
}
/**
* 添加一个弹出AlphaFine的监听事件
*
* @param l AlphaFine框弹出监听事件
*/
public static void addAlphafineContextListener(AlphafineListener l) {
fireLoginContextListener.add(l);
}
}

8
designer_base/src/com/fr/design/actions/help/alphafine/AlphafineListener.java

@ -0,0 +1,8 @@
package com.fr.design.actions.help.alphafine;
/**
* Created by XiaXiang on 2017/5/27.
*/
public interface AlphafineListener {
void showDialog();
}

43
designer_base/src/com/fr/design/actions/help/alphafine/RemindDialog.java

@ -0,0 +1,43 @@
package com.fr.design.actions.help.alphafine;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.*;
/**
* Created by XiaXiang on 2017/5/26.
*/
public class RemindDialog extends UIDialog {
private RemindPane remindPane;
private static final int WIDTH = 600;
private static final int HEIGHT = 400;
public RemindDialog(Frame parent) {
super(parent);
setUndecorated(true);
setSize(WIDTH, HEIGHT);
initComponent();
GUICoreUtils.centerWindow(this);
}
private void initComponent() {
final AlphafineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphafineConfigManager();
remindPane = new RemindPane(manager, this);
this.add(remindPane);
}
@Override
public void checkValid() throws Exception {
}
public RemindPane getRemindPane() {
return remindPane;
}
public void setRemindPane(RemindPane remindPane) {
this.remindPane = remindPane;
}
}

146
designer_base/src/com/fr/design/actions/help/alphafine/RemindPane.java

@ -0,0 +1,146 @@
package com.fr.design.actions.help.alphafine;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* Created by XiaXiang on 2017/5/26.
*/
public class RemindPane extends JPanel {
private UIButton openButton;
private JPanel backgroundPane;
private UILabel noRemindLabel;
private UILabel checkLabel;
private Icon checkIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/check.png");
private Icon unCheckIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/uncheck.png");
private Icon closeIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/remind_close.png");
private Icon labelIcon = IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/remind.png");
private Icon openIcon = IOUtils.readIcon("com/fr/design/mainframe/alphafine/images/open.png");
private static final int WIDTH = 600;
private static final int HEIGHT = 400;
private static final int CLOSE = 30;
private static final Rectangle OPEN = new Rectangle(30, 300, 150, 40);
private static final Rectangle REMIND = new Rectangle(95, 350, 100, 20);
private static final Rectangle CHECK = new Rectangle(70, 350, 20, 20);
public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12);
public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18);
public JComponent closeButton = new JComponent() {
protected void paintComponent(Graphics g) {
closeIcon.paintIcon(this, g, 0, 0);
}
};
public RemindPane(AlphafineConfigManager manager, UIDialog remindDialog) {
this.setPreferredSize(new Dimension(WIDTH, HEIGHT));
initUI(manager, remindDialog);
this.setLayout(getAbsoluteLayout());
}
/**
* 初始化面板
* @param manager
* @param dialog
*/
private void initUI(final AlphafineConfigManager manager, final UIDialog dialog) {
openButton = new UIButton();
openButton.setIcon(openIcon);
openButton.set4ToolbarButton();
openButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
manager.setOperateCount(0);
dialog.dispose();
AlphafineContext.fireAlphaFineContextListener();
}
});
noRemindLabel = new UILabel(Inter.getLocText("FR-Designer-Alphafine_No_Remind"));
noRemindLabel.setFont(MEDIUM_FONT);
noRemindLabel.setForeground(Color.white);
checkLabel = new UILabel();
checkLabel.setIcon(unCheckIcon);
checkLabel.addMouseListener(new MouseAdapter() {
private boolean isCheck = false;
@Override
public void mousePressed(MouseEvent e) {
if (isCheck) {
checkLabel.setIcon(unCheckIcon);
manager.setNeedRemind(true);
isCheck = false;
} else {
checkLabel.setIcon(checkIcon);
manager.setNeedRemind(false);
isCheck = true;
}
}
});
backgroundPane = new JPanel(new BorderLayout());
backgroundPane.add(new UILabel(labelIcon), BorderLayout.CENTER);
closeButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
manager.setOperateCount(0);
dialog.dispose();
}
});
add(closeButton, 0);
add(checkLabel, 1);
add(openButton, 2);
add(noRemindLabel, 3);
add(backgroundPane, 4);
}
/**
* 控件排列用绝对布局
* @return
*/
protected LayoutManager getAbsoluteLayout() {
return new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return parent.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return null;
}
@Override
public void layoutContainer(Container parent) {
int width = parent.getWidth();
int height = parent.getHeight();
closeButton.setBounds((width - CLOSE), 0, CLOSE, CLOSE);
openButton.setBounds(OPEN);
noRemindLabel.setBounds(REMIND);
checkLabel.setBounds(CHECK);
backgroundPane.setBounds(0, 0, width, height);
}
@Override
public void addLayoutComponent(String name, Component comp) {
}
};
}
}

2
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -146,7 +146,7 @@ public class LoginWebBridge {
if (res.equals(FAILED_MESSAGE_STATUS)) { if (res.equals(FAILED_MESSAGE_STATUS)) {
} else { } else {
JSONObject jo = new JSONObject(res); JSONObject jo = new JSONObject(res);
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) { if (jo.optString("status").equals(SUCCESS_MESSAGE_STATUS)) {
setMessageCount(Integer.parseInt(jo.getString("message"))); setMessageCount(Integer.parseInt(jo.getString("message")));
} }
} }

30
designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java

@ -10,6 +10,7 @@
package com.fr.design.gui.autocomplete; package com.fr.design.gui.autocomplete;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.PopupWindowDecorator; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.PopupWindowDecorator;
import com.fr.general.FRLogger;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
@ -40,6 +41,7 @@ import java.util.List;
class AutoCompletePopupWindow extends JWindow implements CaretListener, class AutoCompletePopupWindow extends JWindow implements CaretListener,
ListSelectionListener, MouseListener { ListSelectionListener, MouseListener {
private final static int DIS = 5;
/** /**
* The parent AutoCompletion instance. * The parent AutoCompletion instance.
*/ */
@ -179,7 +181,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
} else { } else {
doAutocomplete(); doAutocomplete();
} }
} else if (AutoCompletion.getDebug()) { } else if (AutoCompletion.isDebug()) {
Thread.dumpStack(); Thread.dumpStack();
} }
} }
@ -300,8 +302,8 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
*/ */
private void installKeyBindings() { private void installKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("PopupWindow: Installing keybindings"); FRLogger.getLogger().debug("PopupWindow: Installing keybindings");
} }
if (escapeKap == null) { // Lazily create actions. if (escapeKap == null) { // Lazily create actions.
@ -313,7 +315,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
ActionMap am = comp.getActionMap(); ActionMap am = comp.getActionMap();
replaceAction(im, am, KeyEvent.VK_ESCAPE, escapeKap, oldEscape); replaceAction(im, am, KeyEvent.VK_ESCAPE, escapeKap, oldEscape);
if (AutoCompletion.getDebug() && oldEscape.action == escapeKap.action) { if (AutoCompletion.isDebug() && oldEscape.action == escapeKap.action) {
Thread.dumpStack(); Thread.dumpStack();
} }
replaceAction(im, am, KeyEvent.VK_UP, upKap, oldUp); replaceAction(im, am, KeyEvent.VK_UP, upKap, oldUp);
@ -371,7 +373,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
*/ */
private void positionDescWindow() { private void positionDescWindow() {
boolean showDescWindow = descWindow != null && ac.getShowDescWindow(); boolean showDescWindow = descWindow != null && ac.isShowDescWindow();
if (!showDescWindow) { if (!showDescWindow) {
return; return;
} }
@ -387,14 +389,14 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
// Try to position to the right first (LTR) // Try to position to the right first (LTR)
int x; int x;
if (ac.getTextComponentOrientation().isLeftToRight()) { if (ac.getTextComponentOrientation().isLeftToRight()) {
x = getX() + getWidth() + 5; x = getX() + getWidth() + DIS;
if (x + descWindow.getWidth() > screenBounds.x + screenBounds.width) { // doesn't fit if (x + descWindow.getWidth() > screenBounds.x + screenBounds.width) { // doesn't fit
x = getX() - 5 - descWindow.getWidth(); x = getX() - DIS - descWindow.getWidth();
} }
} else { // RTL } else { // RTL
x = getX() - 5 - descWindow.getWidth(); x = getX() - DIS - descWindow.getWidth();
if (x < screenBounds.x) { // Doesn't fit if (x < screenBounds.x) { // Doesn't fit
x = getX() + getWidth() + 5; x = getX() + getWidth() + DIS;
} }
} }
@ -604,7 +606,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
Rectangle screenBounds = Util.getScreenBoundsForPoint(r.x, r.y); Rectangle screenBounds = Util.getScreenBoundsForPoint(r.x, r.y);
//Dimension screenSize = getToolkit().getScreenSize(); //Dimension screenSize = getToolkit().getScreenSize();
boolean showDescWindow = descWindow != null && ac.getShowDescWindow(); boolean showDescWindow = descWindow != null && ac.isShowDescWindow();
int totalH = getHeight(); int totalH = getHeight();
if (showDescWindow) { if (showDescWindow) {
totalH = Math.max(totalH, descWindow.getHeight()); totalH = Math.max(totalH, descWindow.getHeight());
@ -655,7 +657,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
installKeyBindings(); installKeyBindings();
lastLine = ac.getLineOfCaret(); lastLine = ac.getLineOfCaret();
selectFirstItem(); selectFirstItem();
if (descWindow == null && ac.getShowDescWindow()) { if (descWindow == null && ac.isShowDescWindow()) {
descWindow = createDescriptionWindow(); descWindow = createDescriptionWindow();
positionDescWindow(); positionDescWindow();
} }
@ -693,7 +695,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
// because of the way child JWindows' visibility is handled - in // because of the way child JWindows' visibility is handled - in
// some ways it's dependent on the parent, in other ways it's not. // some ways it's dependent on the parent, in other ways it's not.
if (descWindow != null) { if (descWindow != null) {
descWindow.setVisible(visible && ac.getShowDescWindow()); descWindow.setVisible(visible && ac.isShowDescWindow());
} }
} }
@ -708,8 +710,8 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
*/ */
private void uninstallKeyBindings() { private void uninstallKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("PopupWindow: Removing keybindings"); FRLogger.getLogger().debug("PopupWindow: Removing keybindings");
} }
JTextComponent comp = ac.getTextComponent(); JTextComponent comp = ac.getTextComponent();

123
designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java

@ -8,26 +8,28 @@
*/ */
package com.fr.design.gui.autocomplete; package com.fr.design.gui.autocomplete;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener; import javax.swing.event.CaretListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.*; import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Adds auto-completion to a text component. Provides a popup window with a * Adds auto-completion to a text component. Provides a popup window with a
* list of auto-complete choices on a given keystroke, such as Crtrl+Space.<p> * list of auto-complete choices on a given keystroke, such as Crtrl+Space.<p>
* * <p>
* Depending on the {@link CompletionProvider} installed, the following * Depending on the {@link CompletionProvider} installed, the following
* auto-completion features may be enabled: * auto-completion features may be enabled:
* * <p>
* <ul> * <ul>
* <li>An auto-complete choices list made visible via e.g. Ctrl+Space</li> * <li>An auto-complete choices list made visible via e.g. Ctrl+Space</li>
* <li>A "description" window displayed alongside the choices list that * <li>A "description" window displayed alongside the choices list that
@ -212,7 +214,7 @@ public class AutoCompletion {
* Stores how to render auto-completion-specific highlights in text * Stores how to render auto-completion-specific highlights in text
* components. * components.
*/ */
private static final AutoCompletionStyleContext styleContext = private static final AutoCompletionStyleContext STYLE_CONTEXT =
new AutoCompletionStyleContext(); new AutoCompletionStyleContext();
/** /**
@ -275,7 +277,7 @@ public class AutoCompletion {
* @return Whether to auto-complete single choices. * @return Whether to auto-complete single choices.
* @see #setAutoCompleteSingleChoices(boolean) * @see #setAutoCompleteSingleChoices(boolean)
*/ */
public boolean getAutoCompleteSingleChoices() { public boolean isAutoCompleteSingleChoices() {
return autoCompleteSingleChoices; return autoCompleteSingleChoices;
} }
@ -295,7 +297,7 @@ public class AutoCompletion {
* *
* @return Whether debug is enabled. * @return Whether debug is enabled.
*/ */
static boolean getDebug() { static boolean isDebug() {
return DEBUG; return DEBUG;
} }
@ -308,8 +310,7 @@ public class AutoCompletion {
*/ */
public static KeyStroke getDefaultTriggerKey() { public static KeyStroke getDefaultTriggerKey() {
// Default to CTRL, even on Mac, since Ctrl+Space activates Spotlight // Default to CTRL, even on Mac, since Ctrl+Space activates Spotlight
int mask = InputEvent.CTRL_MASK; return KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, DEFAULT_MODIFIER);
return KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, mask);
} }
@ -397,7 +398,7 @@ public class AutoCompletion {
* @return Whether the description window should be shown. * @return Whether the description window should be shown.
* @see #setShowDescWindow(boolean) * @see #setShowDescWindow(boolean)
*/ */
public boolean getShowDescWindow() { public boolean isShowDescWindow() {
return showDescWindow; return showDescWindow;
} }
@ -409,7 +410,7 @@ public class AutoCompletion {
* @return The style context. * @return The style context.
*/ */
public static AutoCompletionStyleContext getStyleContext() { public static AutoCompletionStyleContext getStyleContext() {
return styleContext; return STYLE_CONTEXT;
} }
@ -680,60 +681,32 @@ public class AutoCompletion {
* @return The current line number of the caret. * @return The current line number of the caret.
*/ */
protected int refreshPopupWindow() { protected int refreshPopupWindow() {
// A return value of null => don't suggest completions // A return value of null => don't suggest completions
String text = provider.getAlreadyEnteredText(textComponent); String text = provider.getAlreadyEnteredText(textComponent);
if (text == null && !isPopupVisible()) { if (text == null && !isPopupVisible()) {
return getLineOfCaret(); return getLineOfCaret();
} }
// If the popup is currently visible, and they type a space (or any // If the popup is currently visible, and they type a space (or any
// character that resets the completion list to "all completions"), // character that resets the completion list to "all completions"),
// the popup window should be hidden instead of being reset to show // the popup window should be hidden instead of being reset to show
// everything. // everything.
int textLen = text == null ? 0 : text.length(); int textLen = text == null ? 0 : text.length();
if (textLen==0) { if (textLen == 0 && isPopupVisible()) {
if (isPopupVisible()) {
hidePopupWindow(); hidePopupWindow();
return getLineOfCaret(); return getLineOfCaret();
} }
} final List<Completion> completions = provider.getCompletions(textComponent);
final List<Completion> completions = provider.
getCompletions(textComponent);
int count = completions.size(); int count = completions.size();
if (needSetPopupWindow(count, textLen)) {
if (count>1 || (count==1 && (isPopupVisible() || textLen==0)) ||
(count==1 && !getAutoCompleteSingleChoices())) {
if (popupWindow == null) { if (popupWindow == null) {
popupWindow = new AutoCompletePopupWindow(parentWindow, this); popupWindow = createAutoCompletePopupWindow();
// Completion is usually done for code, which is always done
// LTR, so make completion stuff RTL only if text component is
// also RTL.
popupWindow.applyComponentOrientation(
getTextComponentOrientation());
if (renderer!=null) {
popupWindow.setListCellRenderer(renderer);
}
if (preferredChoicesWindowSize!=null) {
popupWindow.setSize(preferredChoicesWindowSize);
}
if (preferredDescWindowSize!=null) {
popupWindow.setDescriptionWindowSize(
preferredDescWindowSize);
} }
}
popupWindow.setCompletions(completions); popupWindow.setCompletions(completions);
if (!popupWindow.isVisible()) { if (!popupWindow.isVisible()) {
Rectangle r = null; Rectangle r = null;
try { try {
r = textComponent.modelToView(textComponent. r = textComponent.modelToView(textComponent.getCaretPosition());
getCaretPosition());
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
return -1; return -1;
} }
Point p = new Point(r.x, r.y); Point p = new Point(r.x, r.y);
@ -743,25 +716,43 @@ public class AutoCompletion {
popupWindow.setLocationRelativeTo(r); popupWindow.setLocationRelativeTo(r);
popupWindow.setVisible(true); popupWindow.setVisible(true);
} }
} else if (count == 1) { // !isPopupVisible && autoCompleteSingleChoices
}
else if (count==1) { // !isPopupVisible && autoCompleteSingleChoices
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
public void run() { public void run() {
insertCompletion(completions.get(0)); insertCompletion(completions.get(0));
} }
}); });
} } else {
else {
hidePopupWindow(); hidePopupWindow();
} }
return getLineOfCaret(); return getLineOfCaret();
}
private boolean needSetPopupWindow(int count, int textLen) {
return (count == 1 && (isPopupVisible() || textLen == 0))
|| (count == 1 && !isAutoCompleteSingleChoices())
|| count > 1;
} }
private AutoCompletePopupWindow createAutoCompletePopupWindow() {
AutoCompletePopupWindow popupWindow = new AutoCompletePopupWindow(parentWindow, this);
// Completion is usually done for code, which is always done
// LTR, so make completion stuff RTL only if text component is
// also RTL.
popupWindow.applyComponentOrientation(
getTextComponentOrientation());
if (renderer != null) {
popupWindow.setListCellRenderer(renderer);
}
if (preferredChoicesWindowSize != null) {
popupWindow.setSize(preferredChoicesWindowSize);
}
if (preferredDescWindowSize != null) {
popupWindow.setDescriptionWindowSize(
preferredDescWindowSize);
}
return popupWindow;
}
/** /**
* Sets the delay between when the user types a character and when the * Sets the delay between when the user types a character and when the
@ -791,8 +782,7 @@ public class AutoCompletion {
if (textComponent != null) { if (textComponent != null) {
if (autoActivationEnabled) { if (autoActivationEnabled) {
autoActivationListener.addTo(textComponent); autoActivationListener.addTo(textComponent);
} } else {
else {
autoActivationListener.removeFrom(textComponent); autoActivationListener.removeFrom(textComponent);
} }
} }
@ -819,7 +809,7 @@ public class AutoCompletion {
* be automatically inserted, without displaying the popup menu. * be automatically inserted, without displaying the popup menu.
* *
* @param autoComplete Whether to auto-complete single choices. * @param autoComplete Whether to auto-complete single choices.
* @see #getAutoCompleteSingleChoices() * @see #isAutoCompleteSingleChoices()
*/ */
public void setAutoCompleteSingleChoices(boolean autoComplete) { public void setAutoCompleteSingleChoices(boolean autoComplete) {
autoCompleteSingleChoices = autoComplete; autoCompleteSingleChoices = autoComplete;
@ -956,7 +946,7 @@ public class AutoCompletion {
* completion window. * completion window.
* *
* @param show Whether to show the description window. * @param show Whether to show the description window.
* @see #getShowDescWindow() * @see #isShowDescWindow()
*/ */
public void setShowDescWindow(boolean show) { public void setShowDescWindow(boolean show) {
hidePopupWindow(); // Needed to force it to take effect hidePopupWindow(); // Needed to force it to take effect
@ -1012,8 +1002,7 @@ public class AutoCompletion {
textComponent.replaceSelection(Character.toString(p.getParameterListStart())); textComponent.replaceSelection(Character.toString(p.getParameterListStart()));
TemplateCompletion tc = new TemplateCompletion(p, null, null, template); TemplateCompletion tc = new TemplateCompletion(p, null, null, template);
pc = tc; pc = tc;
} } else {
else {
text = p.getParameterListStart() + text; text = p.getParameterListStart() + text;
textComponent.replaceSelection(text); textComponent.replaceSelection(text);
return; return;
@ -1130,8 +1119,7 @@ public class AutoCompletion {
public void caretUpdate(CaretEvent e) { public void caretUpdate(CaretEvent e) {
if (justInserted) { if (justInserted) {
justInserted = false; justInserted = false;
} } else {
else {
timer.stop(); timer.stop();
} }
} }
@ -1153,12 +1141,10 @@ public class AutoCompletion {
if (provider.isAutoActivateOkay(textComponent)) { if (provider.isAutoActivateOkay(textComponent)) {
timer.restart(); timer.restart();
justInserted = true; justInserted = true;
} } else {
else {
timer.stop(); timer.stop();
} }
} } else {
else {
timer.stop(); timer.stop();
} }
} }
@ -1187,8 +1173,7 @@ public class AutoCompletion {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (isAutoCompleteEnabled()) { if (isAutoCompleteEnabled()) {
refreshPopupWindow(); refreshPopupWindow();
} } else if (oldTriggerAction != null) {
else if (oldTriggerAction!=null) {
oldTriggerAction.actionPerformed(e); oldTriggerAction.actionPerformed(e);
} }
} }

59
designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java

@ -14,6 +14,7 @@ import com.fr.design.gui.autocomplete.ParameterizedCompletionInsertionInfo.Repla
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rtextarea.ChangeableHighlightPainter; import com.fr.design.gui.syntax.ui.rtextarea.ChangeableHighlightPainter;
import com.fr.general.FRLogger;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
@ -438,11 +439,9 @@ class ParameterizedCompletionContext {
* @see #uninstallKeyBindings() * @see #uninstallKeyBindings()
*/ */
private void installKeyBindings() { private void installKeyBindings() {
if (AutoCompletion.isDebug()) {
if (AutoCompletion.getDebug()) { FRLogger.getLogger().debug("CompletionContext: Installing keybindings");
System.out.println("CompletionContext: Installing keybindings");
} }
JTextComponent tc = ac.getTextComponent(); JTextComponent tc = ac.getTextComponent();
InputMap im = tc.getInputMap(); InputMap im = tc.getInputMap();
ActionMap am = tc.getActionMap(); ActionMap am = tc.getActionMap();
@ -489,7 +488,6 @@ class ParameterizedCompletionContext {
im.put(ks, IM_KEY_CLOSING); im.put(ks, IM_KEY_CLOSING);
oldClosingAction = am.get(IM_KEY_CLOSING); oldClosingAction = am.get(IM_KEY_CLOSING);
am.put(IM_KEY_CLOSING, new ClosingAction()); am.put(IM_KEY_CLOSING, new ClosingAction());
} }
@ -513,12 +511,7 @@ class ParameterizedCompletionContext {
List<Highlight> highlights = getParameterHighlights(); List<Highlight> highlights = getParameterHighlights();
for (int i = 0; i < highlights.size(); i++) { for (int i = 0; i < highlights.size(); i++) {
Highlight hl = highlights.get(i); Highlight hl = highlights.get(i);
// Check "< dot", not "<= dot" as OutlineHighlightPainter paints if (needUpdate(currentNext, hl, dot)) {
// starting at one char AFTER the highlight starts, to work around
// Java issue. Thanks to Matthew Adereth!
if (currentNext == null || currentNext.getStartOffset() </*=*/dot ||
(hl.getStartOffset() > dot &&
hl.getStartOffset() <= currentNext.getStartOffset())) {
currentNext = hl; currentNext = hl;
pos = i; pos = i;
} }
@ -538,6 +531,15 @@ class ParameterizedCompletionContext {
} }
private boolean needUpdate(Highlight currentNext, Highlight hl, int dot) {
// Check "< dot", not "<= dot" as OutlineHighlightPainter paints
// starting at one char AFTER the highlight starts, to work around
// Java issue. Thanks to Matthew Adereth!
return currentNext == null || currentNext.getStartOffset() </*=*/dot ||
(hl.getStartOffset() > dot &&
hl.getStartOffset() <= currentNext.getStartOffset());
}
/** /**
* Moves to and selects the previous parameter. * Moves to and selects the previous parameter.
@ -562,10 +564,7 @@ class ParameterizedCompletionContext {
for (int i = 0; i < highlights.size(); i++) { for (int i = 0; i < highlights.size(); i++) {
Highlight h = highlights.get(i); Highlight h = highlights.get(i);
if (currentPrev == null || currentPrev.getStartOffset() >= dot || if (pos == lastSelectedParam || needUpdate(currentPrev, dot, h, selStart)) {
(h.getStartOffset() < selStart &&
(h.getStartOffset() > currentPrev.getStartOffset() ||
pos == lastSelectedParam))) {
currentPrev = h; currentPrev = h;
pos = i; pos = i;
} }
@ -593,6 +592,12 @@ class ParameterizedCompletionContext {
} }
private boolean needUpdate(Highlight currentPrev, int dot, Highlight h, int selStart) {
return currentPrev == null
|| currentPrev.getStartOffset() >= dot
|| (currentPrev.getStartOffset() < h.getStartOffset() && h.getStartOffset() < selStart);
}
private void possiblyUpdateParamCopies(Document doc) { private void possiblyUpdateParamCopies(Document doc) {
@ -733,8 +738,8 @@ class ParameterizedCompletionContext {
*/ */
private void uninstallKeyBindings() { private void uninstallKeyBindings() {
if (AutoCompletion.getDebug()) { if (AutoCompletion.isDebug()) {
System.out.println("CompletionContext Uninstalling keybindings"); FRLogger.getLogger().debug("CompletionContext Uninstalling keybindings");
} }
JTextComponent tc = ac.getTextComponent(); JTextComponent tc = ac.getTextComponent();
@ -1037,7 +1042,6 @@ class ParameterizedCompletionContext {
* @see #uninstall() * @see #uninstall()
*/ */
public void install(JTextComponent tc) { public void install(JTextComponent tc) {
boolean replaceTabs = false; boolean replaceTabs = false;
if (tc instanceof RSyntaxTextArea) { if (tc instanceof RSyntaxTextArea) {
RSyntaxTextArea textArea = (RSyntaxTextArea) tc; RSyntaxTextArea textArea = (RSyntaxTextArea) tc;
@ -1047,14 +1051,10 @@ class ParameterizedCompletionContext {
} }
Highlighter h = tc.getHighlighter(); Highlighter h = tc.getHighlighter();
try { try {
// Insert the parameter text // Insert the parameter text
ParameterizedCompletionInsertionInfo info = ParameterizedCompletionInsertionInfo info = pc.getInsertionInfo(tc, replaceTabs);
pc.getInsertionInfo(tc, replaceTabs);
tc.replaceSelection(info.getTextToInsert()); tc.replaceSelection(info.getTextToInsert());
// Add highlights around the parameters. // Add highlights around the parameters.
final int replacementCount = info.getReplacementCount(); final int replacementCount = info.getReplacementCount();
for (int i = 0; i < replacementCount; i++) { for (int i = 0; i < replacementCount; i++) {
@ -1067,40 +1067,31 @@ class ParameterizedCompletionContext {
for (int i = 0; i < info.getReplacementCopyCount(); i++) { for (int i = 0; i < info.getReplacementCopyCount(); i++) {
ReplacementCopy rc = info.getReplacementCopy(i); ReplacementCopy rc = info.getReplacementCopy(i);
paramCopyInfos.add(new ParamCopyInfo(rc.getId(), paramCopyInfos.add(new ParamCopyInfo(rc.getId(),
(Highlight) h.addHighlight(rc.getStart(), rc.getEnd(), (Highlight) h.addHighlight(rc.getStart(), rc.getEnd(), paramCopyP)));
paramCopyP)));
} }
// Go back and start at the first parameter. // Go back and start at the first parameter.
tc.setCaretPosition(info.getSelectionStart()); tc.setCaretPosition(info.getSelectionStart());
if (info.hasSelection()) { if (info.hasSelection()) {
tc.moveCaretPosition(info.getSelectionEnd()); tc.moveCaretPosition(info.getSelectionEnd());
} }
minPos = info.getMinOffset(); minPos = info.getMinOffset();
maxPos = info.getMaxOffset(); maxPos = info.getMaxOffset();
try { try {
defaultEndOffs = tc.getDocument().createPosition( defaultEndOffs = tc.getDocument().createPosition(info.getDefaultEndOffs());
info.getDefaultEndOffs());
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
// Never happens // Never happens
} }
// Listen for document events AFTER we insert // Listen for document events AFTER we insert
tc.getDocument().addDocumentListener(this); tc.getDocument().addDocumentListener(this);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
// Never happens // Never happens
} }
// Add listeners to the text component, AFTER text insertion. // Add listeners to the text component, AFTER text insertion.
tc.addCaretListener(this); tc.addCaretListener(this);
tc.addFocusListener(this); tc.addFocusListener(this);
installKeyBindings(); installKeyBindings();
} }
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
handleDocumentEvent(e); handleDocumentEvent(e);
} }

8
designer_base/src/com/fr/design/gui/frpane/UIAdvancedTextPane.java

@ -20,6 +20,8 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* p:这是一个增强的JTextPane,支持很多Action * p:这是一个增强的JTextPane,支持很多Action
*/ */
@ -143,7 +145,7 @@ public class UIAdvancedTextPane extends UITextPane {
setName(Inter.getLocText("M_Edit-Cut")); setName(Inter.getLocText("M_Edit-Cut"));
setMnemonic('T'); setMnemonic('T');
setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_MASK)); setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
} }
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -162,7 +164,7 @@ public class UIAdvancedTextPane extends UITextPane {
this.setName(Inter.getLocText("M_Edit-Copy")); this.setName(Inter.getLocText("M_Edit-Copy"));
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
} }
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
@ -181,7 +183,7 @@ public class UIAdvancedTextPane extends UITextPane {
this.setName(Inter.getLocText("M_Edit-Paste")); this.setName(Inter.getLocText("M_Edit-Paste"));
this.setMnemonic('P'); this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER));
} }
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {

8
designer_base/src/com/fr/design/gui/icombobox/ExtendedComboBox.java

@ -1,5 +1,7 @@
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import com.fr.common.inputevent.InputEventBaseOnOS;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
@ -17,6 +19,8 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class ExtendedComboBox extends UIComboBox { public class ExtendedComboBox extends UIComboBox {
private static final int VALUE120 = 120; private static final int VALUE120 = 120;
@ -74,12 +78,12 @@ public class ExtendedComboBox extends UIComboBox {
protected JList createList() { protected JList createList() {
return new JList(comboBox.getModel()) { return new JList(comboBox.getModel()) {
public void processMouseEvent(MouseEvent e) { public void processMouseEvent(MouseEvent e) {
if (e.isControlDown()) { if (InputEventBaseOnOS.isControlDown(e)) {
// Fix for 4234053. Filter out the Control // Fix for 4234053. Filter out the Control
// Key from the list. // Key from the list.
// ie., don't allow CTRL key deselection. // ie., don't allow CTRL key deselection.
e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers() e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers()
^ InputEvent.CTRL_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); ^ DEFAULT_MODIFIER, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger());
} }
super.processMouseEvent(e); super.processMouseEvent(e);
} }

7
designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java

@ -16,6 +16,7 @@ import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import sun.swing.DefaultLookup; import sun.swing.DefaultLookup;
@ -24,6 +25,8 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* @author zhou F * @author zhou F
* @since 2012-5-9下午4:33:07 * @since 2012-5-9下午4:33:07
@ -207,8 +210,8 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener {
@Override @Override
public void processMouseEvent(MouseEvent e) { public void processMouseEvent(MouseEvent e) {
if (e.isControlDown()) { if (InputEventBaseOnOS.isControlDown(e)) {
e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers() ^ InputEvent.CTRL_MASK, e.getX(), e.getY(), e.getClickCount(), e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers() ^ DEFAULT_MODIFIER, e.getX(), e.getY(), e.getClickCount(),
e.isPopupTrigger()); e.isPopupTrigger());
} }
super.processMouseEvent(e); super.processMouseEvent(e);

49
designer_base/src/com/fr/design/gui/ilist/CheckBoxList.java

@ -1,34 +1,24 @@
package com.fr.design.gui.ilist; package com.fr.design.gui.ilist;
import java.awt.BorderLayout; import com.fr.design.gui.icheckbox.UICheckBox;
import java.awt.Component; import com.fr.stable.StringUtils;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import javax.swing.*;
import java.awt.event.KeyAdapter; import javax.swing.border.Border;
import java.awt.event.KeyEvent; import javax.swing.border.EmptyBorder;
import java.awt.event.MouseAdapter; import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.EventListener; import java.util.EventListener;
import java.util.List; import java.util.List;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.stable.StringUtils;
/** /**
* CheckBoxs + JList. * CheckBoxs + JList.
*/ */
public class CheckBoxList extends JComponent { public class CheckBoxList extends JComponent {
private final static int X_COORDINATE = 20;
/** /**
* 选择状态----全选和全不选 * 选择状态----全选和全不选
* *
@ -54,10 +44,8 @@ public class CheckBoxList extends JComponent {
/** /**
* Class constructor. * Class constructor.
* *
* @param items * @param items Items with which to populate the list.
* Items with which to populate the list. * @param state default state, true or false
* @param default_state
* default state, true or false
*/ */
public CheckBoxList(Object[] items, SelectedState state, String name) { public CheckBoxList(Object[] items, SelectedState state, String name) {
jlist = new BOXLIST(items); jlist = new BOXLIST(items);
@ -175,8 +163,9 @@ public class CheckBoxList extends JComponent {
@Override @Override
protected void processMouseEvent(MouseEvent e) { protected void processMouseEvent(MouseEvent e) {
if (e.getX() < 20) { if (e.getX() < X_COORDINATE) {
if (e.isControlDown() || e.isAltDown() || e.isShiftDown() || e.isMetaDown()) { boolean anyMaskDown = e.isControlDown() || e.isAltDown() || e.isShiftDown() || e.isMetaDown();
if (anyMaskDown) {
int[] indices = getSelectedIndices(); int[] indices = getSelectedIndices();
if (indices.length == 0) { if (indices.length == 0) {
super.processMouseEvent(e); super.processMouseEvent(e);
@ -205,7 +194,7 @@ public class CheckBoxList extends JComponent {
@Override @Override
protected void processMouseMotionEvent(MouseEvent e) { protected void processMouseMotionEvent(MouseEvent e) {
if (e.getX() < 20) { if (e.getX() < X_COORDINATE) {
return; return;
} }
@ -246,13 +235,13 @@ public class CheckBoxList extends JComponent {
repaint(); repaint();
} }
private static final Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); private static final Border NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
private class CheckListCellRenderer extends UICheckBox implements ListCellRenderer { private class CheckListCellRenderer extends UICheckBox implements ListCellRenderer {
public CheckListCellRenderer() { public CheckListCellRenderer() {
this.setOpaque(true); this.setOpaque(true);
this.setBorder(noFocusBorder); this.setBorder(NO_FOCUS_BORDER);
} }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
@ -271,7 +260,7 @@ public class CheckBoxList extends JComponent {
if (cellHasFocus) { if (cellHasFocus) {
this.setBorder(UIManager.getBorder("List.focusCellHighlightBorder")); this.setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
} else { } else {
this.setBorder(noFocusBorder); this.setBorder(NO_FOCUS_BORDER);
} }
return this; return this;

1
designer_base/src/com/fr/design/gui/ilist/UIList.java

@ -71,6 +71,7 @@ public class UIList extends JList{
} }
return null; return null;
} }
public JToolTip createToolTip() { public JToolTip createToolTip() {
UIToolTip tip = new UIToolTip(icon); UIToolTip tip = new UIToolTip(icon);
tip.setComponent(this); tip.setComponent(this);

14
designer_base/src/com/fr/design/gui/itable/TableSorter.java

@ -15,6 +15,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import javax.swing.Icon; import javax.swing.Icon;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
@ -79,7 +81,7 @@ import javax.swing.table.TableModel;
public class TableSorter extends AbstractTableModel { public class TableSorter extends AbstractTableModel {
protected TableModel tableModel; protected TableModel tableModel;
private static final int ADD = 4;
public static final int DESCENDING = -1; public static final int DESCENDING = -1;
public static final int NOT_SORTED = 0; public static final int NOT_SORTED = 0;
public static final int ASCENDING = 1; public static final int ASCENDING = 1;
@ -341,16 +343,13 @@ public class TableSorter extends AbstractTableModel {
fireTableChanged(e); fireTableChanged(e);
return; return;
} }
// If the table structure has changed, cancel the sorting; the // If the table structure has changed, cancel the sorting; the
// sorting columns may have been either moved or deleted from // sorting columns may have been either moved or deleted from the model.
// the model.
if (e.getFirstRow() == TableModelEvent.HEADER_ROW) { if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
cancelSorting(); cancelSorting();
fireTableChanged(e); fireTableChanged(e);
return; return;
} }
// We can map a cell event through to the view without widening // We can map a cell event through to the view without widening
// when the following conditions apply: // when the following conditions apply:
// //
@ -380,7 +379,6 @@ public class TableSorter extends AbstractTableModel {
column, e.getType())); column, e.getType()));
return; return;
} }
// Something has happened to the data that may have invalidated the row order. // Something has happened to the data that may have invalidated the row order.
clearSortingState(); clearSortingState();
fireTableDataChanged(); fireTableDataChanged();
@ -396,13 +394,13 @@ public class TableSorter extends AbstractTableModel {
int column = columnModel.getColumn(viewColumn).getModelIndex(); int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) { if (column != -1) {
int status = getSortingStatus(column); int status = getSortingStatus(column);
if (!e.isControlDown()) { if (!InputEventBaseOnOS.isControlDown(e)) {
cancelSorting(); cancelSorting();
} }
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
status = status + (e.isShiftDown() ? -1 : 1); status = status + (e.isShiftDown() ? -1 : 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} status = (status + ADD) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status); setSortingStatus(column, status);
} }
} }

51
designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java

@ -1,36 +1,23 @@
package com.fr.design.gui.itabpane; package com.fr.design.gui.itabpane;
import java.awt.BorderLayout; import com.fr.base.BaseUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.InputMap;
import javax.swing.JComponent;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.core.UITabComponent;
import com.fr.design.gui.ibutton.UITabButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel; import com.fr.stable.StringUtils;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fr.base.BaseUtils; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
import com.fr.design.gui.core.UITabComponent;
import com.fr.design.gui.ibutton.UITabButton;
import com.fr.stable.StringUtils;
/** /**
* 本来想弄个延迟加载的发现在单元格属性表那边没有意义就算了.这个面板是纯粹的没有与模板的任何交互操作(比如说populate() update()) * 本来想弄个延迟加载的发现在单元格属性表那边没有意义就算了.这个面板是纯粹的没有与模板的任何交互操作(比如说populate() update())
@ -40,6 +27,7 @@ import com.fr.stable.StringUtils;
*/ */
public class UITabsHeaderIconPane extends JPanel implements UITabComponent { public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int DIS = 30;
private UILabel nameLabel; private UILabel nameLabel;
@ -125,7 +113,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
inputMapAncestor.clear(); inputMapAncestor.clear();
actionMap.clear(); actionMap.clear();
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.CTRL_MASK), "switch"); inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, DEFAULT_MODIFIER), "switch");
actionMap.put("switch", new AbstractAction() { actionMap.put("switch", new AbstractAction() {
/** /**
@ -143,9 +131,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
private void show(final JPanel panel) { private void show(final JPanel panel) {
int count = centerPane.getComponentCount();// 获取centerPanel中控件数 int count = centerPane.getComponentCount();// 获取centerPanel中控件数
List<Component> list = new ArrayList<Component>();// List<Component> list = new ArrayList<Component>();//
for (Component comp : centerPane.getComponents()) { list.addAll(Arrays.asList(centerPane.getComponents()));
list.add(comp);
}
if (count > 0) {// 如果centerPanel中控件数大于0就执行效果 if (count > 0) {// 如果centerPanel中控件数大于0就执行效果
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
Component comp = centerPane.getComponent(i);// 获得该位置的控件 Component comp = centerPane.getComponent(i);// 获得该位置的控件
@ -159,11 +145,11 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
int height = centerPane.getHeight(); int height = centerPane.getHeight();
int width = centerPane.getWidth(); int width = centerPane.getWidth();
int y = -height; int y = -height;
for (int i = 0; i <= height; i += 30) { for (int i = 0; i <= height; i += DIS) {
// 设置面板位置 // 设置面板位置
currentPanel.setBounds(0, i, width, height); currentPanel.setBounds(0, i, width, height);
panel.setBounds(0, y, width, height); panel.setBounds(0, y, width, height);
y += 30; y += DIS;
try { try {
Thread.sleep(3); Thread.sleep(3);
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -173,7 +159,6 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
centerPane.remove(currentPanel);// 移除当前面板 centerPane.remove(currentPanel);// 移除当前面板
} }
panel.setBounds(0, 0, width, height); panel.setBounds(0, 0, width, height);
} }
}.start(); }.start();
break; break;

20
designer_base/src/com/fr/design/gui/itextarea/UITextArea.java

@ -7,13 +7,33 @@ import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class UITextArea extends JTextArea implements UIObserver { public class UITextArea extends JTextArea implements UIObserver {
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
public UITextArea(int i, int j) { public UITextArea(int i, int j) {
super(i, j); super(i, j);
InputMap inputMap = this.getInputMap();
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
initComponents(); initComponents();
} }

38
designer_base/src/com/fr/design/gui/itextfield/UITextField.java

@ -1,20 +1,21 @@
package com.fr.design.gui.itextfield; package com.fr.design.gui.itextfield;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document;
import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* @author Jerry * @author Jerry
@ -30,6 +31,22 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() { public UITextField() {
super(); super();
InputMap inputMap = this.getInputMap();
while (inputMap.getParent() != null) {
inputMap = inputMap.getParent();
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction);
}
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction);
}
initListener(); initListener();
} }
@ -186,6 +203,7 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
/** /**
* 主函数 * 主函数
*
* @param args 参数 * @param args 参数
*/ */
public static void main(String... args) { public static void main(String... args) {

47
designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java

@ -5,8 +5,14 @@
*/ */
package com.fr.design.gui.itree.checkboxtree; package com.fr.design.gui.itree.checkboxtree;
import java.awt.Component; import com.fr.design.gui.icheckbox.UICheckBox;
import java.awt.Rectangle;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.Position;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -16,19 +22,6 @@ import java.beans.PropertyChangeListener;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Vector; import java.util.Vector;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.Position;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import com.fr.design.gui.icheckbox.UICheckBox;
/** /**
* CheckBoxTree is a special JTree which uses UICheckBox as the tree renderer. * CheckBoxTree is a special JTree which uses UICheckBox as the tree renderer.
* In addition to regular JTree's features, it also allows you select any number * In addition to regular JTree's features, it also allows you select any number
@ -177,8 +170,7 @@ public class CheckBoxTree extends JTree {
} }
if (_treeCellRenderer == null) { if (_treeCellRenderer == null) {
_treeCellRenderer = createCellRenderer(cellRenderer); _treeCellRenderer = createCellRenderer(cellRenderer);
} } else {
else {
_treeCellRenderer.setActualTreeRenderer(cellRenderer); _treeCellRenderer.setActualTreeRenderer(cellRenderer);
} }
return _treeCellRenderer; return _treeCellRenderer;
@ -194,8 +186,7 @@ public class CheckBoxTree extends JTree {
public TreeCellRenderer getActualCellRenderer() { public TreeCellRenderer getActualCellRenderer() {
if (_treeCellRenderer != null) { if (_treeCellRenderer != null) {
return _treeCellRenderer.getActualTreeRenderer(); return _treeCellRenderer.getActualTreeRenderer();
} } else {
else {
return super.getCellRenderer(); return super.getCellRenderer();
} }
} }
@ -245,13 +236,13 @@ public class CheckBoxTree extends JTree {
} }
TreePath path = _tree.getPathForLocation(e.getX(), e.getY()); TreePath path = _tree.getPathForLocation(e.getX(), e.getY());
if (path == null) if (path == null) {
return null; return null;
}
if (clicksInCheckBox(e, path)) { if (clicksInCheckBox(e, path)) {
return path; return path;
} } else {
else {
return null; return null;
} }
} }
@ -259,13 +250,11 @@ public class CheckBoxTree extends JTree {
protected boolean clicksInCheckBox(MouseEvent e, TreePath path) { protected boolean clicksInCheckBox(MouseEvent e, TreePath path) {
if (!_tree.isCheckBoxVisible(path)) { if (!_tree.isCheckBoxVisible(path)) {
return false; return false;
} } else {
else {
Rectangle bounds = _tree.getPathBounds(path); Rectangle bounds = _tree.getPathBounds(path);
if (_tree.getComponentOrientation().isLeftToRight()) { if (_tree.getComponentOrientation().isLeftToRight()) {
return e.getX() < bounds.x + _hotspot; return e.getX() < bounds.x + _hotspot;
} } else {
else {
return e.getX() > bounds.x + bounds.width - _hotspot; return e.getX() > bounds.x + bounds.width - _hotspot;
} }
} }
@ -320,9 +309,10 @@ public class CheckBoxTree extends JTree {
return; return;
} }
if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) {
toggleSelections(); toggleSelections();
} }
}
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
@ -349,8 +339,7 @@ public class CheckBoxTree extends JTree {
selectionModel.removeSelectionPath(path); selectionModel.removeSelectionPath(path);
else else
selectionModel.addSelectionPath(path); selectionModel.addSelectionPath(path);
} } finally {
finally {
if (!selectionModel.isSingleEventMode()) { if (!selectionModel.isSingleEventMode()) {
selectionModel.setBatchMode(false); selectionModel.setBatchMode(false);
} }

3
designer_base/src/com/fr/design/gui/itree/refreshabletree/UserObjectRefreshJTree.java

@ -1,5 +1,6 @@
package com.fr.design.gui.itree.refreshabletree; package com.fr.design.gui.itree.refreshabletree;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.design.gui.itree.refreshabletree.loader.ChildrenLoaderFactory; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenLoaderFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -147,7 +148,7 @@ public abstract class UserObjectRefreshJTree<T extends UserObjectOP<?>> extends
} }
} }
// marks:鼠标在上次选中的paths上,则将上次的paths设为的树的路径,否则将鼠标所在的节点设为选中的节点 // marks:鼠标在上次选中的paths上,则将上次的paths设为的树的路径,否则将鼠标所在的节点设为选中的节点
if (!(e.isShiftDown() || e.isControlDown())) { if (!(e.isShiftDown() || InputEventBaseOnOS.isControlDown(e))) {
if (isFind) { if (isFind) {
setSelectionPaths(oldPaths); setSelectionPaths(oldPaths);
} else { } else {

2
designer_base/src/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextAreaDefaultInputMap.java

@ -34,7 +34,7 @@ public class RSyntaxTextAreaDefaultInputMap extends RTADefaultInputMap {
*/ */
public RSyntaxTextAreaDefaultInputMap() { public RSyntaxTextAreaDefaultInputMap() {
int defaultMod = getDefaultModifier(); int defaultMod = DEFAULT_MODIFIER;
//int ctrl = InputEvent.CTRL_MASK; //int ctrl = InputEvent.CTRL_MASK;
int shift = InputEvent.SHIFT_MASK; int shift = InputEvent.SHIFT_MASK;
//int alt = InputEvent.ALT_MASK; //int alt = InputEvent.ALT_MASK;

24
designer_base/src/com/fr/design/gui/syntax/ui/rtextarea/RTADefaultInputMap.java

@ -41,6 +41,14 @@ import javax.swing.text.DefaultEditorKit;
public class RTADefaultInputMap extends InputMap { public class RTADefaultInputMap extends InputMap {
/**
* Returns the default modifier key for a system. For example, on Windows
* this would be the CTRL key (<code>InputEvent.CTRL_MASK</code>).
*
* @return The default modifier key.
*/
public static final int DEFAULT_MODIFIER = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
/** /**
* Constructs the default input map for an <code>RTextArea</code>. * Constructs the default input map for an <code>RTextArea</code>.
*/ */
@ -48,7 +56,7 @@ public class RTADefaultInputMap extends InputMap {
super(); super();
int defaultModifier = getDefaultModifier(); int defaultModifier = DEFAULT_MODIFIER;
//int ctrl = InputEvent.CTRL_MASK; //int ctrl = InputEvent.CTRL_MASK;
int alt = InputEvent.ALT_MASK; int alt = InputEvent.ALT_MASK;
int shift = InputEvent.SHIFT_MASK; int shift = InputEvent.SHIFT_MASK;
@ -134,18 +142,4 @@ public class RTADefaultInputMap extends InputMap {
*/ */
} }
/**
* Returns the default modifier key for a system. For example, on Windows
* this would be the CTRL key (<code>InputEvent.CTRL_MASK</code>).
*
* @return The default modifier key.
*/
protected static final int getDefaultModifier() {
return Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
}
} }

3
designer_base/src/com/fr/design/locale/designer.properties

@ -1137,7 +1137,7 @@ FRFont-bold=bold
FR-Designer_Set_Submit_Condition= FR-Designer_Set_Submit_Condition=
Form-Change_Widget_Name=Change Widget Name Form-Change_Widget_Name=Change Widget Name
ReportColumns-Report_Columns=Report Columns ReportColumns-Report_Columns=Report Columns
Can_not_use_FormatBursh= FR-Designer_Can_not_use_FormatBursh=
CellElement-Property_Table=CellElement Property Table CellElement-Property_Table=CellElement Property Table
Dictionary-Dynamic_SQL=Dynamic SQL Dictionary-Dynamic_SQL=Dynamic SQL
FR-Designer_Form-CheckBoxGroup=CheckBoxGroup FR-Designer_Form-CheckBoxGroup=CheckBoxGroup
@ -2006,3 +2006,4 @@ FR-Designer_AlphaFine_ShowAll=show all
FR-Designer_AlphaFine_Latest=Latest FR-Designer_AlphaFine_Latest=Latest
FR-Designer_AlphaFine_ShowLess=show less FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_Alphafine=AlphaFine FR-Designer_Alphafine=AlphaFine
FR-Designer-Alphafine_No_Remind=

3
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -1138,7 +1138,7 @@ FRFont-bold=Bold
FR-Designer_Set_Submit_Condition=Submit Condition FR-Designer_Set_Submit_Condition=Submit Condition
Form-Change_Widget_Name=Change Control Name Form-Change_Widget_Name=Change Control Name
ReportColumns-Report_Columns=Multi-columns/lines display ReportColumns-Report_Columns=Multi-columns/lines display
Can_not_use_FormatBursh=Can't use format painter in multiple selections FR-Designer_Can_not_use_FormatBursh=Can't use format painter in multiple selections
CellElement-Property_Table=Cell Attribute Table CellElement-Property_Table=Cell Attribute Table
Dictionary-Dynamic_SQL=Dynamic SQL Dictionary-Dynamic_SQL=Dynamic SQL
FR-Designer_Form-CheckBoxGroup=CheckBoxGroup FR-Designer_Form-CheckBoxGroup=CheckBoxGroup
@ -2004,3 +2004,4 @@ FR-Designer_AlphaFine_ShowAll=show all
FR-Designer_AlphaFine_Latest=Recent FR-Designer_AlphaFine_Latest=Recent
FR-Designer_AlphaFine_ShowLess=show less FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_Alphafine=AlphaFine FR-Designer_Alphafine=AlphaFine
FR-Designer-Alphafine_No_Remind=don't remind

2
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1133,7 +1133,7 @@ FRFont-bold=\u592A\u5B57
FR-Designer_Set_Submit_Condition=\u63D0\u51FA\u6761\u4EF6\u3092\u8A2D\u5B9A FR-Designer_Set_Submit_Condition=\u63D0\u51FA\u6761\u4EF6\u3092\u8A2D\u5B9A
Form-Change_Widget_Name=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u540D\u5909\u66F4 Form-Change_Widget_Name=\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u540D\u5909\u66F4
ReportColumns-Report_Columns=\u5E33\u7968\u30B3\u30E9\u30E0 ReportColumns-Report_Columns=\u5E33\u7968\u30B3\u30E9\u30E0
Can_not_use_FormatBursh=\u8907\u6570\u9078\u629E\u3057\u305F\u30A8\u30EA\u30A2\u3067\u306F\u66F8\u5F0F\u30D6\u30E9\u30B7\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\! FR-Designer_Can_not_use_FormatBursh=\u8907\u6570\u9078\u629E\u3057\u305F\u30A8\u30EA\u30A2\u3067\u306F\u66F8\u5F0F\u30D6\u30E9\u30B7\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\!
CellElement-Property_Table=\u30BB\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u00B7\u30B7\u30FC\u30C8 CellElement-Property_Table=\u30BB\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u00B7\u30B7\u30FC\u30C8
Dictionary-Dynamic_SQL=\u52D5\u614BSQL Dictionary-Dynamic_SQL=\u52D5\u614BSQL
FR-Designer_Form-CheckBoxGroup=\u30D5\u30EC\u30FC\u30E0\u30BB\u30C3\u30C8\u3092\u8907\u6570\u9078\u629E FR-Designer_Form-CheckBoxGroup=\u30D5\u30EC\u30FC\u30E0\u30BB\u30C3\u30C8\u3092\u8907\u6570\u9078\u629E

2
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -1134,7 +1134,7 @@ FRFont-bold=\uAD75\uAC8C
FR-Designer_Set_Submit_Condition=\uC81C\uCD9C\uC870\uAC74\uC124\uC815 FR-Designer_Set_Submit_Condition=\uC81C\uCD9C\uC870\uAC74\uC124\uC815
Form-Change_Widget_Name=\uC18C\uD504\uD2B8\uC6E8\uC5B4\uC81C\uC5B4\uC774\uB984\uBCC0\uACBD Form-Change_Widget_Name=\uC18C\uD504\uD2B8\uC6E8\uC5B4\uC81C\uC5B4\uC774\uB984\uBCC0\uACBD
ReportColumns-Report_Columns=\uBB38\uC11C\uC140\uB098\uB204\uAE30 ReportColumns-Report_Columns=\uBB38\uC11C\uC140\uB098\uB204\uAE30
Can_not_use_FormatBursh=\uC911\uBCF5\uC120\uD0DD\uB41C\uC601\uC5ED\uC5D0\uC11C\uC2DD\uC744\uC774\uC6A9\uD558\uC5EC\uC778\uC1C4\uD560\uC218\uC5C6\uC2B5\uB2C8\uB2E4.\! FR-Designer_Can_not_use_FormatBursh=\uC911\uBCF5\uC120\uD0DD\uB41C\uC601\uC5ED\uC5D0\uC11C\uC2DD\uC744\uC774\uC6A9\uD558\uC5EC\uC778\uC1C4\uD560\uC218\uC5C6\uC2B5\uB2C8\uB2E4.\!
CellElement-Property_Table=\uC140\uC18D\uC131\uD45C CellElement-Property_Table=\uC140\uC18D\uC131\uD45C
Dictionary-Dynamic_SQL=\uB3D9\uC801 SQL Dictionary-Dynamic_SQL=\uB3D9\uC801 SQL
FR-Designer_Form-CheckBoxGroup=\uCCB4\uD06C\uBC15\uC2A4\uADF8\uB8F9 FR-Designer_Form-CheckBoxGroup=\uCCB4\uD06C\uBC15\uC2A4\uADF8\uB8F9

5
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -1133,7 +1133,7 @@ FRFont-bold=\u52A0\u7C97
FR-Designer_Set_Submit_Condition=\u8BBE\u7F6E\u63D0\u4EA4\u6761\u4EF6 FR-Designer_Set_Submit_Condition=\u8BBE\u7F6E\u63D0\u4EA4\u6761\u4EF6
Form-Change_Widget_Name=\u66F4\u6539\u63A7\u4EF6\u540D Form-Change_Widget_Name=\u66F4\u6539\u63A7\u4EF6\u540D
ReportColumns-Report_Columns=\u62A5\u8868\u5206\u680F ReportColumns-Report_Columns=\u62A5\u8868\u5206\u680F
Can_not_use_FormatBursh=\u4E0D\u80FD\u5BF9\u591A\u91CD\u9009\u5B9A\u533A\u57DF\u4F7F\u7528\u683C\u5F0F\u5237\! FR-Designer_Can_not_use_FormatBursh=\u4E0D\u80FD\u5BF9\u591A\u91CD\u9009\u5B9A\u533A\u57DF\u4F7F\u7528\u683C\u5F0F\u5237\!
CellElement-Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868 CellElement-Property_Table=\u5355\u5143\u683C\u5C5E\u6027\u8868
Dictionary-Dynamic_SQL=\u52A8\u6001SQL Dictionary-Dynamic_SQL=\u52A8\u6001SQL
FR-Designer_Form-CheckBoxGroup=\u590D\u9009\u6846\u7EC4 FR-Designer_Form-CheckBoxGroup=\u590D\u9009\u6846\u7EC4
@ -1999,6 +1999,7 @@ FR-Designer_Templates=\u6A21\u677F
FR-Designer_Templates_Content=\u6A21\u677F\u5185\u5BB9 FR-Designer_Templates_Content=\u6A21\u677F\u5185\u5BB9
FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8 FR-Designer_AlphaFine_ShowAll=\u663E\u793A\u5168\u90E8
FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981 FR-Designer_AlphaFine_Conclude=\u731C\u60A8\u9700\u8981
FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528 FR-Designer_AlphaFine_Latest=\u672C\u5730\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A

3
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -1133,7 +1133,7 @@ FRFont-bold=\u7C97\u9AD4
FR-Designer_Set_Submit_Condition=\u8A2D\u5B9A\u63D0\u4EA4\u689D\u4EF6 FR-Designer_Set_Submit_Condition=\u8A2D\u5B9A\u63D0\u4EA4\u689D\u4EF6
Form-Change_Widget_Name=\u66F4\u6539\u63A7\u5236\u9805\u540D Form-Change_Widget_Name=\u66F4\u6539\u63A7\u5236\u9805\u540D
ReportColumns-Report_Columns=\u5831\u8868\u5206\u6B04 ReportColumns-Report_Columns=\u5831\u8868\u5206\u6B04
Can_not_use_FormatBursh=\u7121\u6CD5\u4F7F\u7528\u8907\u88FD\u683C\u5F0F FR-Designer_Can_not_use_FormatBursh=\u7121\u6CD5\u4F7F\u7528\u8907\u88FD\u683C\u5F0F
CellElement-Property_Table=\u5132\u5B58\u683C\u5C6C\u6027\u8868 CellElement-Property_Table=\u5132\u5B58\u683C\u5C6C\u6027\u8868
Dictionary-Dynamic_SQL=\u52D5\u614BSQL Dictionary-Dynamic_SQL=\u52D5\u614BSQL
FR-Designer_Form-CheckBoxGroup=\u5FA9\u9078\u6846\u7D44 FR-Designer_Form-CheckBoxGroup=\u5FA9\u9078\u6846\u7D44
@ -2000,3 +2000,4 @@ FR-Designer_AlphaFine_Latest=\u6700\u8FD1\u5E38\u7528
FR-Designer_AlphaFine_ShowLess=\u6536\u8D77 FR-Designer_AlphaFine_ShowLess=\u6536\u8D77
FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22 FR-Designer_Alphafine=AlphaFine\u667A\u80FD\u641C\u7D22
FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8 FR-Designer_AlphaFine_ShowAll=\u986F\u793A\u5168\u90E8
FR-Designer-Alphafine_No_Remind=\u4E0D\u518D\u63D0\u793A

35
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -13,10 +13,7 @@ import com.fr.general.LogRecordTime;
import com.fr.stable.xml.LogRecordTimeProvider; import com.fr.stable.xml.LogRecordTimeProvider;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.BadLocationException; import javax.swing.text.*;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -24,6 +21,8 @@ import java.util.Date;
import java.util.logging.Handler; import java.util.logging.Handler;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler { public class DesignerLogHandler {
protected static final int INFO_INT = FRLogLevel.INFO.intValue(); protected static final int INFO_INT = FRLogLevel.INFO.intValue();
protected static final int ERRO_INT = FRLogLevel.ERROR.intValue(); protected static final int ERRO_INT = FRLogLevel.ERROR.intValue();
@ -132,8 +131,7 @@ public class DesignerLogHandler {
private UIMenuItem clear; private UIMenuItem clear;
private LogHandlerArea() { private LogHandlerArea() {
jTextArea = new JTextPane(); jTextArea = initLogJTextArea();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIScrollPane js = new UIScrollPane(jTextArea); UIScrollPane js = new UIScrollPane(jTextArea);
this.add(js, BorderLayout.CENTER); this.add(js, BorderLayout.CENTER);
@ -158,9 +156,9 @@ public class DesignerLogHandler {
clear.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/clear.png")); clear.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/clear.png"));
popup.add(clear); popup.add(clear);
selectAll.setAccelerator(KeyStroke.getKeyStroke('A', InputEvent.CTRL_MASK)); selectAll.setAccelerator(KeyStroke.getKeyStroke('A', DEFAULT_MODIFIER));
copy.setAccelerator(KeyStroke.getKeyStroke('C', InputEvent.CTRL_MASK)); copy.setAccelerator(KeyStroke.getKeyStroke('C', DEFAULT_MODIFIER));
clear.setAccelerator(KeyStroke.getKeyStroke('L', InputEvent.CTRL_MASK)); clear.setAccelerator(KeyStroke.getKeyStroke('L', DEFAULT_MODIFIER));
jTextArea.addMouseListener(new MouseAdapter() { jTextArea.addMouseListener(new MouseAdapter() {
// check for right click // check for right click
@ -188,6 +186,23 @@ public class DesignerLogHandler {
}); });
} }
private JTextPane initLogJTextArea() {
final JTextPane resultPane = new JTextPane();
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear");
ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() {
public void actionPerformed(ActionEvent evt) {
resultPane.setText("");
caption.clearMessage();
DesignerLogImpl.getInstance().clear();
}
});
return resultPane;
}
public void printStackTrace(LogRecordTimeProvider logRecordTime) { public void printStackTrace(LogRecordTimeProvider logRecordTime) {
LogRecord logRecord = logRecordTime.getLogRecord(); LogRecord logRecord = logRecordTime.getLogRecord();
Date date = logRecordTime.getDate(); Date date = logRecordTime.getDate();
@ -297,6 +312,4 @@ public class DesignerLogHandler {
}; };
} }
} }

26
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -11,7 +11,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.*; import com.fr.design.actions.community.*;
import com.fr.design.actions.file.*; import com.fr.design.actions.file.*;
import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.AlphaFine.AlphafineAction; import com.fr.design.actions.help.alphafine.AlphafineAction;
import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.server.*; import com.fr.design.actions.server.*;
@ -55,8 +55,7 @@ public abstract class ToolBarMenuDock {
public static final int PANLE_HEIGNT = 26; public static final int PANLE_HEIGNT = 26;
private MenuDef[] menus; private MenuDef[] menus;
private ToolBarDef toolBarDef; private ToolBarDef toolBarDef;
private ArrayList<UpdateAction> shortCuts; private List<UpdateActionModel> shortCutsList;
/** /**
* 更新菜单 * 更新菜单
*/ */
@ -145,27 +144,36 @@ public abstract class ToolBarMenuDock {
addCommunityMenuDef(menuList); addCommunityMenuDef(menuList);
// 添加全部UpdateAction到actionmanager中 // 添加全部UpdateAction到actionmanager中
getAllUpdateActions(menuList); addAllUpdateActionsToList(menuList);
UpdateActionManager.getUpdateActionManager().setUpdateActions(shortCuts); UpdateActionManager.getUpdateActionManager().setUpdateActions(shortCutsList);
return menuList.toArray(new MenuDef[menuList.size()]); return menuList.toArray(new MenuDef[menuList.size()]);
} }
private List<UpdateAction> getAllUpdateActions(List<MenuDef> menuList) { /**
shortCuts = new ArrayList<>(); * 获取所有actionmodel
* @param menuList
*/
private void addAllUpdateActionsToList(List<MenuDef> menuList) {
shortCutsList = new ArrayList<>();
for (MenuDef menuDef : menuList) { for (MenuDef menuDef : menuList) {
addUpdateActionToList(menuDef); addUpdateActionToList(menuDef);
} }
return shortCuts;
} }
/**
* 递归获取所有UpdateAction
* @param menuDef
*/
private void addUpdateActionToList(MenuDef menuDef) { private void addUpdateActionToList(MenuDef menuDef) {
String ParentName = menuDef.getName();
if (menuDef instanceof OpenRecentReportMenuDef) { if (menuDef instanceof OpenRecentReportMenuDef) {
return; return;
} }
for (ShortCut shortCut : menuDef.getShortcutList()) { for (ShortCut shortCut : menuDef.getShortcutList()) {
if (shortCut instanceof UpdateAction) { if (shortCut instanceof UpdateAction) {
shortCuts.add((UpdateAction) shortCut); shortCutsList.add(new UpdateActionModel(ParentName, (UpdateAction) shortCut));
} else if (shortCut instanceof MenuDef) { } else if (shortCut instanceof MenuDef) {
addUpdateActionToList((MenuDef) shortCut); addUpdateActionToList((MenuDef) shortCut);
} }

8
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
import java.util.List; import java.util.List;
/** /**
@ -9,7 +7,7 @@ import java.util.List;
*/ */
public class UpdateActionManager { public class UpdateActionManager {
private static UpdateActionManager updateActionManager = null; private static UpdateActionManager updateActionManager = null;
private List<UpdateAction> updateActions; private List<UpdateActionModel> updateActions;
public synchronized static UpdateActionManager getUpdateActionManager() { public synchronized static UpdateActionManager getUpdateActionManager() {
if (updateActionManager == null) { if (updateActionManager == null) {
@ -18,11 +16,11 @@ public class UpdateActionManager {
return updateActionManager; return updateActionManager;
} }
public List<UpdateAction> getUpdateActions() { public List<UpdateActionModel> getUpdateActions() {
return updateActions; return updateActions;
} }
public void setUpdateActions(List<UpdateAction> updateActions) { public void setUpdateActions(List<UpdateActionModel> updateActions) {
this.updateActions = updateActions; this.updateActions = updateActions;
} }
} }

58
designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionModel.java

@ -0,0 +1,58 @@
package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
/**
* Created by XiaXiang on 2017/5/24.
*/
/**
* action对象
*/
public class UpdateActionModel {
private String parentName;
private String actionName;
private UpdateAction action;
public UpdateActionModel(String parentName, UpdateAction action) {
this.parentName = parentName;
this.action = action;
this.actionName = action.getName();
}
/**
* 获取上一层级菜单name
* @return
*/
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
/**
* 获取action
* @return
*/
public UpdateAction getAction() {
return action;
}
public void setAction(UpdateAction action) {
this.action = action;
}
/**
* 获取actionName
* @return
*/
public String getActionName() {
return actionName;
}
public void setActionName(String actionName) {
this.actionName = actionName;
}
}

20
designer_base/src/com/fr/design/menu/KeySetUtils.java

@ -12,6 +12,8 @@ import javax.swing.*;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.Locale; import java.util.Locale;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* Author : daisy * Author : daisy
@ -36,7 +38,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_O, DEFAULT_MODIFIER);
} }
}; };
@ -71,7 +73,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_W, DEFAULT_MODIFIER);
} }
}; };
@ -88,7 +90,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_S, DEFAULT_MODIFIER);
} }
}; };
@ -122,7 +124,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_Z, DEFAULT_MODIFIER);
} }
}; };
@ -139,7 +141,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_Y, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_Y, DEFAULT_MODIFIER);
} }
}; };
@ -156,7 +158,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_E, DEFAULT_MODIFIER);
} }
}; };
@ -353,7 +355,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_M, DEFAULT_MODIFIER);
} }
}; };
@ -370,7 +372,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_E, DEFAULT_MODIFIER);
} }
}; };
@ -387,7 +389,7 @@ public class KeySetUtils {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_E, DEFAULT_MODIFIER);
} }
}; };

3
designer_base/src/com/fr/design/roleAuthority/UIRoleTreeUI.java

@ -1,5 +1,6 @@
package com.fr.design.roleAuthority; package com.fr.design.roleAuthority;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.itree.UITreeUI; import com.fr.design.gui.itree.UITreeUI;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
@ -15,7 +16,7 @@ import java.awt.event.MouseEvent;
public class UIRoleTreeUI extends UITreeUI { public class UIRoleTreeUI extends UITreeUI {
protected void selectPathForEvent(TreePath path, MouseEvent event) { /* Adjust from the anchor point. */ protected void selectPathForEvent(TreePath path, MouseEvent event) { /* Adjust from the anchor point. */
if (event.isControlDown() && tree.isPathSelected(path)) { if (InputEventBaseOnOS.isControlDown(event) && tree.isPathSelected(path)) {
tree.removeSelectionPath(path); tree.removeSelectionPath(path);
} else if (event.isShiftDown()) { } else if (event.isShiftDown()) {
tree.setAnchorSelectionPath(null); tree.setAnchorSelectionPath(null);

24
designer_chart/build.9.0.gradle

@ -1,8 +1,28 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "https://maven.eveoh.nl/content/repositories/releases"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.6"
}
}
repositories {
mavenCentral()
}
project.ext {
aspectjVersion = '1.8.4'
}
apply plugin: 'aspectj'
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本

69
designer_chart/build.9.0.gradle.bak

@ -0,0 +1,69 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-chart'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/src"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

8
designer_chart/src/com/fr/aspectj/designerchart/TemplateProcessTracker.aj

@ -32,19 +32,19 @@ public aspect TemplateProcessTracker {
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
before(ActionEvent e) : onActionPerformed(e) { before(ActionEvent e) : onActionPerformed(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
// !within(LogHandlerBar) 没用, 手动过滤 // !within(LogHandlerBar) 没用, 手动过滤
if (e.getSource().toString().contains("javax.swing.Timer")) { if (e != null && e.getSource().toString().contains("javax.swing.Timer")) {
return; return;
} }
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
@ -52,7 +52,7 @@ public aspect TemplateProcessTracker {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
//String log = String.format("%s:\n%s\n插入新图表:%s\n\n", new Date(), sl, c.getChartName()); //String log = String.format("%s:\n%s\n插入新图表:%s\n\n", new Date(), sl, c.getChartName());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }

42
designer_form/build.9.0.gradle

@ -1,8 +1,29 @@
apply plugin: 'java'
tasks.withType(JavaCompile){ tasks.withType(JavaCompile){
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
buildscript {
repositories {
maven {
url "https://maven.eveoh.nl/content/repositories/releases"
}
}
dependencies {
classpath "nl.eveoh:gradle-aspectj:1.6"
}
}
repositories {
mavenCentral()
}
project.ext {
aspectjVersion = '1.8.4'
}
apply plugin: 'aspectj'
//jdk版本 //jdk版本
sourceCompatibility=1.7 sourceCompatibility=1.7
//jar包版本 //jar包版本
@ -38,11 +59,20 @@ dependencies{
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
} }
//.java文件到classes文件夹下参与打包 //.java文件到classes文件夹下参与打包
task copyFile(type:Copy,dependsOn:compileJava){
copy{ //
from ("${srcDir}/src"){ def dataContent ={def dir ->
copySpec{
from ("${dir}"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
} }
}
}
task copyFile(type:Copy,dependsOn:compileJava){
copy{
with dataContent.call("${srcDir}/src")
with dataContent.call("${srcDir}/../designer/src")
into 'build/classes/main' into 'build/classes/main'
} }
@ -61,6 +91,10 @@ task compressJS{
include (name:'**/*.js') include (name:'**/*.js')
include (name:'**/*.css') include (name:'**/*.css')
} }
fileset (dir:"${srcDir}/../designer/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
} }
} }

83
designer_form/build.9.0.gradle.bak

@ -0,0 +1,83 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
//jdk版本
sourceCompatibility=1.7
//jar包版本
version='8.0'
//jar包重命名
jar{
baseName='fr-designer-report'
}
def srcDir="."
def baseDir=".."
//
sourceSets{
main{
java{
srcDirs=["${srcDir}/src",
"${srcDir}/../designer/src"]
}
}
}
//
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
//
dependencies{
compile fileTree(dir:"../${baseDir}/lib",include:'**/*.jar')
compile fileTree(dir:"../${baseDir}",include:"**/build/libs/*.jar",exclude:"bi/**/*.jar")
testCompile 'junit:junit:4.12'
}
//.java文件到classes文件夹下参与打包
//
def dataContent ={def dir ->
copySpec{
from ("${dir}"){
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
}
}
}
task copyFile(type:Copy,dependsOn:compileJava){
copy{
with dataContent.call("${srcDir}/src")
with dataContent.call("${srcDir}/../designer/src")
into 'build/classes/main'
}
}
//js文件
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:"../${baseDir}/lib4build",includes:'**/*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
fileset (dir:"${srcDir}/../designer/src"){
include (name:'**/*.js')
include (name:'**/*.css')
}
}
}
jar.dependsOn compressJS

8
designer_form/src/com/fr/aspectj/designerform/TemplateProcessTracker.aj

@ -30,19 +30,19 @@ public aspect TemplateProcessTracker {
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
before(ActionEvent e) : onActionPerformed(e) { before(ActionEvent e) : onActionPerformed(e) {
SourceLocation sl = thisJoinPoint.getSourceLocation(); SourceLocation sl = thisJoinPoint.getSourceLocation();
// !within(LogHandlerBar) 没用, 手动过滤 // !within(LogHandlerBar) 没用, 手动过滤
if (e.getSource().toString().contains("javax.swing.Timer")) { if (e != null && e.getSource().toString().contains("javax.swing.Timer")) {
return; return;
} }
//String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource()); //String log = String.format("%s:\n%s\n%s\n%s\n\n", new Date(), sl, e, e.getSource());
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }
//同上 //同上
@ -51,7 +51,7 @@ public aspect TemplateProcessTracker {
//String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c); //String log = String.format("%s:\n%s\nset value: %s at (%d, %d)\n\n", new Date(), sl, v, r, c);
String log = ""; String log = "";
TemplateInfoCollector.appendProcess(log); //TemplateInfoCollector.appendProcess(log);
} }

4
designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java

@ -8,6 +8,8 @@ import javax.swing.*;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class CopyAction extends FormEditAction { public class CopyAction extends FormEditAction {
public CopyAction(FormDesigner t) { public CopyAction(FormDesigner t) {
@ -15,7 +17,7 @@ public class CopyAction extends FormEditAction {
this.setName(Inter.getLocText("M_Edit-Copy")); this.setName(Inter.getLocText("M_Edit-Copy"));
this.setMnemonic('C'); this.setMnemonic('C');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
} }
@Override @Override

4
designer_form/src/com/fr/design/designer/beans/actions/CutAction.java

@ -9,6 +9,8 @@ import com.fr.base.BaseUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class CutAction extends FormEditAction { public class CutAction extends FormEditAction {
public CutAction(FormDesigner t) { public CutAction(FormDesigner t) {
@ -16,7 +18,7 @@ public class CutAction extends FormEditAction {
this.setName(Inter.getLocText("M_Edit-Cut")); this.setName(Inter.getLocText("M_Edit-Cut"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
} }
@Override @Override

4
designer_form/src/com/fr/design/designer/beans/actions/PasteAction.java

@ -9,6 +9,8 @@ import com.fr.base.BaseUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class PasteAction extends FormEditAction { public class PasteAction extends FormEditAction {
public PasteAction(FormDesigner t) { public PasteAction(FormDesigner t) {
@ -16,7 +18,7 @@ public class PasteAction extends FormEditAction {
this.setName(Inter.getLocText("M_Edit-Paste")); this.setName(Inter.getLocText("M_Edit-Paste"));
this.setMnemonic('P'); this.setMnemonic('P');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER));
} }
@Override @Override

5
designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -1,5 +1,6 @@
package com.fr.design.designer.beans.models; package com.fr.design.designer.beans.models;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
@ -61,7 +62,7 @@ public class SelectionModel {
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
public void selectACreatorAtMouseEvent(MouseEvent e) { public void selectACreatorAtMouseEvent(MouseEvent e) {
if (!e.isControlDown() && !e.isShiftDown()) { if (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown()) {
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件 // 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
selection.reset(); selection.reset();
} }
@ -372,7 +373,7 @@ public class SelectionModel {
public Direction getDirectionAt(MouseEvent e) { public Direction getDirectionAt(MouseEvent e) {
Direction dir; Direction dir;
if (e.isControlDown() || e.isShiftDown()) { if (InputEventBaseOnOS.isControlDown(e) || e.isShiftDown()) {
XCreator creator = designer.getComponentAt(e.getX(), e.getY(), selection.getSelectedCreators()); XCreator creator = designer.getComponentAt(e.getX(), e.getY(), selection.getSelectedCreators());
if (creator != designer.getRootComponent() && selection.addedable(creator)) { if (creator != designer.getRootComponent() && selection.addedable(creator)) {
return Location.add; return Location.add;

4
designer_form/src/com/fr/design/mainframe/actions/NewFormAction.java

@ -14,6 +14,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class NewFormAction extends UpdateAction { public class NewFormAction extends UpdateAction {
public NewFormAction() { public NewFormAction() {
@ -48,7 +50,7 @@ public class NewFormAction extends UpdateAction {
@Override @Override
public KeyStroke getKeyStroke() { public KeyStroke getKeyStroke() {
return KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK); return KeyStroke.getKeyStroke(KeyEvent.VK_F, DEFAULT_MODIFIER);
} }
}; };
} }

15
designer_form/src/com/fr/design/mainframe/widget/editors/DataTableConfigPane.java

@ -21,6 +21,8 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DataTableConfigPane extends JComponent implements PropertyChangeListener { public class DataTableConfigPane extends JComponent implements PropertyChangeListener {
private DataEditingTable table; private DataEditingTable table;
@ -155,6 +157,8 @@ public class DataTableConfigPane extends JComponent implements PropertyChangeLis
} }
class MouseAdapterListener extends MouseAdapter { class MouseAdapterListener extends MouseAdapter {
private final static int DIS = 30;
private final static int SMALL_DIS = 3;
private JTable table; private JTable table;
int oldY = 0; int oldY = 0;
int newY = 0; int newY = 0;
@ -183,7 +187,7 @@ public class DataTableConfigPane extends JComponent implements PropertyChangeLis
this.setName(Inter.getLocText("M_Edit-Cut")); this.setName(Inter.getLocText("M_Edit-Cut"));
this.setMnemonic('T'); this.setMnemonic('T');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.CTRL_MASK)); this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
} }
@Override @Override
@ -203,7 +207,7 @@ public class DataTableConfigPane extends JComponent implements PropertyChangeLis
height = height + table.getRowHeight(i); height = height + table.getRowHeight(i);
} }
if (height - e.getY() < 3) { if (height - e.getY() < SMALL_DIS) {
drag = true; drag = true;
table.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR)); table.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
} else { } else {
@ -221,10 +225,11 @@ public class DataTableConfigPane extends JComponent implements PropertyChangeLis
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (drag) { if (drag) {
int value = oldHeight + e.getY() - oldY; int value = oldHeight + e.getY() - oldY;
if (value < 30) if (value < DIS) {
table.setRowHeight(row, 30); table.setRowHeight(row, DIS);
else } else {
table.setRowHeight(row, oldHeight + e.getY() - oldY); table.setRowHeight(row, oldHeight + e.getY() - oldY);
}
DataTableConfigPane.this.propertyChange(); DataTableConfigPane.this.propertyChange();
} }
} }

Loading…
Cancel
Save