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;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection;
@ -71,7 +72,7 @@ public class GridKeyListener implements KeyListener {
// Richie:Ctrl + A全选单元格
case KeyEvent.VK_A:
boolean macOS = OperatingSystem.isMacOS() && evt.isMetaDown();
boolean windows = OperatingSystem.isWindows() && evt.isControlDown();
boolean windows = OperatingSystem.isWindows() && InputEventBaseOnOS.isControlDown(evt);
if (macOS || windows) {
reportPane.setSelection(new CellSelection(0, 0, report.getColumnCount(), report.getRowCount()));
isNeedRepaint = true;
@ -168,7 +169,7 @@ public class GridKeyListener implements KeyListener {
return;
}
KeyEvent newEvt = KeyEventWork.processKeyEvent(evt);
if (newEvt == null || evt.isControlDown()) {// uneditable.
if (newEvt == null || InputEventBaseOnOS.isControlDown(evt)) {// uneditable.
return;
}
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;
import com.fr.common.inputevent.InputEventBaseOnOS;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
@ -76,7 +78,7 @@ public class ExtendedComboBox extends UIComboBox {
protected JList createList() {
return new JList(comboBox.getModel()) {
public void processMouseEvent(MouseEvent e) {
if (e.isControlDown()) {
if (InputEventBaseOnOS.isControlDown(e)) {
// Fix for 4234053. Filter out the Control
// Key from the list.
// 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.ComboPopup;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants;
import sun.swing.DefaultLookup;
@ -209,7 +210,7 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener {
@Override
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.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.EmptyBorder;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.stable.StringUtils;
@ -176,7 +177,7 @@ public class CheckBoxList extends JComponent {
@Override
protected void processMouseEvent(MouseEvent e) {
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();
if (indices.length == 0) {
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 javax.swing.Icon;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JTable;
import javax.swing.event.TableModelEvent;
@ -396,7 +398,7 @@ public class TableSorter extends AbstractTableModel {
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
if (!InputEventBaseOnOS.isControlDown(e)) {
cancelSorting();
}
// 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;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.general.NameObject;
import com.fr.design.gui.itree.refreshabletree.loader.ChildrenLoaderFactory;
import com.fr.general.ComparatorUtils;
@ -147,7 +148,7 @@ public abstract class UserObjectRefreshJTree<T extends UserObjectOP<?>> extends
}
}
// marks:鼠标在上次选中的paths上,则将上次的paths设为的树的路径,否则将鼠标所在的节点设为选中的节点
if (!(e.isShiftDown() || e.isControlDown())) {
if (!(e.isShiftDown() || InputEventBaseOnOS.isControlDown(e))) {
if (isFind) {
setSelectionPaths(oldPaths);
} else {

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

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

Loading…
Cancel
Save