You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/11/10 06:15:16 UTC
svn commit: r473193 -
/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/
Author: ndbeyer
Date: Thu Nov 9 21:15:08 2006
New Revision: 473193
URL: http://svn.apache.org/viewvc?view=rev&rev=473193
Log:
Code cleanup -
* Add explicit serialVersionUID fields
* Add missing annotations
* Add missing type variables
* Remove unnecessary modifiers in interfaces
* Some code formatting
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractAction.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractButton.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractCellEditor.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractListModel.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractSpinnerModel.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Action.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionMap.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionProxy.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BorderFactory.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoundedRangeModel.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Box.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoxLayout.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonGroup.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonModel.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/CellEditor.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JViewport.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractAction.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractAction.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractAction.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractAction.java Thu Nov 9 21:15:08 2006
@@ -14,45 +14,42 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.HashMap;
-
import javax.swing.event.SwingPropertyChangeSupport;
-
import org.apache.harmony.x.swing.StringConstants;
-
public abstract class AbstractAction implements Action, Cloneable, Serializable {
-
protected boolean enabled = true;
+
protected SwingPropertyChangeSupport changeSupport = new SwingPropertyChangeSupport(this);
- private HashMap properties;
+ private HashMap<String, Object> properties;
public AbstractAction() {
+ super();
}
public AbstractAction(final String name) {
- properties = new HashMap();
+ super();
+ properties = new HashMap<String, Object>();
properties.put(Action.NAME, name);
}
public AbstractAction(final String name, final Icon icon) {
- properties = new HashMap();
+ super();
+ properties = new HashMap<String, Object>();
properties.put(Action.NAME, name);
properties.put(Action.SMALL_ICON, icon);
}
public void putValue(final String name, final Object value) {
if (properties == null) {
- properties = new HashMap();
+ properties = new HashMap<String, Object>();
}
Object oldValue = properties.get(name);
if (value != oldValue) {
@@ -69,10 +66,12 @@
return (properties != null) ? properties.keySet().toArray() : new Object[0];
}
+ @SuppressWarnings("unchecked")
+ @Override
protected Object clone() throws CloneNotSupportedException {
- AbstractAction cloned = (AbstractAction)super.clone();
+ AbstractAction cloned = (AbstractAction) super.clone();
if (properties != null) {
- cloned.properties = (HashMap)properties.clone();
+ cloned.properties = (HashMap<String, Object>) properties.clone();
}
return cloned;
}
@@ -89,23 +88,19 @@
return changeSupport.getPropertyChangeListeners();
}
- protected void firePropertyChange(final String propertyName,
- final Object oldValue,
- final Object newValue) {
+ protected void firePropertyChange(final String propertyName, final Object oldValue,
+ final Object newValue) {
changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
public void setEnabled(final boolean enabled) {
boolean oldValue = this.enabled;
this.enabled = enabled;
- firePropertyChange(StringConstants.ENABLED_PROPERTY_CHANGED,
- Boolean.valueOf(oldValue),
- Boolean.valueOf(enabled));
+ firePropertyChange(StringConstants.ENABLED_PROPERTY_CHANGED, Boolean.valueOf(oldValue),
+ Boolean.valueOf(enabled));
}
public boolean isEnabled() {
return enabled;
}
-
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractButton.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractButton.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractButton.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractButton.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.awt.Graphics;
@@ -61,6 +58,7 @@
implements AccessibleAction, AccessibleValue, AccessibleText,
AccessibleExtendedComponent, Serializable {
+ @Override
public AccessibleKeyBinding getAccessibleKeyBinding() {
return null;
}
@@ -69,29 +67,36 @@
return 1;
}
+ @Override
public String getToolTipText() {
return AbstractButton.this.getToolTipText();
}
+ @Override
public AccessibleValue getAccessibleValue() {
return this;
}
+ @Override
public AccessibleText getAccessibleText() {
return null;
}
+ @Override
public String getAccessibleName() {
return (super.getAccessibleName() != null) ? super.getAccessibleName() : getText();
}
+ @Override
public AccessibleRelationSet getAccessibleRelationSet() {
return super.getAccessibleRelationSet();
}
+ @Override
public String getTitledBorderText() {
return super.getTitledBorderText();
}
+ @Override
public AccessibleStateSet getAccessibleStateSet() {
AccessibleStateSet set = super.getAccessibleStateSet();
if (isSelected()) {
@@ -101,6 +106,7 @@
return set;
}
+ @Override
public AccessibleIcon[] getAccessibleIcon() {
if (icon != null && icon instanceof ImageIcon) {
return new AccessibleIcon[] { (AccessibleIcon)((ImageIcon)icon).getAccessibleContext() };
@@ -109,6 +115,7 @@
return null;
}
+ @Override
public AccessibleAction getAccessibleAction() {
return this;
}
@@ -249,6 +256,7 @@
public static final String DISABLED_SELECTED_ICON_CHANGED_PROPERTY = "disabledSelectedIcon";
private static final Object ALL_ACTION_PROPERTIES = new Object() { //$NON-LOCK-1$
+ @Override
public boolean equals(final Object o) {
return true;
}
@@ -256,7 +264,9 @@
private static final Action CLEAR_ACTION_PROPERTIES = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {}
+ @Override
public void putValue(final String name, final Object value) {}
+ @Override
public void setEnabled(final boolean enabled) {}
};
@@ -331,7 +341,7 @@
}
public ChangeListener[] getChangeListeners() {
- return (ChangeListener[])listenerList.getListeners(ChangeListener.class);
+ return listenerList.getListeners(ChangeListener.class);
}
protected ChangeListener createChangeListener() {
@@ -545,9 +555,7 @@
}
}
- /**
- * @deprecated
- */
+ @Deprecated
public void setLabel(final String label) {
setText(label);
}
@@ -568,9 +576,7 @@
return text;
}
- /**
- * @deprecated
- */
+ @Deprecated
public String getLabel() {
return getText();
}
@@ -593,7 +599,7 @@
}
public ItemListener[] getItemListeners() {
- return (ItemListener[])listenerList.getListeners(ItemListener.class);
+ return listenerList.getListeners(ItemListener.class);
}
protected ItemListener createItemListener() {
@@ -619,7 +625,7 @@
}
public ActionListener[] getActionListeners() {
- return (ActionListener[])listenerList.getListeners(ActionListener.class);
+ return listenerList.getListeners(ActionListener.class);
}
protected ActionListener createActionListener() {
@@ -647,6 +653,7 @@
return margin;
}
+ @Override
public boolean imageUpdate(final Image img, final int infoflags, final int x, final int y, final int w, final int h) {
Icon curIcon = ButtonCommons.getCurrentIcon(this);
if ((curIcon == null) ||
@@ -658,6 +665,7 @@
return super.imageUpdate(img, infoflags, x, y, w, h);
}
+ @Override
protected void paintBorder(final Graphics g) {
if (isBorderPainted()) {
super.paintBorder(g);
@@ -712,6 +720,7 @@
firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, oldValue, painted);
}
+ @Override
public void setEnabled(final boolean enabled) {
model.setEnabled(enabled);
super.setEnabled(enabled);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractCellEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractCellEditor.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractCellEditor.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractCellEditor.java Thu Nov 9 21:15:08 2006
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-/**
- * @author Anton Avtamonov
- * @version $Revision$
- */
package javax.swing;
import java.io.Serializable;
@@ -58,7 +54,7 @@
}
public CellEditorListener[] getCellEditorListeners() {
- return (CellEditorListener[])listenerList.getListeners(CellEditorListener.class);
+ return listenerList.getListeners(CellEditorListener.class);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractListModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractListModel.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractListModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractListModel.java Thu Nov 9 21:15:08 2006
@@ -15,16 +15,9 @@
* limitations under the License.
*/
-/**
- * @author Anton Avtamonov
- * @version $Revision$
- */
-
package javax.swing;
import java.io.Serializable;
-import java.util.EventListener;
-
import javax.swing.event.EventListenerList;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
@@ -41,7 +34,7 @@
}
public ListDataListener[] getListDataListeners() {
- return (ListDataListener[])getListeners(ListDataListener.class);
+ return getListeners(ListDataListener.class);
}
public <T extends java.util.EventListener> T[] getListeners(final Class<T> listenerType) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractSpinnerModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractSpinnerModel.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractSpinnerModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/AbstractSpinnerModel.java Thu Nov 9 21:15:08 2006
@@ -15,16 +15,8 @@
* limitations under the License.
*/
-
-/**
- * @author Sergey Burlak
- * @version $Revision$
- */
-
package javax.swing;
-import java.util.EventListener;
-
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
@@ -42,7 +34,7 @@
}
public ChangeListener[] getChangeListeners() {
- return (ChangeListener[])listenerList.getListeners(ChangeListener.class);
+ return listenerList.getListeners(ChangeListener.class);
}
protected void fireStateChanged() {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Action.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Action.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Action.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Action.java Thu Nov 9 21:15:08 2006
@@ -15,39 +15,37 @@
* limitations under the License.
*/
-/**
- * @author Sergey Burlak
- * @version $Revision$
- */
-
package javax.swing;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener;
public interface Action extends ActionListener {
+ String DEFAULT = "Default";
- public static final String DEFAULT = "Default";
- public static final String NAME = "Name";
- public static final String SHORT_DESCRIPTION = "ShortDescription";
- public static final String LONG_DESCRIPTION = "LongDescription";
- public static final String SMALL_ICON = "SmallIcon";
- public static final String ACTION_COMMAND_KEY = "ActionCommandKey";
- public static final String ACCELERATOR_KEY = "AcceleratorKey";
- public static final String MNEMONIC_KEY = "MnemonicKey";
+ String NAME = "Name";
- public void putValue(final String key, final Object value);
+ String SHORT_DESCRIPTION = "ShortDescription";
- public Object getValue(final String key);
+ String LONG_DESCRIPTION = "LongDescription";
- public void removePropertyChangeListener(final PropertyChangeListener l);
+ String SMALL_ICON = "SmallIcon";
- public void addPropertyChangeListener(final PropertyChangeListener l);
+ String ACTION_COMMAND_KEY = "ActionCommandKey";
- public void setEnabled(final boolean b);
+ String ACCELERATOR_KEY = "AcceleratorKey";
- public boolean isEnabled();
+ String MNEMONIC_KEY = "MnemonicKey";
-}
+ void putValue(String key, Object value);
+
+ Object getValue(String key);
+ void removePropertyChangeListener(PropertyChangeListener l);
+ void addPropertyChangeListener(PropertyChangeListener l);
+
+ void setEnabled(boolean b);
+
+ boolean isEnabled();
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionMap.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionMap.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionMap.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.io.Serializable;
@@ -26,14 +23,16 @@
import java.util.HashSet;
public class ActionMap implements Serializable {
+ private static final long serialVersionUID = -6277518704513986346L;
private ActionMap parent;
- private HashMap table;
+
+ private HashMap<Object, Action> table;
public void put(final Object key, final Action action) {
if (action != null) {
if (table == null) {
- table = new HashMap();
+ table = new HashMap<Object, Action>();
}
table.put(key, action);
} else {
@@ -44,12 +43,11 @@
public Action get(final Object key) {
Action action = null;
if (table != null) {
- action = (Action)table.get(key);
+ action = table.get(key);
}
if (action == null && getParent() != null) {
action = getParent().get(key);
}
-
return action;
}
@@ -86,7 +84,7 @@
if (parentKeys.length == 0) {
return keys;
}
- HashSet keySet = new HashSet(Arrays.asList(keys));
+ HashSet<Object> keySet = new HashSet<Object>(Arrays.asList(keys));
keySet.addAll(Arrays.asList(parentKeys));
return keySet.toArray(new Object[keySet.size()]);
}
@@ -100,6 +98,4 @@
public int size() {
return (table != null) ? table.size() : 0;
}
-
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionProxy.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionProxy.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionProxy.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ActionProxy.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.awt.event.ActionEvent;
@@ -25,11 +22,14 @@
import java.beans.PropertyChangeListener;
import java.io.Serializable;
+@SuppressWarnings("serial")
final class ActionProxy implements Action, Serializable {
private final String command;
+
private final ActionListener listener;
public ActionProxy(final String command, final ActionListener listener) {
+ super();
this.command = command;
this.listener = listener;
}
@@ -64,4 +64,3 @@
listener.actionPerformed(event);
}
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BequestedFocusTraversalPolicy.java Thu Nov 9 21:15:08 2006
@@ -14,12 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- * Created on 07.07.2005
- *
- */
+
package javax.swing;
import java.awt.Component;
@@ -27,9 +22,10 @@
import java.awt.FocusTraversalPolicy;
class BequestedFocusTraversalPolicy extends FocusTraversalPolicy {
-
private final FocusTraversalPolicy ancestor;
+
private final Component fixedComponent;
+
private final Component fixedNextComponent;
/**
@@ -41,8 +37,7 @@
* @throws <code>IllegalArgumentException</code> if <code>ancestor</code> is <code>null</code>
*/
public BequestedFocusTraversalPolicy(final FocusTraversalPolicy ancestor,
- final Component fixedComponent,
- final Component fixedNextComponent) {
+ final Component fixedComponent, final Component fixedNextComponent) {
super();
this.ancestor = ancestor;
if (this.ancestor == null) {
@@ -56,6 +51,7 @@
* returns <code>fixedNextComponent</code> for <code>fixedComponent</code> or
* delegates call to <code>ancestor</code>
*/
+ @Override
public Component getComponentAfter(final Container container, final Component c) {
if (c == fixedComponent) {
return fixedNextComponent;
@@ -67,6 +63,7 @@
* returns <code>fixedComponent</code> for <code>fixedNextComponent</code> or
* delegates call to <code>ancestor</code>
*/
+ @Override
public Component getComponentBefore(final Container container, final Component c) {
if (c == fixedNextComponent) {
return fixedComponent;
@@ -77,6 +74,7 @@
/**
* delegates call to <code>ancestor</code>
*/
+ @Override
public Component getDefaultComponent(final Container container) {
return ancestor.getDefaultComponent(container);
}
@@ -84,6 +82,7 @@
/**
* delegates call to <code>ancestor</code>
*/
+ @Override
public Component getFirstComponent(final Container container) {
return ancestor.getFirstComponent(container);
}
@@ -91,6 +90,7 @@
/**
* delegates call to <code>ancestor</code>
*/
+ @Override
public Component getLastComponent(final Container container) {
return ancestor.getLastComponent(container);
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BorderFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BorderFactory.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BorderFactory.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BorderFactory.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.awt.Color;
@@ -40,6 +37,7 @@
static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
private BorderFactory() {
+ super();
}
public static TitledBorder createTitledBorder(final Border border, final String title, final int titleJustification, final int titlePosition, final Font titleFont, final Color titleColor) {
@@ -133,6 +131,4 @@
public static Border createEmptyBorder() {
return new EmptyBorder(0, 0, 0, 0);
}
-
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoundedRangeModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoundedRangeModel.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoundedRangeModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoundedRangeModel.java Thu Nov 9 21:15:08 2006
@@ -14,17 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Evgeniya G. Maenkova
- * @version $Revision$
- */
+
package javax.swing;
import javax.swing.event.ChangeListener;
public interface BoundedRangeModel {
-
- void addChangeListener(final ChangeListener x);
+ void addChangeListener(ChangeListener x);
int getExtent();
@@ -36,20 +32,17 @@
boolean getValueIsAdjusting();
- void removeChangeListener(final ChangeListener x);
-
- void setExtent(final int newExtent);
+ void removeChangeListener(ChangeListener x);
- void setMaximum(final int newMaximum);
+ void setExtent(int newExtent);
- void setMinimum(final int newMinimum);
+ void setMaximum(int newMaximum);
- void setRangeProperties(final int value, final int extent, final int min,
- final int max,
- final boolean adjusting);
+ void setMinimum(int newMinimum);
- void setValue(final int newValue);
+ void setRangeProperties(int value, int extent, int min, int max, boolean adjusting);
- void setValueIsAdjusting(final boolean b);
+ void setValue(int newValue);
-}
\ No newline at end of file
+ void setValueIsAdjusting(boolean b);
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Box.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Box.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Box.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/Box.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.awt.AWTError;
@@ -30,26 +27,38 @@
import javax.accessibility.AccessibleRole;
public class Box extends JComponent implements Accessible {
+ private static final long serialVersionUID = 1525417495883046342L;
protected class AccessibleBox extends Container.AccessibleAWTContainer {
+ private static final long serialVersionUID = -7676166747466316885L;
+
protected AccessibleBox() {
+ super();
}
+ @Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.FILLER;
}
};
public static class Filler extends JComponent implements Accessible {
+ private static final long serialVersionUID = -1204263191910183998L;
private Dimension minimumBoxSize;
+
private Dimension preferredBoxSize;
+
private Dimension maximumBoxSize;
protected class AccessibleBoxFiller extends Component.AccessibleAWTComponent {
+ private static final long serialVersionUID = 2256123275413517188L;
+
protected AccessibleBoxFiller() {
+ super();
}
+ @Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.FILLER;
}
@@ -57,62 +66,62 @@
protected AccessibleContext accessibleContext;
- public Filler(final Dimension minimumSize, final Dimension preferredSize,
- final Dimension maximumSize) {
+ public Filler(Dimension minimumSize, Dimension preferredSize, Dimension maximumSize) {
super();
-
minimumBoxSize = minimumSize;
preferredBoxSize = preferredSize;
maximumBoxSize = maximumSize;
}
- public void changeShape(final Dimension minimumSize,
- final Dimension preferredSize,
- final Dimension maximumSize) {
+ public void changeShape(Dimension minimumSize, Dimension preferredSize,
+ Dimension maximumSize) {
minimumBoxSize = minimumSize;
preferredBoxSize = preferredSize;
maximumBoxSize = maximumSize;
-
invalidate();
}
+ @Override
public AccessibleContext getAccessibleContext() {
return (accessibleContext == null) ? (accessibleContext = new AccessibleBoxFiller())
- : accessibleContext;
+ : accessibleContext;
}
+ @Override
public Dimension getPreferredSize() {
return preferredBoxSize;
}
+ @Override
public Dimension getMinimumSize() {
return minimumBoxSize;
}
+ @Override
public Dimension getMaximumSize() {
return maximumBoxSize;
}
-
}
protected AccessibleContext accessibleContext;
- public Box(final int axisType) {
+ public Box(int axisType) {
super.setLayout(new BoxLayout(this, axisType));
}
+ @Override
public AccessibleContext getAccessibleContext() {
return (accessibleContext == null) ? (accessibleContext = new AccessibleBox())
- : accessibleContext;
+ : accessibleContext;
}
- public void setLayout(final LayoutManager layout) {
+ @Override
+ public void setLayout(LayoutManager layout) {
throw new AWTError("Illegal request");
}
- public static Component createRigidArea(final Dimension size) {
- return new Filler(new Dimension(size), new Dimension(size),
- new Dimension(size));
+ public static Component createRigidArea(Dimension size) {
+ return new Filler(new Dimension(size), new Dimension(size), new Dimension(size));
}
public static Box createVerticalBox() {
@@ -123,30 +132,28 @@
return new Box(BoxLayout.X_AXIS);
}
- public static Component createVerticalStrut(final int height) {
- return new Filler(new Dimension(0, height), new Dimension(0, height),
- new Dimension(Short.MAX_VALUE, height));
+ public static Component createVerticalStrut(int height) {
+ return new Filler(new Dimension(0, height), new Dimension(0, height), new Dimension(
+ Short.MAX_VALUE, height));
}
- public static Component createHorizontalStrut(final int width) {
- return new Filler(new Dimension(width, 0), new Dimension(width, 0),
- new Dimension(width, Short.MAX_VALUE));
+ public static Component createHorizontalStrut(int width) {
+ return new Filler(new Dimension(width, 0), new Dimension(width, 0), new Dimension(
+ width, Short.MAX_VALUE));
}
public static Component createVerticalGlue() {
- return new Filler(new Dimension(0, 0), new Dimension(0, 0),
- new Dimension(0, Short.MAX_VALUE));
+ return new Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(0,
+ Short.MAX_VALUE));
}
public static Component createHorizontalGlue() {
- return new Filler(new Dimension(0, 0), new Dimension(0, 0),
- new Dimension(Short.MAX_VALUE, 0));
+ return new Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(
+ Short.MAX_VALUE, 0));
}
public static Component createGlue() {
- return new Filler(new Dimension(0, 0), new Dimension(0, 0),
- new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
+ return new Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(
+ Short.MAX_VALUE, Short.MAX_VALUE));
}
-
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoxLayout.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoxLayout.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoxLayout.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/BoxLayout.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.awt.AWTError;
@@ -28,18 +25,23 @@
import java.io.Serializable;
public class BoxLayout implements LayoutManager2, Serializable {
+ private static final long serialVersionUID = -2474455742719112368L;
public static final int X_AXIS = 0;
+
public static final int Y_AXIS = 1;
+
public static final int LINE_AXIS = 2;
+
public static final int PAGE_AXIS = 3;
private final Container target;
- transient private final LayoutParameters layoutParams;
+
+ private final transient LayoutParameters layoutParams;
public BoxLayout(final Container target, final int axis) {
+ super();
int alignment = axisToAlignment(target, axis);
-
this.target = target;
layoutParams = new LayoutParameters(target, alignment);
}
@@ -51,21 +53,18 @@
public Dimension preferredLayoutSize(final Container target) {
checkTarget(target);
layoutParams.calculateLayoutParameters();
-
return layoutParams.preferredSize;
}
public Dimension minimumLayoutSize(final Container target) {
checkTarget(target);
layoutParams.calculateLayoutParameters();
-
return layoutParams.minimumSize;
}
public Dimension maximumLayoutSize(final Container target) {
checkTarget(target);
layoutParams.calculateLayoutParameters();
-
return layoutParams.maximumSize;
}
@@ -81,14 +80,12 @@
public synchronized float getLayoutAlignmentY(final Container target) {
checkTarget(target);
layoutParams.calculateLayoutParameters();
-
return layoutParams.alignmentY;
}
public synchronized float getLayoutAlignmentX(final Container target) {
checkTarget(target);
layoutParams.calculateLayoutParameters();
-
return layoutParams.alignmentX;
}
@@ -113,13 +110,13 @@
alignment = LayoutParameters.VERTICAL_ALIGNMENT;
} else if (axis == LINE_AXIS) {
if (target != null) {
- alignment = target.getComponentOrientation().isHorizontal() ? LayoutParameters.HORIZONTAL_ALIGNMENT :
- LayoutParameters.VERTICAL_ALIGNMENT;
+ alignment = target.getComponentOrientation().isHorizontal() ? LayoutParameters.HORIZONTAL_ALIGNMENT
+ : LayoutParameters.VERTICAL_ALIGNMENT;
}
- } else if(axis == PAGE_AXIS) {
+ } else if (axis == PAGE_AXIS) {
if (target != null) {
- alignment = target.getComponentOrientation().isHorizontal() ? LayoutParameters.VERTICAL_ALIGNMENT :
- LayoutParameters.HORIZONTAL_ALIGNMENT;
+ alignment = target.getComponentOrientation().isHorizontal() ? LayoutParameters.VERTICAL_ALIGNMENT
+ : LayoutParameters.HORIZONTAL_ALIGNMENT;
}
} else {
throw new AWTError("Invalid axis");
@@ -137,5 +134,4 @@
throw new AWTError("BoxLayout should be used for one container only");
}
}
-
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonGroup.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonGroup.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonGroup.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonGroup.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- */
+
package javax.swing;
import java.io.Serializable;
@@ -25,8 +22,9 @@
import java.util.Vector;
public class ButtonGroup implements Serializable {
+ private static final long serialVersionUID = 4259076101881721375L;
- protected Vector<javax.swing.AbstractButton> buttons = new Vector<javax.swing.AbstractButton>();
+ protected Vector<AbstractButton> buttons = new Vector<AbstractButton>();
private ButtonModel selection;
@@ -90,6 +88,4 @@
prevSelection.setSelected(false);
}
}
-
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonModel.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/ButtonModel.java Thu Nov 9 21:15:08 2006
@@ -14,10 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Sergey Burlak
- * @version $Revision$
- */
+
package javax.swing;
import java.awt.ItemSelectable;
@@ -26,37 +23,45 @@
import javax.swing.event.ChangeListener;
public interface ButtonModel extends ItemSelectable {
+ void addItemListener(ItemListener listener);
- public void addItemListener(final ItemListener listener);
- public void removeItemListener(final ItemListener listener);
+ void removeItemListener(ItemListener listener);
- public void addActionListener(final ActionListener listener);
- public void removeActionListener(final ActionListener listener);
+ void addActionListener(ActionListener listener);
- public void addChangeListener(final ChangeListener listener);
- public void removeChangeListener(final ChangeListener listener);
+ void removeActionListener(ActionListener listener);
- public void setSelected(final boolean selected);
- public boolean isSelected();
+ void addChangeListener(ChangeListener listener);
- public void setRollover(final boolean rollover);
- public boolean isRollover();
+ void removeChangeListener(ChangeListener listener);
- public void setPressed(final boolean pressed);
- public boolean isPressed();
+ void setSelected(boolean selected);
- public void setEnabled(final boolean enabled);
- public boolean isEnabled();
+ boolean isSelected();
- public void setArmed(final boolean armed);
- public boolean isArmed();
+ void setRollover(boolean rollover);
- public void setMnemonic(final int mnemonic);
- public int getMnemonic();
+ boolean isRollover();
- public void setGroup(final ButtonGroup group);
+ void setPressed(boolean pressed);
- public void setActionCommand(final String command);
- public String getActionCommand();
-}
+ boolean isPressed();
+
+ void setEnabled(boolean enabled);
+
+ boolean isEnabled();
+
+ void setArmed(boolean armed);
+
+ boolean isArmed();
+ void setMnemonic(int mnemonic);
+
+ int getMnemonic();
+
+ void setGroup(ButtonGroup group);
+
+ void setActionCommand(String command);
+
+ String getActionCommand();
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/CellEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/CellEditor.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/CellEditor.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/CellEditor.java Thu Nov 9 21:15:08 2006
@@ -14,30 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Sergey Burlak
- * @version $Revision$
- */
+
package javax.swing;
import java.util.EventObject;
import javax.swing.event.CellEditorListener;
public interface CellEditor {
+ void addCellEditorListener(CellEditorListener l);
- public void addCellEditorListener(final CellEditorListener l);
-
- public void cancelCellEditing();
+ void cancelCellEditing();
- public Object getCellEditorValue();
+ Object getCellEditorValue();
- public boolean isCellEditable(final EventObject anEvent);
+ boolean isCellEditable(EventObject anEvent);
- public void removeCellEditorListener(final CellEditorListener l);
+ void removeCellEditorListener(CellEditorListener l);
- public boolean shouldSelectCell(final EventObject anEvent);
-
- public boolean stopCellEditing();
+ boolean shouldSelectCell(EventObject anEvent);
+ boolean stopCellEditing();
}
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JTree.java Thu Nov 9 21:15:08 2006
@@ -77,9 +77,13 @@
import javax.swing.tree.TreeSelectionModel;
public class JTree extends JComponent implements Scrollable, Accessible {
+ private static final long serialVersionUID = -3884445419090632712L;
+
protected class AccessibleJTree extends AccessibleJComponent implements AccessibleSelection, TreeSelectionListener, TreeModelListener, TreeExpansionListener {
+ private static final long serialVersionUID = -8714565563782619758L;
+
protected class AccessibleJTreeNode extends AccessibleContext implements Accessible, AccessibleComponent, AccessibleSelection, AccessibleAction {
- public AccessibleJTreeNode(final JTree t, final TreePath p, final Accessible ap) {
+ public AccessibleJTreeNode(JTree t, TreePath p, Accessible ap) {
throw new UnsupportedOperationException("Not implemented");
}
@@ -87,74 +91,92 @@
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public String getAccessibleName() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public void setAccessibleName(final String s) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public String getAccessibleDescription() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public void setAccessibleDescription(final String s) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleRole getAccessibleRole() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleStateSet getAccessibleStateSet() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public Accessible getAccessibleParent() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public int getAccessibleIndexInParent() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public int getAccessibleChildrenCount() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public Accessible getAccessibleChild(final int i) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public Locale getLocale() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public void addPropertyChangeListener(final PropertyChangeListener l) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public void removePropertyChangeListener(final PropertyChangeListener l) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleAction getAccessibleAction() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleComponent getAccessibleComponent() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleSelection getAccessibleSelection() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleText getAccessibleText() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleValue getAccessibleValue() {
throw new UnsupportedOperationException("Not implemented");
}
@@ -348,26 +370,32 @@
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleRole getAccessibleRole() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public Accessible getAccessibleAt(final Point p) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public int getAccessibleChildrenCount() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public Accessible getAccessibleChild(final int i) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public int getAccessibleIndexInParent() {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public AccessibleSelection getAccessibleSelection() {
throw new UnsupportedOperationException("Not implemented");
}
@@ -402,6 +430,8 @@
}
public static class DynamicUtilTreeNode extends DefaultMutableTreeNode {
+ private static final long serialVersionUID = -2795134038906279615L;
+
protected boolean hasChildren;
protected Object childValue;
protected boolean loadedChildren;
@@ -419,10 +449,12 @@
setAllowsChildren(!loadedChildren);
}
+ @Override
public boolean isLeaf() {
return !getAllowsChildren();
}
+ @Override
public int getChildCount() {
loadChildrenIfRequired();
return super.getChildCount();
@@ -433,11 +465,14 @@
loadChildren(this, childValue);
}
+ @Override
public TreeNode getChildAt(final int index) {
loadChildrenIfRequired();
return super.getChildAt(index);
}
+ @SuppressWarnings("unchecked")
+ @Override
public Enumeration children() {
loadChildrenIfRequired();
return super.children();
@@ -454,18 +489,18 @@
boolean hasChildren = false;
if (nodeChildren instanceof Object[]) {
Object[] children = (Object[])nodeChildren;
- for (int i = 0; i < children.length; i++) {
- node.add(new DynamicUtilTreeNode(children[i], children[i]));
+ for (Object element : children) {
+ node.add(new DynamicUtilTreeNode(element, element));
hasChildren = true;
}
} else if (nodeChildren instanceof Vector) {
- for (Iterator it = ((Vector)nodeChildren).iterator(); it.hasNext(); ) {
+ for (Iterator<?> it = ((Vector)nodeChildren).iterator(); it.hasNext(); ) {
Object child = it.next();
node.add(new DynamicUtilTreeNode(child, child));
hasChildren = true;
}
} else if (nodeChildren instanceof Hashtable) {
- for (Iterator it = ((Hashtable)nodeChildren).keySet().iterator(); it.hasNext(); ) {
+ for (Iterator<?> it = ((Hashtable)nodeChildren).keySet().iterator(); it.hasNext(); ) {
Object child = it.next();
node.add(new DynamicUtilTreeNode(child, child));
hasChildren = true;
@@ -478,18 +513,23 @@
}
protected static class EmptySelectionModel extends DefaultTreeSelectionModel {
+ private static final long serialVersionUID = -2866787372484669512L;
+
protected static final EmptySelectionModel sharedInstance = new EmptySelectionModel();
public static EmptySelectionModel sharedInstance() {
return sharedInstance;
}
+ @Override
public void setSelectionPaths(final TreePath[] pPaths) {
}
+ @Override
public void addSelectionPaths(final TreePath[] paths) {
}
+ @Override
public void removeSelectionPaths(final TreePath[] paths) {
}
}
@@ -508,8 +548,8 @@
if (parentPath == null || children == null) {
return;
}
- for (int i = 0; i < children.length; i++) {
- TreePath childPath = parentPath.pathByAddingChild(children[i]);
+ for (Object element : children) {
+ TreePath childPath = parentPath.pathByAddingChild(element);
removeDescendantToggledPaths(getDescendantToggledPaths(childPath));
}
@@ -530,6 +570,8 @@
}
protected class TreeSelectionRedirector implements Serializable, TreeSelectionListener {
+ private static final long serialVersionUID = -5457497600720267892L;
+
public void valueChanged(final TreeSelectionEvent e) {
fireValueChanged((TreeSelectionEvent)e.cloneWithSource(JTree.this));
}
@@ -573,7 +615,7 @@
private boolean dragEnabled;
private TreePath leadSelectionPath;
private TreePath anchorSelectionPath;
- private Map togglePaths = new HashMap();
+ private final Map<TreePath, Object> togglePaths = new HashMap<TreePath, Object>();
private static final String UI_CLASS_ID = "TreeUI";
@@ -623,10 +665,12 @@
super.setUI(ui);
}
+ @Override
public void updateUI() {
setUI((TreeUI)UIManager.getUI(this));
}
+ @Override
public String getUIClassID() {
return UI_CLASS_ID;
}
@@ -784,6 +828,7 @@
return isEditable();
}
+ @Override
public String getToolTipText(final MouseEvent event) {
if (event == null) {
return null;
@@ -907,20 +952,20 @@
}
public Enumeration<TreePath> getExpandedDescendants(final TreePath parent) {
- final Enumeration toggled = getDescendantToggledPaths(parent);
+ final Enumeration<TreePath> toggled = getDescendantToggledPaths(parent);
if (toggled == null) {
return null;
}
- return new Enumeration() {
+ return new Enumeration<TreePath>() {
private TreePath nextElement = getNextExpandedPath();
- public Object nextElement() {
+ public TreePath nextElement() {
if (nextElement == null) {
throw new NoSuchElementException("No next element in enumeration");
}
- Object currentValue = nextElement;
+ TreePath currentValue = nextElement;
nextElement = getNextExpandedPath();
return currentValue;
}
@@ -931,7 +976,7 @@
private TreePath getNextExpandedPath() {
while (toggled.hasMoreElements()) {
- TreePath nextPath = (TreePath)toggled.nextElement();
+ TreePath nextPath = toggled.nextElement();
if (isExpanded(nextPath)) {
return nextPath;
}
@@ -1129,7 +1174,7 @@
}
public TreeExpansionListener[] getTreeExpansionListeners() {
- return (TreeExpansionListener[])listenerList.getListeners(TreeExpansionListener.class);
+ return listenerList.getListeners(TreeExpansionListener.class);
}
public void addTreeWillExpandListener(final TreeWillExpandListener l) {
@@ -1141,7 +1186,7 @@
}
public TreeWillExpandListener[] getTreeWillExpandListeners() {
- return (TreeWillExpandListener[])listenerList.getListeners(TreeWillExpandListener.class);
+ return listenerList.getListeners(TreeWillExpandListener.class);
}
public void fireTreeExpanded(final TreePath path) {
@@ -1151,8 +1196,8 @@
}
TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- for (int i = 0; i < listeners.length; i++) {
- listeners[i].treeExpanded(event);
+ for (TreeExpansionListener element : listeners) {
+ element.treeExpanded(event);
}
}
@@ -1163,8 +1208,8 @@
}
TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- for (int i = 0; i < listeners.length; i++) {
- listeners[i].treeCollapsed(event);
+ for (TreeExpansionListener element : listeners) {
+ element.treeCollapsed(event);
}
}
@@ -1175,8 +1220,8 @@
}
TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- for (int i = 0; i < listeners.length; i++) {
- listeners[i].treeWillExpand(event);
+ for (TreeWillExpandListener element : listeners) {
+ element.treeWillExpand(event);
}
}
@@ -1187,8 +1232,8 @@
}
TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- for (int i = 0; i < listeners.length; i++) {
- listeners[i].treeWillCollapse(event);
+ for (TreeWillExpandListener element : listeners) {
+ element.treeWillCollapse(event);
}
}
@@ -1205,13 +1250,13 @@
}
public TreeSelectionListener[] getTreeSelectionListeners() {
- return (TreeSelectionListener[])listenerList.getListeners(TreeSelectionListener.class);
+ return listenerList.getListeners(TreeSelectionListener.class);
}
protected void fireValueChanged(final TreeSelectionEvent e) {
TreeSelectionListener[] listeners = getTreeSelectionListeners();
- for (int i = 0; i < listeners.length; i++) {
- listeners[i].valueChanged(e);
+ for (TreeSelectionListener element : listeners) {
+ element.valueChanged(e);
}
}
@@ -1235,7 +1280,7 @@
throw new IllegalArgumentException("Prefix must be specified");
}
if (startingRow < 0 || startingRow >= getRowCount()) {
- throw new IllegalArgumentException("Illegal startingRow is psecified. Must be in the valid range");
+ throw new IllegalArgumentException("Illegal startingRow is specified. Must be in the valid range");
}
if (bias == Position.Bias.Forward) {
int rowCount = getRowCount();
@@ -1298,19 +1343,19 @@
Rectangle pathBounds = getPathBounds(closestPath);
if (direction >= 0) {
return pathBounds.y + pathBounds.height - visibleRect.y;
- } else {
- int increment = visibleRect.y - pathBounds.y;
- if (increment > 0) {
- return increment;
- }
+ }
+
+ int increment = visibleRect.y - pathBounds.y;
+ if (increment > 0) {
+ return increment;
+ }
- int row = getRowForPath(closestPath);
- if (row == 0) {
- return 0;
- }
- pathBounds = getRowBounds(row - 1);
- return pathBounds.height;
+ int row = getRowForPath(closestPath);
+ if (row == 0) {
+ return 0;
}
+ pathBounds = getRowBounds(row - 1);
+ return pathBounds.height;
}
public int getScrollableBlockIncrement(final Rectangle visibleRect,
@@ -1336,6 +1381,7 @@
return parent.getSize().height > getPreferredSize().height;
}
+ @Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJTree();
@@ -1360,11 +1406,11 @@
return null;
}
- final Iterator toggled = (new HashSet(togglePaths.keySet())).iterator();
- return new Enumeration() {
+ final Iterator<TreePath> toggled = (new HashSet<TreePath>(togglePaths.keySet())).iterator();
+ return new Enumeration<TreePath>() {
private TreePath nextElement = getNextDescendPath();
- public Object nextElement() {
+ public TreePath nextElement() {
if (nextElement == null) {
throw new NoSuchElementException("No next element in enumeration");
}
@@ -1380,7 +1426,7 @@
private TreePath getNextDescendPath() {
while (toggled.hasNext()) {
- TreePath nextPath = (TreePath)toggled.next();
+ TreePath nextPath = toggled.next();
if (parent.isDescendant(nextPath)) {
return nextPath;
}
@@ -1418,9 +1464,8 @@
return false;
}
- List toRemove = new LinkedList();
- for (int i = 0; i < selectedPaths.length; i++) {
- TreePath selectedPath = selectedPaths[i];
+ List<TreePath> toRemove = new LinkedList<TreePath>();
+ for (TreePath selectedPath : selectedPaths) {
if (path.isDescendant(selectedPath)
&& (includePath || !path.equals(selectedPath))) {
@@ -1431,7 +1476,7 @@
return false;
}
- removeSelectionPaths((TreePath[])toRemove.toArray(new TreePath[toRemove.size()]));
+ removeSelectionPaths(toRemove.toArray(new TreePath[toRemove.size()]));
return true;
}
@@ -1518,15 +1563,14 @@
return new TreePath[0];
}
- List paths = new ArrayList();
- for (int i = 0; i < rows.length; i++) {
- int row = rows[i];
+ List<TreePath> paths = new ArrayList<TreePath>();
+ for (int row : rows) {
TreePath path = getPathForRow(row);
if (path != null) {
paths.add(path);
}
}
- return (TreePath[])paths.toArray(new TreePath[paths.size()]);
+ return paths.toArray(new TreePath[paths.size()]);
}
private boolean pathMatches(final String prefix, final TreePath path, final int row) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JViewport.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JViewport.java?view=diff&rev=473193&r1=473192&r2=473193
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JViewport.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/JViewport.java Thu Nov 9 21:15:08 2006
@@ -48,8 +48,11 @@
public class JViewport extends JComponent implements Accessible {
-
+ private static final long serialVersionUID = -633250949788872287L;
+
protected class ViewListener extends ComponentAdapter implements Serializable {
+ private static final long serialVersionUID = 6947347842254105360L;
+
@Override
public void componentResized(final ComponentEvent e) {
fireStateChanged();
@@ -58,6 +61,8 @@
}
protected class AccessibleJViewport extends AccessibleJComponent {
+ private static final long serialVersionUID = 481322936279100213L;
+
@Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.VIEWPORT;