* from the server. | * from the server. | ||||
* <p> | * <p> | ||||
* UIDL is hierarchical, and there are a few methods to retrieve the children, | * UIDL is hierarchical, and there are a few methods to retrieve the children, | ||||
* {@link #getChildCount()}, {@link #getChildIterator()} | |||||
* {@link #getChildString(int)}, {@link #getChildUIDL(int)}. | |||||
* {@link #getChildCount()}, {@link #iterator()} {@link #getChildString(int)}, | |||||
* {@link #getChildUIDL(int)}. | |||||
* </p> | * </p> | ||||
* <p> | * <p> | ||||
* It can be helpful to keep in mind that UIDL was originally modeled in XML, so | * It can be helpful to keep in mind that UIDL was originally modeled in XML, so | ||||
* but will be skipped by the methods mentioned above. | * but will be skipped by the methods mentioned above. | ||||
* </p> | * </p> | ||||
*/ | */ | ||||
public final class UIDL extends JavaScriptObject { | |||||
public final class UIDL extends JavaScriptObject implements Iterable<Object> { | |||||
protected UIDL() { | protected UIDL() { | ||||
} | } | ||||
* Gets the name of this UIDL section, as created with | * Gets the name of this UIDL section, as created with | ||||
* {@link PaintTarget#startTag(String) PaintTarget.startTag()} in the | * {@link PaintTarget#startTag(String) PaintTarget.startTag()} in the | ||||
* server-side {@link Component#paint(PaintTarget) Component.paint()} or | * server-side {@link Component#paint(PaintTarget) Component.paint()} or | ||||
* (usually) {@link com.vaadin.ui.AbstractComponent#paintContent(PaintTarget) | |||||
* (usually) | |||||
* {@link com.vaadin.ui.AbstractComponent#paintContent(PaintTarget) | |||||
* AbstractComponent.paintContent()}. Note that if the UIDL corresponds to a | * AbstractComponent.paintContent()}. Note that if the UIDL corresponds to a | ||||
* Paintable, a component identifier will be returned instead - this is used | * Paintable, a component identifier will be returned instead - this is used | ||||
* internally and is not needed within | * internally and is not needed within | ||||
* </p> | * </p> | ||||
* | * | ||||
* @return an iterator for iterating over UIDL children | * @return an iterator for iterating over UIDL children | ||||
* @deprecated As of 8.2, please use {@link #iterator()} instead | |||||
*/ | */ | ||||
@Deprecated | |||||
public Iterator<Object> getChildIterator() { | public Iterator<Object> getChildIterator() { | ||||
return iterator(); | |||||
} | |||||
/** | |||||
* Gets an iterator that can be used to iterate trough the children of this | |||||
* UIDL. | |||||
* <p> | |||||
* The Object returned by <code>next()</code> will be appropriately typed - | |||||
* if it's UIDL, {@link #getTag()} can be used to check which section is in | |||||
* question. | |||||
* </p> | |||||
* <p> | |||||
* The basic use case is to iterate over the children of an UIDL update, and | |||||
* update the appropriate part of the widget for each child encountered, e.g | |||||
* if <code>getTag()</code> returns "color", one would update the widgets | |||||
* color to reflect the value of the "color" section. | |||||
* </p> | |||||
* | |||||
* @return an iterator for iterating over UIDL children | |||||
* @since | |||||
*/ | |||||
@Override | |||||
public Iterator<Object> iterator() { | |||||
return new Iterator<Object>() { | return new Iterator<Object>() { | ||||
* @return the child UIDL or null if child wit given name was not found | * @return the child UIDL or null if child wit given name was not found | ||||
*/ | */ | ||||
public UIDL getChildByTagName(String tagName) { | public UIDL getChildByTagName(String tagName) { | ||||
Iterator<Object> childIterator = getChildIterator(); | |||||
while (childIterator.hasNext()) { | |||||
Object next = childIterator.next(); | |||||
for (Object next : this) { | |||||
if (next instanceof UIDL) { | if (next instanceof UIDL) { | ||||
UIDL childUIDL = (UIDL) next; | UIDL childUIDL = (UIDL) next; | ||||
if (childUIDL.getTag().equals(tagName)) { | if (childUIDL.getTag().equals(tagName)) { |
*/ | */ | ||||
package com.vaadin.client; | package com.vaadin.client; | ||||
import java.util.Iterator; | |||||
import java.util.Set; | import java.util.Set; | ||||
import com.google.gwt.core.client.JsArray; | import com.google.gwt.core.client.JsArray; | ||||
// Ignored, no variables | // Ignored, no variables | ||||
} | } | ||||
final Iterator<Object> i = uidl.getChildIterator(); | |||||
while (i.hasNext()) { | |||||
final Object child = i.next(); | |||||
for (final Object child : uidl) { | |||||
try { | try { | ||||
add(new UIDLItem((UIDL) child)); | add(new UIDLItem((UIDL) child)); | ||||
} catch (final Exception e) { | } catch (final Exception e) { |
*/ | */ | ||||
public void updateActionMap(UIDL c) { | public void updateActionMap(UIDL c) { | ||||
actions.clear(); | actions.clear(); | ||||
final Iterator<?> it = c.getChildIterator(); | |||||
while (it.hasNext()) { | |||||
final UIDL action = (UIDL) it.next(); | |||||
for (final Object child : c) { | |||||
final UIDL action = (UIDL) child; | |||||
int[] modifiers = null; | int[] modifiers = null; | ||||
if (action.hasAttribute("mk")) { | if (action.hasAttribute("mk")) { |
package com.vaadin.client.ui; | package com.vaadin.client.ui; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Iterator; | |||||
import java.util.Map; | import java.util.Map; | ||||
import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.Element; | ||||
public static Map<String, String> getParameters(UIDL uidl) { | public static Map<String, String> getParameters(UIDL uidl) { | ||||
Map<String, String> parameters = new HashMap<>(); | Map<String, String> parameters = new HashMap<>(); | ||||
Iterator<Object> childIterator = uidl.getChildIterator(); | |||||
while (childIterator.hasNext()) { | |||||
Object child = childIterator.next(); | |||||
for (Object child : uidl) { | |||||
if (child instanceof UIDL) { | if (child instanceof UIDL) { | ||||
UIDL childUIDL = (UIDL) child; | UIDL childUIDL = (UIDL) child; |
* contained in given uidl node | * contained in given uidl node | ||||
*/ | */ | ||||
if (!uidl.getTag().equals("-ac")) { | if (!uidl.getTag().equals("-ac")) { | ||||
Iterator<Object> childIterator = uidl.getChildIterator(); | |||||
Iterator<Object> childIterator = uidl.iterator(); | |||||
while (!uidl.getTag().equals("-ac") && childIterator.hasNext()) { | while (!uidl.getTag().equals("-ac") && childIterator.hasNext()) { | ||||
uidl = (UIDL) childIterator.next(); | uidl = (UIDL) childIterator.next(); | ||||
} | } |
} | } | ||||
UIDL uidlItems = uidl.getChildUIDL(1); | UIDL uidlItems = uidl.getChildUIDL(1); | ||||
Iterator<Object> itr = uidlItems.getChildIterator(); | |||||
Iterator<Object> itr = uidlItems.iterator(); | |||||
Stack<Iterator<Object>> iteratorStack = new Stack<>(); | Stack<Iterator<Object>> iteratorStack = new Stack<>(); | ||||
Stack<VMenuBar> menuStack = new Stack<>(); | Stack<VMenuBar> menuStack = new Stack<>(); | ||||
VMenuBar currentMenu = getWidget(); | VMenuBar currentMenu = getWidget(); | ||||
if (item.getChildCount() > 0) { | if (item.getChildCount() > 0) { | ||||
menuStack.push(currentMenu); | menuStack.push(currentMenu); | ||||
iteratorStack.push(itr); | iteratorStack.push(itr); | ||||
itr = item.getChildIterator(); | |||||
itr = item.iterator(); | |||||
currentMenu = new VMenuBar(true, currentMenu); | currentMenu = new VMenuBar(true, currentMenu); | ||||
client.getVTooltip().connectHandlersToWidget(currentMenu); | client.getVTooltip().connectHandlersToWidget(currentMenu); | ||||
// this is the top-level style that also propagates to items - | // this is the top-level style that also propagates to items - |
import java.util.Comparator; | import java.util.Comparator; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.logging.Logger; | import java.util.logging.Logger; | ||||
/* | /* | ||||
* Search the UIDL stream for CSS resources and strings to be injected. | * Search the UIDL stream for CSS resources and strings to be injected. | ||||
*/ | */ | ||||
for (Iterator<?> it = uidl.getChildIterator(); it.hasNext();) { | |||||
UIDL cssInjectionsUidl = (UIDL) it.next(); | |||||
for (Object child : uidl) { | |||||
UIDL cssInjectionsUidl = (UIDL) child; | |||||
// Check if we have resources to inject | // Check if we have resources to inject | ||||
if (cssInjectionsUidl.getTag().equals("css-resource")) { | if (cssInjectionsUidl.getTag().equals("css-resource")) { | ||||
getHead().appendChild(link); | getHead().appendChild(link); | ||||
// Check if we have CSS string to inject | // Check if we have CSS string to inject | ||||
} else if (cssInjectionsUidl.getTag().equals("css-string")) { | } else if (cssInjectionsUidl.getTag().equals("css-string")) { | ||||
for (Iterator<?> it2 = cssInjectionsUidl.getChildIterator(); it2 | |||||
.hasNext();) { | |||||
StyleInjector.injectAtEnd((String) it2.next()); | |||||
for (Object c : cssInjectionsUidl) { | |||||
StyleInjector.injectAtEnd((String) c); | |||||
StyleInjector.flush(); | StyleInjector.flush(); | ||||
} | } | ||||
} | } |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Set; | import java.util.Set; | ||||
// need to deselect when something else is selected since it's only | // need to deselect when something else is selected since it's only | ||||
// used in single select mode. | // used in single select mode. | ||||
} | } | ||||
for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) { | |||||
final UIDL optionUidl = (UIDL) i.next(); | |||||
for (final Object child : uidl) { | |||||
final UIDL optionUidl = (UIDL) child; | |||||
updateOrCreateItem(optionUidl.getStringAttribute("caption"), | updateOrCreateItem(optionUidl.getStringAttribute("caption"), | ||||
optionUidl.getStringAttribute("key"), nextIndex, | optionUidl.getStringAttribute("key"), nextIndex, | ||||
previousKeys); | previousKeys); |
package com.vaadin.v7.client.ui; | package com.vaadin.v7.client.ui; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import com.google.gwt.event.dom.client.ChangeEvent; | import com.google.gwt.event.dom.client.ChangeEvent; | ||||
select.addItem("", (String) null); | select.addItem("", (String) null); | ||||
} | } | ||||
boolean selected = false; | boolean selected = false; | ||||
for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) { | |||||
final UIDL optionUidl = (UIDL) i.next(); | |||||
for (final Object child : uidl) { | |||||
final UIDL optionUidl = (UIDL) child; | |||||
select.addItem(optionUidl.getStringAttribute("caption"), | select.addItem(optionUidl.getStringAttribute("caption"), | ||||
optionUidl.getStringAttribute("key")); | optionUidl.getStringAttribute("key")); | ||||
if (optionUidl.hasAttribute("selected")) { | if (optionUidl.hasAttribute("selected")) { |
Roles.getRadiogroupRole().set(getElement()); | Roles.getRadiogroupRole().set(getElement()); | ||||
} | } | ||||
for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) { | |||||
final UIDL opUidl = (UIDL) it.next(); | |||||
for (final Object child : uidl) { | |||||
final UIDL opUidl = (UIDL) child; | |||||
String itemHtml = opUidl.getStringAttribute("caption"); | String itemHtml = opUidl.getStringAttribute("caption"); | ||||
if (!htmlContentAllowed) { | if (!htmlContentAllowed) { |
return; | return; | ||||
} | } | ||||
final Iterator<?> it = actionsUidl.getChildIterator(); | |||||
while (it.hasNext()) { | |||||
final UIDL action = (UIDL) it.next(); | |||||
for (final Object child : actionsUidl) { | |||||
final UIDL action = (UIDL) child; | |||||
final String key = action.getStringAttribute("key"); | final String key = action.getStringAttribute("key"); | ||||
final String caption = action.getStringAttribute("caption"); | final String caption = action.getStringAttribute("caption"); | ||||
actionMap.put(key + "_c", caption); | actionMap.put(key + "_c", caption); | ||||
} | } | ||||
public void updateCellsFromUIDL(UIDL uidl) { | public void updateCellsFromUIDL(UIDL uidl) { | ||||
Iterator<?> it = uidl.getChildIterator(); | |||||
HashSet<String> updated = new HashSet<String>(); | HashSet<String> updated = new HashSet<String>(); | ||||
boolean refreshContentWidths = initializedAndAttached | boolean refreshContentWidths = initializedAndAttached | ||||
&& hadScrollBars != willHaveScrollbars(); | && hadScrollBars != willHaveScrollbars(); | ||||
while (it.hasNext()) { | |||||
final UIDL col = (UIDL) it.next(); | |||||
for (Object child : uidl) { | |||||
final UIDL col = (UIDL) child; | |||||
final String cid = col.getStringAttribute("cid"); | final String cid = col.getStringAttribute("cid"); | ||||
updated.add(cid); | updated.add(cid); | ||||
* The UIDL | * The UIDL | ||||
*/ | */ | ||||
public void updateCellsFromUIDL(UIDL uidl) { | public void updateCellsFromUIDL(UIDL uidl) { | ||||
Iterator<?> columnIterator = uidl.getChildIterator(); | |||||
HashSet<String> updated = new HashSet<String>(); | HashSet<String> updated = new HashSet<String>(); | ||||
while (columnIterator.hasNext()) { | |||||
final UIDL col = (UIDL) columnIterator.next(); | |||||
for (Object child : uidl) { | |||||
final UIDL col = (UIDL) child; | |||||
final String cid = col.getStringAttribute("cid"); | final String cid = col.getStringAttribute("cid"); | ||||
updated.add(cid); | updated.add(cid); | ||||
public void renderInitialRows(UIDL rowData, int firstIndex, int rows) { | public void renderInitialRows(UIDL rowData, int firstIndex, int rows) { | ||||
firstRendered = firstIndex; | firstRendered = firstIndex; | ||||
setLastRendered(firstIndex + rows - 1); | setLastRendered(firstIndex + rows - 1); | ||||
final Iterator<?> it = rowData.getChildIterator(); | |||||
aligns = tHead.getColumnAlignments(); | aligns = tHead.getColumnAlignments(); | ||||
while (it.hasNext()) { | |||||
final VScrollTableRow row = createRow((UIDL) it.next(), aligns); | |||||
for (final Object child : rowData) { | |||||
final VScrollTableRow row = createRow((UIDL) child, aligns); | |||||
addRow(row); | addRow(row); | ||||
} | } | ||||
if (isAttached()) { | if (isAttached()) { | ||||
public void renderRows(UIDL rowData, int firstIndex, int rows) { | public void renderRows(UIDL rowData, int firstIndex, int rows) { | ||||
// FIXME REVIEW | // FIXME REVIEW | ||||
aligns = tHead.getColumnAlignments(); | aligns = tHead.getColumnAlignments(); | ||||
final Iterator<?> it = rowData.getChildIterator(); | |||||
final Iterator<?> it = rowData.iterator(); | |||||
if (firstIndex == lastRendered + 1) { | if (firstIndex == lastRendered + 1) { | ||||
while (it.hasNext()) { | while (it.hasNext()) { | ||||
final VScrollTableRow row = prepareRow((UIDL) it.next()); | final VScrollTableRow row = prepareRow((UIDL) it.next()); | ||||
protected List<VScrollTableRow> insertRows(UIDL rowData, int firstIndex, | protected List<VScrollTableRow> insertRows(UIDL rowData, int firstIndex, | ||||
int rows) { | int rows) { | ||||
aligns = tHead.getColumnAlignments(); | aligns = tHead.getColumnAlignments(); | ||||
final Iterator<?> it = rowData.getChildIterator(); | |||||
final Iterator<?> it = rowData.iterator(); | |||||
List<VScrollTableRow> insertedRows = new ArrayList<VScrollTableRow>(); | List<VScrollTableRow> insertedRows = new ArrayList<VScrollTableRow>(); | ||||
if (firstIndex == lastRendered + 1) { | if (firstIndex == lastRendered + 1) { | ||||
protected void addCellsFromUIDL(UIDL uidl, char[] aligns, int col, | protected void addCellsFromUIDL(UIDL uidl, char[] aligns, int col, | ||||
int visibleColumnIndex) { | int visibleColumnIndex) { | ||||
final Iterator<?> cells = uidl.getChildIterator(); | |||||
while (cells.hasNext()) { | |||||
final Object cell = cells.next(); | |||||
for (final Object cell : uidl) { | |||||
visibleColumnIndex++; | visibleColumnIndex++; | ||||
String columnId = visibleColOrder[visibleColumnIndex]; | String columnId = visibleColOrder[visibleColumnIndex]; | ||||
htmlContentAllowed = uidl.getBooleanAttribute("gen_html"); | htmlContentAllowed = uidl.getBooleanAttribute("gen_html"); | ||||
spanColumns = uidl.getBooleanAttribute("gen_span"); | spanColumns = uidl.getBooleanAttribute("gen_span"); | ||||
final Iterator<?> cells = uidl.getChildIterator(); | |||||
if (spanColumns) { | if (spanColumns) { | ||||
int colCount = uidl.getChildCount(); | int colCount = uidl.getChildCount(); | ||||
if (cells.hasNext()) { | |||||
final Object cell = cells.next(); | |||||
// add the first cell only | |||||
for (final Object cell : uidl) { | |||||
if (cell instanceof String) { | if (cell instanceof String) { | ||||
addSpannedCell(uidl, cell.toString(), aligns[0], "", | addSpannedCell(uidl, cell.toString(), aligns[0], "", | ||||
htmlContentAllowed, false, null, colCount); | htmlContentAllowed, false, null, colCount); | ||||
addSpannedCell(uidl, (Widget) cell, aligns[0], "", | addSpannedCell(uidl, (Widget) cell, aligns[0], "", | ||||
false, colCount); | false, colCount); | ||||
} | } | ||||
break; | |||||
} | } | ||||
} else { | } else { | ||||
super.addCellsFromUIDL(uidl, aligns, col, | super.addCellsFromUIDL(uidl, aligns, col, |
treeSpacer.setClassName(classname); | treeSpacer.setClassName(classname); | ||||
container.insertFirst(treeSpacer); | container.insertFirst(treeSpacer); | ||||
depth = rowUidl.hasAttribute("depth") | depth = rowUidl.hasAttribute("depth") | ||||
? rowUidl.getIntAttribute("depth") : 0; | |||||
? rowUidl.getIntAttribute("depth") | |||||
: 0; | |||||
setIndent(); | setIndent(); | ||||
isTreeCellAdded = true; | isTreeCellAdded = true; | ||||
return true; | return true; | ||||
htmlContentAllowed = uidl.getBooleanAttribute("gen_html"); | htmlContentAllowed = uidl.getBooleanAttribute("gen_html"); | ||||
spanColumns = uidl.getBooleanAttribute("gen_span"); | spanColumns = uidl.getBooleanAttribute("gen_span"); | ||||
final Iterator<?> cells = uidl.getChildIterator(); | |||||
if (spanColumns) { | if (spanColumns) { | ||||
int colCount = uidl.getChildCount(); | int colCount = uidl.getChildCount(); | ||||
if (cells.hasNext()) { | |||||
final Object cell = cells.next(); | |||||
// add the first cell only | |||||
for (final Object cell : uidl) { | |||||
if (cell instanceof String) { | if (cell instanceof String) { | ||||
addSpannedCell(uidl, cell.toString(), aligns[0], "", | addSpannedCell(uidl, cell.toString(), aligns[0], "", | ||||
htmlContentAllowed, false, null, colCount); | htmlContentAllowed, false, null, colCount); | ||||
addSpannedCell(uidl, (Widget) cell, aligns[0], "", | addSpannedCell(uidl, (Widget) cell, aligns[0], "", | ||||
false, colCount); | false, colCount); | ||||
} | } | ||||
break; | |||||
} | } | ||||
} else { | } else { | ||||
super.addCellsFromUIDL(uidl, aligns, col, | super.addCellsFromUIDL(uidl, aligns, col, |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Set; | import java.util.Set; | ||||
selections.setMultipleSelect(isMultiselect()); | selections.setMultipleSelect(isMultiselect()); | ||||
options.clear(); | options.clear(); | ||||
selections.clear(); | selections.clear(); | ||||
for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) { | |||||
final UIDL optionUidl = (UIDL) i.next(); | |||||
for (final Object child : uidl) { | |||||
final UIDL optionUidl = (UIDL) child; | |||||
if (optionUidl.hasAttribute("selected")) { | if (optionUidl.hasAttribute("selected")) { | ||||
selections.addItem(optionUidl.getStringAttribute("caption"), | selections.addItem(optionUidl.getStringAttribute("caption"), | ||||
optionUidl.getStringAttribute("key")); | optionUidl.getStringAttribute("key")); |
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
*/ | */ | ||||
@Override | @Override | ||||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { | ||||
Iterator<Object> childIterator = uidl.getChildIterator(); | |||||
while (childIterator.hasNext()) { | |||||
UIDL child = (UIDL) childIterator.next(); | |||||
for (Object c : uidl) { | |||||
UIDL child = (UIDL) c; | |||||
if (DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG.equals(child.getTag())) { | if (DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG.equals(child.getTag())) { | ||||
if (getWidget().getDropHandler() == null) { | if (getWidget().getDropHandler() == null) { | ||||
getWidget().setDropHandler(showingMonthView() | getWidget().setDropHandler(showingMonthView() |
package com.vaadin.v7.client.ui.combobox; | package com.vaadin.v7.client.ui.combobox; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
import com.google.gwt.core.client.Scheduler; | import com.google.gwt.core.client.Scheduler; | ||||
List<FilterSelectSuggestion> newSuggestions = new ArrayList<FilterSelectSuggestion>(); | List<FilterSelectSuggestion> newSuggestions = new ArrayList<FilterSelectSuggestion>(); | ||||
for (final Iterator<?> i = options.getChildIterator(); i.hasNext();) { | |||||
final UIDL optionUidl = (UIDL) i.next(); | |||||
for (final Object child : options) { | |||||
final UIDL optionUidl = (UIDL) child; | |||||
final FilterSelectSuggestion suggestion = getWidget().new FilterSelectSuggestion( | final FilterSelectSuggestion suggestion = getWidget().new FilterSelectSuggestion( | ||||
optionUidl); | optionUidl); | ||||
newSuggestions.add(suggestion); | newSuggestions.add(suggestion); |
getWidget().readonly = isReadOnly(); | getWidget().readonly = isReadOnly(); | ||||
getWidget().dragMode = uidl.hasAttribute("dragMode") | getWidget().dragMode = uidl.hasAttribute("dragMode") | ||||
? uidl.getIntAttribute("dragMode") : 0; | |||||
? uidl.getIntAttribute("dragMode") | |||||
: 0; | |||||
getWidget().isNullSelectionAllowed = uidl | getWidget().isNullSelectionAllowed = uidl | ||||
.getBooleanAttribute("nullselect"); | .getBooleanAttribute("nullselect"); | ||||
TreeNode childTree = null; | TreeNode childTree = null; | ||||
UIDL childUidl = null; | UIDL childUidl = null; | ||||
for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) { | |||||
childUidl = (UIDL) i.next(); | |||||
for (final Object child : uidl) { | |||||
childUidl = (UIDL) child; | |||||
if ("actions".equals(childUidl.getTag())) { | if ("actions".equals(childUidl.getTag())) { | ||||
updateActionMap(childUidl); | updateActionMap(childUidl); | ||||
continue; | continue; | ||||
VConsole.error(e); | VConsole.error(e); | ||||
} | } | ||||
renderChildNodes(rootNode, (Iterator) uidl.getChildIterator(), | |||||
renderChildNodes(rootNode, (Iterator) uidl.iterator(), | |||||
levelProperty + 1); | levelProperty + 1); | ||||
} | } | ||||
} | } | ||||
* @param uidl | * @param uidl | ||||
*/ | */ | ||||
private void updateActionMap(UIDL uidl) { | private void updateActionMap(UIDL uidl) { | ||||
final Iterator<?> it = uidl.getChildIterator(); | |||||
while (it.hasNext()) { | |||||
final UIDL action = (UIDL) it.next(); | |||||
for (final Object child : uidl) { | |||||
final UIDL action = (UIDL) child; | |||||
final String key = action.getStringAttribute("key"); | final String key = action.getStringAttribute("key"); | ||||
final String caption = action | final String caption = action | ||||
.getStringAttribute(TreeConstants.ATTRIBUTE_ACTION_CAPTION); | .getStringAttribute(TreeConstants.ATTRIBUTE_ACTION_CAPTION); | ||||
if (uidl.getChildCount() == 0) { | if (uidl.getChildCount() == 0) { | ||||
treeNode.childNodeContainer.setVisible(false); | treeNode.childNodeContainer.setVisible(false); | ||||
} else { | } else { | ||||
renderChildNodes(treeNode, (Iterator) uidl.getChildIterator(), | |||||
renderChildNodes(treeNode, (Iterator) uidl.iterator(), | |||||
level + 1); | level + 1); | ||||
treeNode.childrenLoaded = true; | treeNode.childrenLoaded = true; | ||||
} | } |