*/
private static boolean formHasNonRelativeWidthComponent(Component form) {
HasComponents parent = (HasComponents) form;
- for (Iterator<Component> iterator = parent.iterator(); iterator
- .hasNext();) {
- if (!hasRelativeWidth(iterator.next())) {
+ for (Component aParent : parent) {
+ if (!hasRelativeWidth(aParent)) {
return true;
}
}
super(null);
setErrorLevel(ErrorLevel.INFORMATION);
- for (final Iterator<? extends ErrorMessage> i = errorMessages
- .iterator(); i.hasNext();) {
- addErrorMessage(i.next());
+ for (ErrorMessage errorMessage : errorMessages) {
+ addErrorMessage(errorMessage);
}
if (getCauses().isEmpty()) {
public String toString() {
String retval = "[";
int pos = 0;
- for (final Iterator<ErrorMessage> i = getCauses().iterator(); i
- .hasNext();) {
+ for (ErrorMessage errorMessage : getCauses()) {
if (pos > 0) {
retval += ",";
}
pos++;
- retval += i.next().toString();
+ retval += errorMessage.toString();
}
retval += "]";
public void paintContent(PaintTarget target) throws PaintException {
if (!openList.isEmpty()) {
- for (final Iterator<OpenResource> i = openList.iterator(); i
- .hasNext();) {
- (i.next()).paintContent(target);
+ for (OpenResource anOpenList : openList) {
+ (anOpenList).paintContent(target);
}
openList.clear();
}
// Paint notifications
if (notifications != null) {
target.startTag("notifications");
- for (final Iterator<Notification> it = notifications.iterator(); it
- .hasNext();) {
- final Notification n = it.next();
+ for (final Notification n : notifications) {
target.startTag("notification");
if (n.getCaption() != null) {
target.addAttribute(
public static String stripSpecialChars(String themeName) {
StringBuilder sb = new StringBuilder();
char[] charArray = themeName.toCharArray();
- for (int i = 0; i < charArray.length; i++) {
- char c = charArray[i];
+ for (char c : charArray) {
if (!CHAR_BLACKLIST.contains(c)) {
sb.append(c);
}
}
StringBuilder safe = new StringBuilder();
char[] charArray = unsafe.toCharArray();
- for (int i = 0; i < charArray.length; i++) {
- char c = charArray[i];
+ for (char c : charArray) {
if (isSafe(c)) {
safe.append(c);
} else {
import java.io.InputStreamReader;
import java.io.Serializable;
import java.io.Writer;
-import java.util.Iterator;
+import java.nio.charset.StandardCharsets;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.UI;
-import java.nio.charset.StandardCharsets;
/**
* Serializes resources to JSON. Currently only used for {@link CustomLayout}
writer.write("{");
int resourceIndex = 0;
- for (final Iterator<Object> i = target.getUsedResources().iterator(); i
- .hasNext();) {
- final String resource = (String) i.next();
+ for (Object o : target.getUsedResources()) {
+ final String resource = (String) o;
InputStream is = null;
try {
is = ui.getSession().getService().getThemeResourceAsStream(ui,
final StringBuffer layout = new StringBuffer();
try (InputStreamReader r = new InputStreamReader(is,
- StandardCharsets.UTF_8)) {
+ StandardCharsets.UTF_8)) {
final char[] buffer = new char[20000];
int charsRead = 0;
while ((charsRead = r.read(buffer)) > 0) {
layout.append(buffer, 0, charsRead);
}
- } catch (final java.io.IOException e) {
+ } catch (final IOException e) {
// FIXME: Handle exception
getLogger().log(Level.INFO, "Resource transfer failed", e);
}
}
}
- for (int i = 0; i < invocations.size(); i++) {
- MethodInvocation invocation = invocations.get(i);
-
+ for (MethodInvocation invocation : invocations) {
final ClientConnector connector = connectorTracker
.getConnector(invocation.getConnectorId());
if (connector == null) {
getLogger().log(Level.WARNING,
"Received RPC call for unknown connector with id {0} (tried to invoke {1}.{2})",
- new Object[] { invocation.getConnectorId(),
+ new Object[]{invocation.getConnectorId(),
invocation.getInterfaceName(),
- invocation.getMethodName() });
+ invocation.getMethodName()});
continue;
}
}
// Removes all component
- for (final Iterator<Component> i = l.iterator(); i.hasNext();) {
- removeComponent(i.next());
+ for (Component aL : l) {
+ removeComponent(aL);
}
}
components.add(i.next());
}
- for (final Iterator<Component> i = components.iterator(); i
- .hasNext();) {
- final Component c = i.next();
+ for (final Component c : components) {
source.removeComponent(c);
addComponent(c);
}
int oldLocation = -1;
int newLocation = -1;
int location = 0;
- for (final Iterator<Component> i = components.iterator(); i
- .hasNext();) {
- final Component component = i.next();
-
+ for (final Component component : components) {
if (component == oldComponent) {
oldLocation = location;
}
int oldLocation = -1;
int newLocation = -1;
int location = 0;
- for (final Iterator<Component> i = components.iterator(); i
- .hasNext();) {
- final Component component = i.next();
-
+ for (final Component component : components) {
if (component == oldComponent) {
oldLocation = location;
}
// Gets the locations
String oldLocation = null;
String newLocation = null;
- for (final Iterator<String> i = slots.keySet().iterator(); i
- .hasNext();) {
- final String location = i.next();
+ for (final String location : slots.keySet()) {
final Component component = slots.get(location);
if (component == oldComponent) {
oldLocation = location;
public void removeComponent(int column, int row) {
// Finds the area
- for (final Iterator<Component> i = components.iterator(); i
- .hasNext();) {
- final Component component = i.next();
+ for (final Component component : components) {
final ChildComponentData childData = getState().childData
.get(component);
if (childData.column1 == column && childData.row1 == row) {
private float getExpandRatioSum(Map<Integer, Float> ratioMap) {
float sum = 0;
- for (Iterator<Entry<Integer, Float>> iterator = ratioMap.entrySet()
- .iterator(); iterator.hasNext();) {
- sum += iterator.next().getValue();
+ for (Float expandRatio : ratioMap.values()) {
+ sum += expandRatio;
}
return sum;
}
int newLocation = -1;
int location = 0;
- for (final Iterator<Component> i = components.iterator(); i
- .hasNext();) {
- final Component component = i.next();
-
+ for (final Component component : components) {
if (component == oldComponent) {
oldLocation = location;
}
*/
@Deprecated
public void removeCloseShortcut() {
- for (int i = 0; i < closeShortcuts.size(); ++i) {
- CloseShortcut sc = closeShortcuts.get(i);
+ for (CloseShortcut sc : closeShortcuts) {
removeAction(sc);
}
closeShortcuts.clear();