MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / build

Method build

CodenameOne/src/com/codename1/ui/UIFragment.java:362–392  ·  view source on GitHub ↗
(Element model, Container view)

Source from the content-addressed store, hash-verified

360 }
361
362 private void build(Element model, Container view) {
363 List<Element> children = getChildren(model);
364 int len = children.size();
365 for (int i = 0; i < len; i++) {
366 Element child = children.get(i);
367 if (child.isTextElement()) {
368 continue;
369 }
370 String tagName = child.getTagName();
371
372 Component cmp;
373 if (tagName.startsWith("$")) {
374 String pname = tagName.substring(1);
375 if (!parameters.containsKey(pname)) {
376 throw new IllegalArgumentException("Missing parameter " + pname);
377 }
378 cmp = parameters.get(pname);
379 decorate(child, cmp);
380 } else {
381 cmp = getFactory().newComponent(child);
382 decorate(child, cmp);
383 }
384
385 Object constraint = getFactory().newConstraint(view, model, cmp, child);
386 view.add(constraint, cmp);
387 if (cmp instanceof Container) {
388 build(child, (Container) cmp);
389 }
390
391 }
392 }
393
394 private void reset() {
395 view = null;

Callers 1

getViewMethod · 0.95

Calls 13

getChildrenMethod · 0.95
isTextElementMethod · 0.95
getTagNameMethod · 0.95
startsWithMethod · 0.95
substringMethod · 0.95
decorateMethod · 0.95
getFactoryMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65
containsKeyMethod · 0.65
newComponentMethod · 0.65
newConstraintMethod · 0.65

Tested by

no test coverage detected