Browse Source

REPORT-2773 mac中复制快捷键的修复

master
hzzz 8 years ago
parent
commit
3cf5553cd3
  1. 366
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  2. 5
      designer/src/com/fr/grid/GridKeyListener.java
  3. 1605
      designer/src/com/fr/grid/GridMouseAdapter.java
  4. 21
      designer_base/src/com/fr/common/inputevent/InputEventBaseOnOS.java
  5. 4
      designer_base/src/com/fr/design/gui/icombobox/ExtendedComboBox.java
  6. 3
      designer_base/src/com/fr/design/gui/icombobox/UIComboBoxUI.java
  7. 3
      designer_base/src/com/fr/design/gui/ilist/CheckBoxList.java
  8. 4
      designer_base/src/com/fr/design/gui/itable/TableSorter.java
  9. 3
      designer_base/src/com/fr/design/gui/itree/refreshabletree/UserObjectRefreshJTree.java
  10. 3
      designer_base/src/com/fr/design/roleAuthority/UIRoleTreeUI.java
  11. 5
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

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

File diff suppressed because one or more lines are too long

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

@ -1,5 +1,6 @@
package com.fr.grid; package com.fr.grid;
import com.fr.common.inputevent.InputEventBaseOnOS;
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;
@ -71,7 +72,7 @@ public class GridKeyListener implements KeyListener {
// Richie:Ctrl + A全选单元格 // Richie:Ctrl + A全选单元格
case KeyEvent.VK_A: case KeyEvent.VK_A:
boolean macOS = OperatingSystem.isMacOS() && evt.isMetaDown(); boolean macOS = OperatingSystem.isMacOS() && evt.isMetaDown();
boolean windows = OperatingSystem.isWindows() && evt.isControlDown(); boolean windows = OperatingSystem.isWindows() && InputEventBaseOnOS.isControlDown(evt);
if (macOS || windows) { if (macOS || windows) {
reportPane.setSelection(new CellSelection(0, 0, report.getColumnCount(), report.getRowCount())); reportPane.setSelection(new CellSelection(0, 0, report.getColumnCount(), report.getRowCount()));
isNeedRepaint = true; isNeedRepaint = true;
@ -168,7 +169,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();

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

File diff suppressed because it is too large Load Diff

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 isMacOS = OperatingSystem.isMacOS();
public static boolean isControlDown(MouseEvent e) {
return isMacOS ? e.isMetaDown() : e.isControlDown();
}
public static boolean isControlDown(KeyEvent e) {
return isMacOS ? e.isMetaDown() : e.isControlDown();
}
}

4
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;
@ -76,7 +78,7 @@ 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.

3
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;
@ -209,7 +210,7 @@ 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() ^ DEFAULT_MODIFIER, 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());
} }

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

@ -22,6 +22,7 @@ import javax.swing.UIManager;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -176,7 +177,7 @@ public class CheckBoxList extends JComponent {
@Override @Override
protected void processMouseEvent(MouseEvent e) { protected void processMouseEvent(MouseEvent e) {
if (e.getX() < 20) { if (e.getX() < 20) {
if (e.isControlDown() || e.isAltDown() || e.isShiftDown() || e.isMetaDown()) { if (InputEventBaseOnOS.isControlDown(e) || e.isAltDown() || e.isShiftDown() || e.isMetaDown()) {
int[] indices = getSelectedIndices(); int[] indices = getSelectedIndices();
if (indices.length == 0) { if (indices.length == 0) {
super.processMouseEvent(e); super.processMouseEvent(e);

4
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;
@ -396,7 +398,7 @@ 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

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 {

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);

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;

Loading…
Cancel
Save