< prev index next >
src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>
*** 521,540 ****
* should allow Tab to keyboard - accessibility
*/
EditorKit editorKit = getEditorKit(editor);
if ( editorKit != null
&& editorKit instanceof DefaultEditorKit) {
! Set storedForwardTraversalKeys = editor.
getFocusTraversalKeys(KeyboardFocusManager.
FORWARD_TRAVERSAL_KEYS);
! Set storedBackwardTraversalKeys = editor.
getFocusTraversalKeys(KeyboardFocusManager.
BACKWARD_TRAVERSAL_KEYS);
! Set forwardTraversalKeys =
! new HashSet(storedForwardTraversalKeys);
! Set backwardTraversalKeys =
! new HashSet(storedBackwardTraversalKeys);
if (editor.isEditable()) {
forwardTraversalKeys.
remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
backwardTraversalKeys.
remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
--- 521,540 ----
* should allow Tab to keyboard - accessibility
*/
EditorKit editorKit = getEditorKit(editor);
if ( editorKit != null
&& editorKit instanceof DefaultEditorKit) {
! Set<AWTKeyStroke> storedForwardTraversalKeys = editor.
getFocusTraversalKeys(KeyboardFocusManager.
FORWARD_TRAVERSAL_KEYS);
! Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.
getFocusTraversalKeys(KeyboardFocusManager.
BACKWARD_TRAVERSAL_KEYS);
! Set<AWTKeyStroke> forwardTraversalKeys =
! new HashSet<AWTKeyStroke>(storedForwardTraversalKeys);
! Set<AWTKeyStroke> backwardTraversalKeys =
! new HashSet<AWTKeyStroke>(storedBackwardTraversalKeys);
if (editor.isEditable()) {
forwardTraversalKeys.
remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
backwardTraversalKeys.
remove(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
*** 1887,1897 ****
* editor. The factory is added as an argument to the update so that
* the views can update themselves in a dynamic (not hardcoded) way.
*
* @param e The change notification from the currently associated
* document.
! * @see DocumentListener#changeUpdate
*/
public final void changedUpdate(DocumentEvent e) {
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
rootView.changedUpdate(e, alloc, rootView.getViewFactory());
}
--- 1887,1897 ----
* editor. The factory is added as an argument to the update so that
* the views can update themselves in a dynamic (not hardcoded) way.
*
* @param e The change notification from the currently associated
* document.
! * @see DocumentListener#changedUpdate(DocumentEvent)
*/
public final void changedUpdate(DocumentEvent e) {
Rectangle alloc = (painted) ? getVisibleEditorRect() : null;
rootView.changedUpdate(e, alloc, rootView.getViewFactory());
}
*** 1963,1975 ****
if (doc instanceof AbstractDocument) {
((AbstractDocument)doc).readLock();
}
try {
rootView.setSize(alloc.width, alloc.height);
! Enumeration components = constraints.keys();
while (components.hasMoreElements()) {
! Component comp = (Component) components.nextElement();
View v = (View) constraints.get(comp);
Shape ca = calculateViewPosition(alloc, v);
if (ca != null) {
Rectangle compAlloc = (ca instanceof Rectangle) ?
(Rectangle) ca : ca.getBounds();
--- 1963,1975 ----
if (doc instanceof AbstractDocument) {
((AbstractDocument)doc).readLock();
}
try {
rootView.setSize(alloc.width, alloc.height);
! Enumeration<Component> components = constraints.keys();
while (components.hasMoreElements()) {
! Component comp = components.nextElement();
View v = (View) constraints.get(comp);
Shape ca = calculateViewPosition(alloc, v);
if (ca != null) {
Rectangle compAlloc = (ca instanceof Rectangle) ?
(Rectangle) ca : ca.getBounds();
*** 2008,2018 ****
* @param constraint where/how the component is added to the layout.
*/
public void addLayoutComponent(Component comp, Object constraint) {
if (constraint instanceof View) {
if (constraints == null) {
! constraints = new Hashtable(7);
}
constraints.put(comp, constraint);
}
}
--- 2008,2018 ----
* @param constraint where/how the component is added to the layout.
*/
public void addLayoutComponent(Component comp, Object constraint) {
if (constraint instanceof View) {
if (constraints == null) {
! constraints = new Hashtable<Component, Object>(7);
}
constraints.put(comp, constraint);
}
}
*** 2059,2069 ****
/**
* The "layout constraints" for the LayoutManager2 implementation.
* These are View objects for those components that are represented
* by a View in the View tree.
*/
! private Hashtable constraints;
private boolean i18nView = false;
}
/**
--- 2059,2069 ----
/**
* The "layout constraints" for the LayoutManager2 implementation.
* These are View objects for those components that are represented
* by a View in the View tree.
*/
! private Hashtable<Component, Object> constraints;
private boolean i18nView = false;
}
/**
*** 2456,2467 ****
*/
public boolean importData(JComponent comp, Transferable t) {
JTextComponent c = (JTextComponent)comp;
int pos = modeBetween
! ? ((JTextComponent.DropLocation)c.getDropLocation()).getIndex()
! : c.getCaretPosition();
// if we are importing to the same component that we exported from
// then don't actually do anything if the drop location is inside
// the drag location and set shouldRemove to false so that exportDone
// knows not to remove any data
--- 2456,2466 ----
*/
public boolean importData(JComponent comp, Transferable t) {
JTextComponent c = (JTextComponent)comp;
int pos = modeBetween
! ? c.getDropLocation().getIndex() : c.getCaretPosition();
// if we are importing to the same component that we exported from
// then don't actually do anything if the drop location is inside
// the drag location and set shouldRemove to false so that exportDone
// knows not to remove any data
< prev index next >