/**
* List of the string identifiers for the available properties.
*/
- public static Collection FILE_PROPERTIES;
+ public static Collection<String> FILE_PROPERTIES;
private final static Method FILEITEM_LASTMODIFIED;
static {
- FILE_PROPERTIES = new ArrayList();
+ FILE_PROPERTIES = new ArrayList<String>();
FILE_PROPERTIES.add(PROPERTY_NAME);
FILE_PROPERTIES.add(PROPERTY_ICON);
FILE_PROPERTIES.add(PROPERTY_SIZE);
* add a JavaDoc comment here, we use the default documentation from
* implemented interface.
*/
- public Collection getChildren(Object itemId) {
+ public Collection<File> getChildren(Object itemId) {
if (!(itemId instanceof File)) {
- return Collections.unmodifiableCollection(new LinkedList());
+ return Collections.unmodifiableCollection(new LinkedList<File>());
}
File[] f;
if (filter != null) {
}
if (f == null) {
- return Collections.unmodifiableCollection(new LinkedList());
+ return Collections.unmodifiableCollection(new LinkedList<File>());
}
- final List l = Arrays.asList(f);
+ final List<File> l = Arrays.asList(f);
Collections.sort(l);
return Collections.unmodifiableCollection(l);
* comment here, we use the default documentation from implemented
* interface.
*/
- public Collection rootItemIds() {
+ public Collection<File> rootItemIds() {
File[] f;
}
if (f == null) {
- return Collections.unmodifiableCollection(new LinkedList());
+ return Collections.unmodifiableCollection(new LinkedList<File>());
}
- final List l = Arrays.asList(f);
+ final List<File> l = Arrays.asList(f);
Collections.sort(l);
return Collections.unmodifiableCollection(l);
* @param f
* the root file where to start adding files
*/
- private void addItemIds(Collection col, File f) {
+ private void addItemIds(Collection<File> col, File f) {
File[] l;
if (filter != null) {
l = f.listFiles(filter);
} else {
l = f.listFiles();
}
- final List ll = Arrays.asList(l);
+ final List<File> ll = Arrays.asList(l);
Collections.sort(ll);
- for (final Iterator i = ll.iterator(); i.hasNext();) {
- final File lf = (File) i.next();
+ for (final Iterator<File> i = ll.iterator(); i.hasNext();) {
+ final File lf = i.next();
if (lf.isDirectory()) {
addItemIds(col, lf);
} else {
* Gets the IDs of Items in the filesystem. Don't add a JavaDoc comment
* here, we use the default documentation from implemented interface.
*/
- public Collection getItemIds() {
+ public Collection<File> getItemIds() {
if (recursive) {
- final Collection col = new ArrayList();
+ final Collection<File> col = new ArrayList<File>();
for (int i = 0; i < roots.length; i++) {
addItemIds(col, roots[i]);
}
}
if (f == null) {
- return Collections.unmodifiableCollection(new LinkedList());
+ return Collections
+ .unmodifiableCollection(new LinkedList<File>());
}
- final List l = Arrays.asList(f);
+ final List<File> l = Arrays.asList(f);
Collections.sort(l);
return Collections.unmodifiableCollection(l);
}
*
* @return Unmodifiable collection containing all available file properties.
*/
- public Collection getContainerPropertyIds() {
+ public Collection<String> getContainerPropertyIds() {
return FILE_PROPERTIES;
}
* the ID of the property whose type is requested.
* @return data type of the requested property, or <code>null</code>
*/
- public Class getType(Object propertyId) {
+ public Class<?> getType(Object propertyId) {
if (propertyId.equals(PROPERTY_NAME)) {
return String.class;
* JavaDoc comment here, we use the default documentation from
* implemented interface.
*/
- public Collection getItemPropertyIds() {
+ public Collection<String> getItemPropertyIds() {
return getContainerPropertyIds();
}
/**
* Linked list of ordered Property IDs.
*/
- private ArrayList propertyIds = new ArrayList();
+ private ArrayList<Object> propertyIds = new ArrayList<Object>();
/**
* Property ID to type mapping.
/**
* Array of all the errors.
*/
- private final List errors;
+ private final List<ErrorMessage> errors;
/**
* Level of the error.
* ignored, but at least one message is required.
*/
public CompositeErrorMessage(ErrorMessage[] errorMessages) {
- errors = new ArrayList(errorMessages.length);
+ errors = new ArrayList<ErrorMessage>(errorMessages.length);
level = Integer.MIN_VALUE;
for (int i = 0; i < errorMessages.length; i++) {
* the Collection of error messages that are listed togeter. At
* least one message is required.
*/
- public CompositeErrorMessage(Collection errorMessages) {
- errors = new ArrayList(errorMessages.size());
+ public CompositeErrorMessage(Collection<ErrorMessage> errorMessages) {
+ errors = new ArrayList<ErrorMessage>(errorMessages.size());
level = Integer.MIN_VALUE;
- for (final Iterator i = errorMessages.iterator(); i.hasNext();) {
- addErrorMessage((ErrorMessage) i.next());
+ for (final Iterator<ErrorMessage> i = errorMessages.iterator(); i
+ .hasNext();) {
+ addErrorMessage(i.next());
}
if (errors.size() == 0) {
*
* @return the error iterator.
*/
- public Iterator iterator() {
+ public Iterator<ErrorMessage> iterator() {
return errors.iterator();
}
public void paint(PaintTarget target) throws PaintException {
if (errors.size() == 1) {
- ((ErrorMessage) errors.iterator().next()).paint(target);
+ (errors.iterator().next()).paint(target);
} else {
target.startTag("error");
}
// Paint all the exceptions
- for (final Iterator i = errors.iterator(); i.hasNext();) {
- ((ErrorMessage) i.next()).paint(target);
+ for (final Iterator<ErrorMessage> i = errors.iterator(); i
+ .hasNext();) {
+ i.next().paint(target);
}
target.endTag("error");
public String toString() {
String retval = "[";
int pos = 0;
- for (final Iterator i = errors.iterator(); i.hasNext();) {
+ for (final Iterator<ErrorMessage> i = errors.iterator(); i.hasNext();) {
if (pos > 0) {
retval += ",";
}
/**
* List of repaint request listeners or null if not listened at all.
*/
- private LinkedList repaintRequestListeners = null;
+ private LinkedList<RepaintRequestListener> repaintRequestListeners = null;
/**
* Are all the repaint listeners notified about recent changes ?
}
/* Documentation copied from interface */
- public void childRequestedRepaint(Collection alreadyNotified) {
+ public void childRequestedRepaint(
+ Collection<RepaintRequestListener> alreadyNotified) {
// Invisible components (by flag in this particular component) do not
// need repaints
if (!visible) {
*
* @param alreadyNotified
*/
- private void fireRequestRepaintEvent(Collection alreadyNotified) {
+ private void fireRequestRepaintEvent(
+ Collection<RepaintRequestListener> alreadyNotified) {
// Notify listeners only once
if (!repaintRequestListenersNotified) {
// Notify the listeners
final RepaintRequestEvent event = new RepaintRequestEvent(this);
for (int i = 0; i < listeners.length; i++) {
if (alreadyNotified == null) {
- alreadyNotified = new LinkedList();
+ alreadyNotified = new LinkedList<RepaintRequestListener>();
}
if (!alreadyNotified.contains(listeners[i])) {
((RepaintRequestListener) listeners[i])
.repaintRequested(event);
- alreadyNotified.add(listeners[i]);
+ alreadyNotified
+ .add((RepaintRequestListener) listeners[i]);
repaintRequestListenersNotified = true;
}
}
/* Documentation copied from interface */
public void addListener(RepaintRequestListener listener) {
if (repaintRequestListeners == null) {
- repaintRequestListeners = new LinkedList();
+ repaintRequestListeners = new LinkedList<RepaintRequestListener>();
}
if (!repaintRequestListeners.contains(listener)) {
repaintRequestListeners.add(listener);
* and pass it forwards. Null parameter is interpreted as empty
* collection.
*/
- public void childRequestedRepaint(Collection alreadyNotified);
+ public void childRequestedRepaint(
+ Collection<RepaintRequestListener> alreadyNotified);
/* Component event framework */
/**
* Superclass of all component originated <code>Event</code>s.
*/
+ @SuppressWarnings("serial")
public class Event extends EventObject {
/**
* @author IT Mill Ltd.
*
*/
+@SuppressWarnings("unchecked")
public class BasicRandomTest extends com.vaadin.Application implements
Button.ClickListener {
* ErrorEvents are printed to default error stream and not in GUI.
*/
@Override
- public void terminalError(
- com.vaadin.terminal.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) {
final Throwable e = event.getThrowable();
System.err.println(getUser().toString() + " terminalError: "
+ e.toString());