add(new AjaxFormSubmitBehavior(form, "onclick")
add(new AjaxFormSubmitBehavior(form, "onclick")
@Override protected void onInitialize() { super.onInitialize(); add(newAjaxFormSubmitBehavior("click")); }
@Override protected void onInitialize() { super.onInitialize(); add(newAjaxFormSubmitBehavior("click")); }
@Override protected void populateItem(Item<String> item) { String id = item.getModelObject(); final BSTab tab = tabMap.get(id); if (activeTab == null && item.getIndex() == 0 || activeTab != null && activeTab.equals(tab)) { item.add($b.classAppender("active")); } item.add($b.attr("data-tab-name", id)); AjaxSubmitLink link = new AjaxSubmitLink("tabAnchor") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { activeTab = tab; buildTabContent(); updateTab(tab, newArrayList(tabMap.values())); target.appendJavaScript("$('.nav-tabs li').removeClass('active');"); target.appendJavaScript("$('.nav-tabs li[data-tab-name=\"" + id + "\"]').addClass('active');"); target.add(form); if (toUpdadeOnTab() != null) { toUpdadeOnTab().forEach((c) -> target.add(c)); } } }; link.add(new Label("header-text", tab.getHeaderText())); Label label = new Label("header-icon", ""); label.add(new AttributeModifier("class", tab.iconClass())); link.add(label); item.add(link); onTabCreated(tab, item); } };
@Override protected void populateItem(Item<String> item) { String id = item.getModelObject(); final BSTab tab = tabMap.get(id); item.setMetaData(TAB_KEY, tab); if (activeTab == null && item.getIndex() == 0 || activeTab != null && activeTab.equals(tab)) { item.add($b.classAppender("active")); } item.add($b.attr("data-tab-name", id)); AjaxSubmitLink link = new AjaxSubmitLink("tabAnchor") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { keyActive = id; activeTab = tab; buildTabContent(); target.add(form); updateTab(tab, newArrayList(tabMap.values())); if (toUpdadeOnTab() != null) { toUpdadeOnTab().forEach(target::add); } } }; Label label = new Label("header-icon", ""); label.add(new AttributeModifier("class", $m.get(() -> "tab-header-icon " + tab.iconClass()))); link.add(label); link.add(new Label("header-text", tab.getHeaderText())); item.add(link); onTabCreated(tab, item); } };
@Override protected void populateItem(final ListItem<String> item) { RequiredTextField<String> rtf = new RequiredTextField<>("containerName", item.getModel()); rtf.setOutputMarkupId(true); rtf.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { } }); item.add(rtf); AjaxSubmitLink remove = new AjaxSubmitLink("removeContainer") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { getBean().removeContainer(item.getIndex()); redraw(); } }; remove.setDefaultFormProcessing(false); item.add(remove); remove.add(HippoIcon.fromSprite("icon", Icon.TIMES_CIRCLE)); }
addParam.add(HippoIcon.fromSprite("icon", Icon.PLUS)); addParam.setDefaultFormProcessing(false); add(addParam);
@Override protected void populateItem(final ListItem<Parameter> item) { Parameter param = item.getModelObject(); RequiredTextField<String> keyField = new RequiredTextField<>("name", PropertyModel.of(param, "name")); keyField.setOutputMarkupId(true); keyField.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { } }); item.add(keyField); TextField<String> value = new RequiredTextField<>("value", PropertyModel.of(param, "value")); value.setOutputMarkupId(true); value.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { } }); item.add(value); AjaxSubmitLink remove = new AjaxSubmitLink("remove") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { model.getObject().removeParameter(item.getIndex()); target.add(ParametersWidget.this); } }; remove.setDefaultFormProcessing(false); item.add(remove); remove.add(HippoIcon.fromSprite("icon", Icon.TIMES_CIRCLE, IconSize.M)); }
form.add(addContainer); addContainer.add(HippoIcon.fromSprite("icon", Icon.PLUS));