8274634: Use String.equals instead of String.compareTo in java.desktop
Reviewed-by: serb, pbansal
This commit is contained in:
parent
32811026ce
commit
6726c592ed
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -115,19 +115,19 @@ class CAccessible extends CFRetainedResource implements Accessible {
|
|||||||
if ( ptr != 0 ) {
|
if ( ptr != 0 ) {
|
||||||
Object newValue = e.getNewValue();
|
Object newValue = e.getNewValue();
|
||||||
Object oldValue = e.getOldValue();
|
Object oldValue = e.getOldValue();
|
||||||
if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) {
|
if (name.equals(ACCESSIBLE_CARET_PROPERTY)) {
|
||||||
selectedTextChanged(ptr);
|
selectedTextChanged(ptr);
|
||||||
} else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0) {
|
} else if (name.equals(ACCESSIBLE_TEXT_PROPERTY)) {
|
||||||
valueChanged(ptr);
|
valueChanged(ptr);
|
||||||
} else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0) {
|
} else if (name.equals(ACCESSIBLE_SELECTION_PROPERTY)) {
|
||||||
selectionChanged(ptr);
|
selectionChanged(ptr);
|
||||||
} else if (name.compareTo(ACCESSIBLE_TABLE_MODEL_CHANGED) == 0) {
|
} else if (name.equals(ACCESSIBLE_TABLE_MODEL_CHANGED)) {
|
||||||
valueChanged(ptr);
|
valueChanged(ptr);
|
||||||
} else if (name.compareTo(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0 ) {
|
} else if (name.equals(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY)) {
|
||||||
if (newValue instanceof AccessibleContext) {
|
if (newValue instanceof AccessibleContext) {
|
||||||
activeDescendant = (AccessibleContext)newValue;
|
activeDescendant = (AccessibleContext)newValue;
|
||||||
}
|
}
|
||||||
} else if (name.compareTo(ACCESSIBLE_STATE_PROPERTY) == 0) {
|
} else if (name.equals(ACCESSIBLE_STATE_PROPERTY)) {
|
||||||
AccessibleContext thisAC = accessible.getAccessibleContext();
|
AccessibleContext thisAC = accessible.getAccessibleContext();
|
||||||
AccessibleRole thisRole = thisAC.getAccessibleRole();
|
AccessibleRole thisRole = thisAC.getAccessibleRole();
|
||||||
Accessible parentAccessible = thisAC.getAccessibleParent();
|
Accessible parentAccessible = thisAC.getAccessibleParent();
|
||||||
@ -167,12 +167,12 @@ class CAccessible extends CFRetainedResource implements Accessible {
|
|||||||
if (thisRole == AccessibleRole.CHECK_BOX) {
|
if (thisRole == AccessibleRole.CHECK_BOX) {
|
||||||
valueChanged(ptr);
|
valueChanged(ptr);
|
||||||
}
|
}
|
||||||
} else if (name.compareTo(ACCESSIBLE_NAME_PROPERTY) == 0) {
|
} else if (name.equals(ACCESSIBLE_NAME_PROPERTY)) {
|
||||||
//for now trigger only for JTabbedPane.
|
//for now trigger only for JTabbedPane.
|
||||||
if (e.getSource() instanceof JTabbedPane) {
|
if (e.getSource() instanceof JTabbedPane) {
|
||||||
titleChanged(ptr);
|
titleChanged(ptr);
|
||||||
}
|
}
|
||||||
} else if (name.compareTo(ACCESSIBLE_VALUE_PROPERTY) == 0) {
|
} else if (name.equals(ACCESSIBLE_VALUE_PROPERTY)) {
|
||||||
AccessibleRole thisRole = accessible.getAccessibleContext()
|
AccessibleRole thisRole = accessible.getAccessibleContext()
|
||||||
.getAccessibleRole();
|
.getAccessibleRole();
|
||||||
if (thisRole == AccessibleRole.SLIDER ||
|
if (thisRole == AccessibleRole.SLIDER ||
|
||||||
|
@ -2947,7 +2947,7 @@ public class JList<E> extends JComponent implements Scrollable, Accessible
|
|||||||
Object newValue = e.getNewValue();
|
Object newValue = e.getNewValue();
|
||||||
|
|
||||||
// re-set listData listeners
|
// re-set listData listeners
|
||||||
if (name.compareTo("model") == 0) {
|
if (name.equals("model")) {
|
||||||
|
|
||||||
if (oldValue != null && oldValue instanceof ListModel) {
|
if (oldValue != null && oldValue instanceof ListModel) {
|
||||||
((ListModel) oldValue).removeListDataListener(this);
|
((ListModel) oldValue).removeListDataListener(this);
|
||||||
@ -2957,7 +2957,7 @@ public class JList<E> extends JComponent implements Scrollable, Accessible
|
|||||||
}
|
}
|
||||||
|
|
||||||
// re-set listSelectionModel listeners
|
// re-set listSelectionModel listeners
|
||||||
} else if (name.compareTo("selectionModel") == 0) {
|
} else if (name.equals("selectionModel")) {
|
||||||
|
|
||||||
if (oldValue != null && oldValue instanceof ListSelectionModel) {
|
if (oldValue != null && oldValue instanceof ListSelectionModel) {
|
||||||
((ListSelectionModel) oldValue).removeListSelectionListener(this);
|
((ListSelectionModel) oldValue).removeListSelectionListener(this);
|
||||||
|
@ -6756,7 +6756,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||||||
Object newValue = e.getNewValue();
|
Object newValue = e.getNewValue();
|
||||||
|
|
||||||
// re-set tableModel listeners
|
// re-set tableModel listeners
|
||||||
if (name.compareTo("model") == 0) {
|
if (name.equals("model")) {
|
||||||
|
|
||||||
if (oldValue != null && oldValue instanceof TableModel) {
|
if (oldValue != null && oldValue instanceof TableModel) {
|
||||||
((TableModel) oldValue).removeTableModelListener(this);
|
((TableModel) oldValue).removeTableModelListener(this);
|
||||||
@ -6766,7 +6766,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// re-set selectionModel listeners
|
// re-set selectionModel listeners
|
||||||
} else if (name.compareTo("selectionModel") == 0) {
|
} else if (name.equals("selectionModel")) {
|
||||||
|
|
||||||
Object source = e.getSource();
|
Object source = e.getSource();
|
||||||
if (source == JTable.this) { // row selection model
|
if (source == JTable.this) { // row selection model
|
||||||
@ -6797,7 +6797,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||||||
|
|
||||||
// re-set columnModel listeners
|
// re-set columnModel listeners
|
||||||
// and column's selection property listener as well
|
// and column's selection property listener as well
|
||||||
} else if (name.compareTo("columnModel") == 0) {
|
} else if (name.equals("columnModel")) {
|
||||||
|
|
||||||
if (oldValue != null && oldValue instanceof TableColumnModel) {
|
if (oldValue != null && oldValue instanceof TableColumnModel) {
|
||||||
TableColumnModel tcm = (TableColumnModel) oldValue;
|
TableColumnModel tcm = (TableColumnModel) oldValue;
|
||||||
@ -6811,7 +6811,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// re-se cellEditor listeners
|
// re-se cellEditor listeners
|
||||||
} else if (name.compareTo("tableCellEditor") == 0) {
|
} else if (name.equals("tableCellEditor")) {
|
||||||
|
|
||||||
if (oldValue != null && oldValue instanceof TableCellEditor) {
|
if (oldValue != null && oldValue instanceof TableCellEditor) {
|
||||||
((TableCellEditor) oldValue).removeCellEditorListener(this);
|
((TableCellEditor) oldValue).removeCellEditorListener(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user