import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
+import java.util.ArrayDeque;
+import java.util.Deque;
@SuppressWarnings({ "serial", "deprecation" })
public class ComponentSizeValidator implements Serializable {
* Comparability form component which is defined in the different jar.
*
* TODO : Normally this logic shouldn't be here. But it means that the whole
- * this class has wrong design and impementation and should be refactored.
+ * this class has wrong design and implementation and should be refactored.
*/
private static boolean isForm(Component component) {
if (!(component instanceof HasComponents)) {
}
private static void printServerError(String msg,
- Stack<ComponentInfo> attributes, boolean widthError,
+ Deque<ComponentInfo> attributes, boolean widthError,
PrintStream errorStream) {
StringBuffer err = new StringBuffer();
err.append("Vaadin DEBUG\n");
while (attributes.size() > LAYERS_SHOWN) {
attributes.pop();
}
- while (!attributes.empty()) {
+ while (!attributes.isEmpty()) {
ci = attributes.pop();
showComponent(ci.component, ci.info, err, indent, widthError);
}
clientJSON.append("\"id\":\"").append(paintableId).append("\"");
if (invalidHeight) {
- Stack<ComponentInfo> attributes = null;
+ Deque<ComponentInfo> attributes = null;
String msg = "";
// set proper error messages
if (parent instanceof AbstractOrderedLayout) {
clientJSON.append(",\"heightMsg\":\"").append(msg).append("\"");
}
if (invalidWidth) {
- Stack<ComponentInfo> attributes = null;
+ Deque<ComponentInfo> attributes = null;
String msg = "";
if (parent instanceof AbstractOrderedLayout) {
AbstractOrderedLayout ol = (AbstractOrderedLayout) parent;
}
- private static Stack<ComponentInfo> getHeightAttributes(
+ private static Deque<ComponentInfo> getHeightAttributes(
Component component) {
- Stack<ComponentInfo> attributes = new Stack<>();
+ Deque<ComponentInfo> attributes = new ArrayDeque<>();
attributes
.add(new ComponentInfo(component, getHeightString(component)));
Component parent = component.getParent();
return attributes;
}
- private static Stack<ComponentInfo> getWidthAttributes(
+ private static Deque<ComponentInfo> getWidthAttributes(
Component component) {
- Stack<ComponentInfo> attributes = new Stack<>();
+ final Deque<ComponentInfo> attributes = new ArrayDeque<>();
attributes.add(new ComponentInfo(component, getWidthString(component)));
Component parent = component.getParent();
attributes.add(new ComponentInfo(parent, getWidthString(parent)));
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomLayout;
+import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.Deque;
import java.util.List;
/**
private final static String UIDL_ARG_NAME = "name";
- private final Stack<String> mOpenTags;
+ private final Deque<String> mOpenTags;
- private final Stack<JsonTag> openJsonTags;
+ private final Deque<JsonTag> openJsonTags;
// these match each other element-wise
- private final Stack<ClientConnector> openPaintables;
- private final Stack<String> openPaintableTags;
+ private final Deque<ClientConnector> openPaintables;
+ private final Deque<String> openPaintableTags;
private final PrintWriter uidlBuffer;
uidlBuffer = new PrintWriter(outWriter);
// Initialize tag-writing
- mOpenTags = new Stack<>();
- openJsonTags = new Stack<>();
+ mOpenTags = new ArrayDeque<>();
+ openJsonTags = new ArrayDeque<>();
- openPaintables = new Stack<>();
- openPaintableTags = new Stack<>();
+ openPaintables = new ArrayDeque<>();
+ openPaintableTags = new ArrayDeque<>();
cacheEnabled = cachingRequired;
}
* If the parent tag is closed before every child tag is closed an
* PaintException is raised.
*
- * @param tag
+ * @param tagName
* the name of the end tag.
* @throws PaintException
* if the paint operation failed.
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Stack;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
import com.vaadin.ui.Component.Focusable;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
+import java.util.ArrayDeque;
+import java.util.Deque;
/**
* <p>
return (MenuBarState) super.getState(markAsDirty);
}
- /** Paint (serialise) the component for the client. */
+ /** Paint (serialize) the component for the client. */
@Override
public void paintContent(PaintTarget target) throws PaintException {
target.addAttribute(MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER,
target.endTag("item");
}
- /** Deserialize changes received from client. */
+ /** De-serialize changes received from client. */
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
- Stack<MenuItem> items = new Stack<>();
+ final Deque<MenuItem> items = new ArrayDeque<>();
boolean found = false;
if (variables.containsKey("clickedId")) {
MenuItem tmpItem = null;
// Go through all the items in the menu
- while (!found && !items.empty()) {
+ while (!found && !items.isEmpty()) {
tmpItem = items.pop();
- found = (clickedId.intValue() == tmpItem.getId());
+ found = (clickedId == tmpItem.getId());
if (tmpItem.hasChildren()) {
itr = tmpItem.getChildren().iterator();