Browse Source

back 1

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

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

@ -3,7 +3,6 @@ package com.fr.design.mainframe;
import com.fr.base.ConfigManager;
import com.fr.base.ConfigManagerProvider;
import com.fr.base.FRContext;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icombobox.UIComboBox;
@ -68,7 +67,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
buttonlists.get(i).setSelected(true);
}
}
} else if (!InputEventBaseOnOS.isControlDown(e)) {
} else if (!e.isControlDown()) {
//实现单选
removeSelection();
if (selectedIndex != -1) {

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

@ -1,6 +1,5 @@
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;
@ -67,7 +66,7 @@ public class GridKeyListener implements KeyListener {
}
// Richie:Ctrl + A全选单元格
case KeyEvent.VK_A:
if (InputEventBaseOnOS.isControlDown(evt)) {
if (evt.isControlDown()) {
reportPane.setSelection(new CellSelection(0, 0, report.getColumnCount(), report.getRowCount()));
}
isNeedRepaint = true;
@ -161,7 +160,7 @@ public class GridKeyListener implements KeyListener {
return;
}
KeyEvent newEvt = KeyEventWork.processKeyEvent(evt);
if (newEvt == null || InputEventBaseOnOS.isControlDown(evt)) {// uneditable.
if (newEvt == null || evt.isControlDown()) {// uneditable.
return;
}
char ch = evt.getKeyChar();

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

@ -3,7 +3,6 @@ package com.fr.grid;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
@ -165,7 +164,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
ElementCasePane reportPane = grid.getElementCasePane();
TemplateElementCase report = reportPane.getEditingElementCase();
boolean isShiftDown = evt.isShiftDown();
boolean isControlDown = InputEventBaseOnOS.isControlDown(evt);
boolean isControlDown = evt.isControlDown();
int clickCount = evt.getClickCount();
// peter:需要判断是否在可移动CellSelection的区域
grid.setDragType(isMoveCellSelection(this.oldEvtX, this.oldEvtY));
@ -337,7 +336,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
return;
}
boolean isControlDown = InputEventBaseOnOS.isControlDown(evt);
boolean isControlDown = evt.isControlDown();
long systemCurrentTime = System.currentTimeMillis();
if (systemCurrentTime - lastMouseMoveTime <= DRAG_REFRESH_TIME) {// alex:Drag

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

@ -1,21 +0,0 @@
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();
}
}

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

@ -1,23 +1,12 @@
package com.fr.design.gui.icombobox;
import com.fr.common.inputevent.InputEventBaseOnOS;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.plaf.basic.ComboPopup;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.Vector;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -78,7 +67,7 @@ public class ExtendedComboBox extends UIComboBox {
protected JList createList() {
return new JList(comboBox.getModel()) {
public void processMouseEvent(MouseEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) {
if (e.isControlDown()) {
// Fix for 4234053. Filter out the Control
// Key from the list.
// ie., don't allow CTRL key deselection.

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

@ -1,29 +1,19 @@
package com.fr.design.gui.icombobox;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.*;
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;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import sun.swing.DefaultLookup;
import javax.swing.*;
import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.plaf.basic.ComboPopup;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
@ -210,7 +200,7 @@ public class UIComboBoxUI extends BasicComboBoxUI implements MouseListener {
@Override
public void processMouseEvent(MouseEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) {
if (e.isControlDown()) {
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/itable/TableSorter.java

@ -16,7 +16,6 @@ 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;
@ -394,7 +393,7 @@ public class TableSorter extends AbstractTableModel {
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!InputEventBaseOnOS.isControlDown(e)) {
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or

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

@ -1,6 +1,5 @@
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;
@ -148,7 +147,7 @@ public abstract class UserObjectRefreshJTree<T extends UserObjectOP<?>> extends
}
}
// marks:鼠标在上次选中的paths上,则将上次的paths设为的树的路径,否则将鼠标所在的节点设为选中的节点
if (!(e.isShiftDown() || InputEventBaseOnOS.isControlDown(e))) {
if (!(e.isShiftDown() || e.isControlDown())) {
if (isFind) {
setSelectionPaths(oldPaths);
} else {

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

@ -1,6 +1,5 @@
package com.fr.design.roleAuthority;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.gui.itree.UITreeUI;
import javax.swing.tree.TreePath;
@ -16,7 +15,7 @@ import java.awt.event.MouseEvent;
public class UIRoleTreeUI extends UITreeUI {
protected void selectPathForEvent(TreePath path, MouseEvent event) { /* Adjust from the anchor point. */
if (InputEventBaseOnOS.isControlDown(event) && tree.isPathSelected(path)) {
if (event.isControlDown() && 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,6 +1,5 @@
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;
@ -62,7 +61,7 @@ public class SelectionModel {
* @param e 鼠标事件
*/
public void selectACreatorAtMouseEvent(MouseEvent e) {
if (!InputEventBaseOnOS.isControlDown(e) && !e.isShiftDown()) {
if (!e.isControlDown() && !e.isShiftDown()) {
// 如果Ctrl或者Shift键盘没有按下,则清除已经选择的组件
selection.reset();
}
@ -373,7 +372,7 @@ public class SelectionModel {
public Direction getDirectionAt(MouseEvent e) {
Direction dir;
if (InputEventBaseOnOS.isControlDown(e) || e.isShiftDown()) {
if (e.isControlDown() || 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