package com.vaadin.terminal;
import java.io.InputStream;
+import java.io.Serializable;
import com.vaadin.Application;
import com.vaadin.service.FileTypeResolver;
* @VERSION@
* @since 3.0
*/
- public interface StreamSource {
+ public interface StreamSource extends Serializable {
/**
* Returns new input stream that is used for reading the resource.
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
* computer if appropriate HTML 5 features are supported on client side.
* This class wraps information about dragged file on server side.
*/
- public class Html5File {
+ public class Html5File implements Serializable {
public String name;
private int size;
}
}
+ /**
+ * Iterator for the visible components (zero or one components), used by
+ * {@link PopupView#getComponentIterator()}.
+ */
+ private static class SingleComponentIterator implements
+ Iterator<Component>,
+ Serializable {
+
+ private final Component component;
+ private boolean first;
+
+ public SingleComponentIterator(Component component) {
+ this.component = component;
+ first = (component == null);
+ }
+
+ public boolean hasNext() {
+ return !first;
+ }
+
+ public Component next() {
+ if (!first) {
+ first = true;
+ return component;
+ } else {
+ return null;
+ }
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
/* Constructors */
/**
* @see com.vaadin.ui.ComponentContainer#getComponentIterator()
*/
public Iterator<Component> getComponentIterator() {
- return new Iterator<Component>() {
-
- private boolean first = visibleComponent == null;
-
- public boolean hasNext() {
- return !first;
- }
-
- public Component next() {
- if (!first) {
- first = true;
- return visibleComponent;
- } else {
- return null;
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
-
+ return new SingleComponentIterator(visibleComponent);
}
/**
package com.vaadin.ui;
+import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Map;
private static final String SPLITTER_CLICK_EVENT = VSplitPanel.SPLITTER_CLICK_EVENT_IDENTIFIER;
+ /**
+ * Modifiable and Serializable Iterator for the components, used by
+ * {@link SplitPanel#getComponentIterator()}.
+ */
+ private class ComponentIterator implements Iterator<Component>,
+ Serializable {
+
+ int i = 0;
+
+ public boolean hasNext() {
+ if (i < (firstComponent == null ? 0 : 1)
+ + (secondComponent == null ? 0 : 1)) {
+ return true;
+ }
+ return false;
+ }
+
+ public Component next() {
+ if (!hasNext()) {
+ return null;
+ }
+ i++;
+ if (i == 1) {
+ return firstComponent == null ? secondComponent
+ : firstComponent;
+ } else if (i == 2) {
+ return secondComponent;
+ }
+ return null;
+ }
+
+ public void remove() {
+ if (i == 1) {
+ if (firstComponent != null) {
+ setFirstComponent(null);
+ i = 0;
+ } else {
+ setSecondComponent(null);
+ }
+ } else if (i == 2) {
+ setSecondComponent(null);
+ }
+ }
+ }
+
/**
* Creates a new split panel. The orientation of the panels is
* <code>ORIENTATION_VERTICAL</code>.
}
/**
- * Gets the component container iterator for going trough all the components
- * in the container.
+ * Gets the component container iterator for going through all the
+ * components in the container.
*
* @return the Iterator of the components inside the container.
*/
public Iterator<Component> getComponentIterator() {
- return new Iterator<Component>() {
- int i = 0;
-
- public boolean hasNext() {
- if (i < (firstComponent == null ? 0 : 1)
- + (secondComponent == null ? 0 : 1)) {
- return true;
- }
- return false;
- }
-
- public Component next() {
- if (!hasNext()) {
- return null;
- }
- i++;
- if (i == 1) {
- return firstComponent == null ? secondComponent
- : firstComponent;
- } else if (i == 2) {
- return secondComponent;
- }
- return null;
- }
-
- public void remove() {
- if (i == 1) {
- if (firstComponent != null) {
- setFirstComponent(null);
- i = 0;
- } else {
- setSecondComponent(null);
- }
- } else if (i == 2) {
- setSecondComponent(null);
- }
- }
- };
+ return new ComponentIterator();
}
/**
/**
* Interface for listening to column resize events.
*/
- public interface ColumnResizeListener {
+ public interface ColumnResizeListener extends Serializable {
/**
* This method is triggered when the column has been resized