/** * Return a {@link Map} that represents the action view. * * @return a {@link Map} */ public Map<String, Object> map() { Map<String, Object> result = Maps.newHashMap(); Map<String, Object> params = Maps.newHashMap(); List<Object> items = Lists.newArrayList(); String type = null; for (View v : view.views) { if (type == null) { type = v.type; } Map<String, Object> item = Maps.newHashMap(); item.put("type", v.getType()); item.put("name", v.getName()); items.add(item); } if (type == null) { type = "grid"; items.add(ImmutableMap.of("type", "grid")); items.add(ImmutableMap.of("type", "form")); } for (Param param : view.params) { Object value = param.value; if ("false".equals(value)) value = false; if ("true".equals(value)) value = true; params.put(param.name, value); } result.put("title", view.title); result.put("icon", view.icon); result.put("model", view.getModel()); result.put("viewType", type); result.put("views", items); result.put("domain", view.domain); result.put("context", context); result.put("params", params); return result; }
public ActionViewBuilder domain(String domain) { view.domain = domain; return this; }
public ActionViewBuilder icon(String icon) { view.icon = icon; return this; }
public ActionViewBuilder model(String model) { view.setModel(model); return this; }
public ActionViewBuilder name(String name) { view.setName(name); return this; }
private ActionViewBuilder(String title) { view.title = title; view.views = Lists.newArrayList(); view.params = Lists.newArrayList(); }