return components.iterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components
+ */
+ public int getComponentCount() {
+ return components.size();
+ }
+
/**
* Replaces one component with another one. The new component inherits the
* old components position.
return components.iterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components
+ */
+ public int getComponentCount() {
+ return components.size();
+ }
+
/**
* Paints the content of this component.
*
return components.iterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components
+ */
+ public int getComponentCount() {
+ return components.size();
+ }
+
/**
* Paints the content of this component.
*
return new ComponentIterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components (zero or one)
+ */
+ public int getComponentCount() {
+ return (root != null ? 1 : 0);
+ }
+
/**
* This method is not supported by CustomComponent.
*
return slots.values().iterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components
+ */
+ public int getComponentCount() {
+ return slots.values().size();
+ }
+
/**
* Gets the child-component by its location.
*
return Collections.unmodifiableCollection(components).iterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components
+ */
+ public int getComponentCount() {
+ return components.size();
+ }
+
/**
* Paints the contents of this component.
*
}
/**
- * 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.
* @see com.vaadin.ui.ComponentContainer#getComponentIterator()
return new SingleComponentIterator(visibleComponent);
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components (zero or one)
+ */
+ public int getComponentCount() {
+ return (visibleComponent != null ? 1 : 0);
+ }
+
/**
* Not supported in this implementation.
*
int i = 0;
public boolean hasNext() {
- if (i < (firstComponent == null ? 0 : 1)
- + (secondComponent == null ? 0 : 1)) {
+ if (i < getComponentCount()) {
return true;
}
return false;
return new ComponentIterator();
}
+ /**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components (zero, one or two)
+ */
+ public int getComponentCount() {
+ int count = 0;
+ if (firstComponent != null) {
+ count++;
+ }
+ if (secondComponent != null) {
+ count++;
+ }
+ return count;
+ }
+
/**
* Paints the content of this component.
*
return Collections.unmodifiableList(components).iterator();
}
+ /**
+ * Gets the number of contained components (tabs). Consistent with the
+ * iterator returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components
+ */
+ public int getComponentCount() {
+ return components.size();
+ }
+
/**
* Removes a component and its corresponding tab.
*