hzzz 8 years ago
parent
commit
54c008a3b9
  1. 13
      designer_base/src/com/fr/design/gui/ilist/UIList.java
  2. 13
      designer_base/src/com/fr/design/gui/itextarea/UITextArea.java
  3. 17
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  4. 9
      designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java
  5. 9
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

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

@ -6,10 +6,14 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Vector; import java.util.Vector;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: pony * User: pony
@ -22,6 +26,15 @@ public class UIList extends JList{
public UIList() { public UIList() {
super(); super();
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER),
DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER),
DefaultEditorKit.pasteAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER),
DefaultEditorKit.cutAction);
} }
public UIList(ListModel dataModel) { public UIList(ListModel dataModel) {

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

@ -7,13 +7,26 @@ 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();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER),
DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER),
DefaultEditorKit.pasteAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER),
DefaultEditorKit.cutAction);
initComponents(); initComponents();
} }

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

@ -1,12 +1,12 @@
package com.fr.design.gui.itextfield; package com.fr.design.gui.itextfield;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyEvent;
import javax.swing.JFrame; import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JTextField;
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 javax.swing.text.Document; import javax.swing.text.Document;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
@ -16,6 +16,8 @@ import com.fr.design.event.UIObserverListener;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* @author Jerry * @author Jerry
*/ */
@ -30,6 +32,15 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() { public UITextField() {
super(); super();
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER),
DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER),
DefaultEditorKit.pasteAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER),
DefaultEditorKit.cutAction);
initListener(); initListener();
} }

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

@ -16,10 +16,10 @@ 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.*;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener; import javax.swing.event.TreeSelectionListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Position; import javax.swing.text.Position;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
@ -29,6 +29,8 @@ import javax.swing.tree.TreePath;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/** /**
* 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
@ -87,6 +89,9 @@ public class CheckBoxTree extends JTree {
public CheckBoxTree(TreeModel newModel) { public CheckBoxTree(TreeModel newModel) {
super(newModel); super(newModel);
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
"selectAll");
init(); init();
} }

9
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;
@ -192,9 +189,9 @@ public class DesignerLogHandler {
private JTextPane initLogJTextArea() { private JTextPane initLogJTextArea() {
JTextPane resultPane = new JTextPane(); JTextPane resultPane = new JTextPane();
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy"); 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"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear");
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), "select-all");
ActionMap actionMap = resultPane.getActionMap(); ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() { actionMap.put("clear", new AbstractAction() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {

Loading…
Cancel
Save