private Div examplesDiv(ObjectMap m) { if (m.isEmpty()) return null; Select select = null; if (m.size() > 1) { select = (Select)select().onchange("selectExample(this)")._class("example-select"); } Div div = div(select)._class("examples"); if (select != null) select.child(option("model","model")); div.child(div(m.remove("model"))._class("model active").attr("data-name", "model")); for (Map.Entry<String,Object> e : m.entrySet()) { if (select != null) select.child(option(e.getKey(), e.getKey())); div.child(div(e.getValue().toString().replaceAll("\\n", "\n"))._class("example").attr("data-name", e.getKey())); } return div; }
private Div examplesDiv(ObjectMap m) { if (m.isEmpty()) return null; Select select = null; if (m.size() > 1) { select = (Select)select().onchange("selectExample(this)")._class("example-select"); } Div div = div(select)._class("examples"); if (select != null) select.child(option("model","model")); div.child(div(m.remove("model"))._class("model active").attr("data-name", "model")); for (Map.Entry<String,Object> e : m.entrySet()) { if (select != null) select.child(option(e.getKey(), e.getKey())); div.child(div(e.getValue().toString().replaceAll("\\n", "\n"))._class("example").attr("data-name", e.getKey())); } return div; }
private Div examplesDiv(ObjectMap m) { if (m.isEmpty()) return null; Select select = null; if (m.size() > 1) { select = (Select)select().onchange("selectExample(this)")._class("example-select"); } Div div = div(select)._class("examples"); if (select != null) select.child(option("model","model")); div.child(div(m.remove("model"))._class("model active").attr("data-name", "model")); for (Map.Entry<String,Object> e : m.entrySet()) { if (select != null) select.child(option(e.getKey(), e.getKey())); div.child(div(e.getValue().toString().replaceAll("\\n", "\n"))._class("example").attr("data-name", e.getKey())); } return div; }