List of usage examples for org.apache.wicket Component get
@Override public Component get(final String path)
From source file:com.danhaywood.isis.wicket.ui.components.collectioncontents.gmap3.CollectionOfEntitiesAsLocatables.java
License:Apache License
private static void applyCssVisibility(final Component component, final boolean visible) { final AttributeModifier modifier = visible ? new AttributeModifier("class", String.valueOf(component.getMarkupAttributes().get("class")).replaceFirst(INVISIBLE_CLASS, "")) : new AttributeAppender("class", " " + INVISIBLE_CLASS); component.add(modifier);//from w ww.j a v a 2 s . co m }
From source file:com.evolveum.midpoint.web.page.admin.configuration.component.ObjectSelectionPage.java
License:Apache License
public static <T extends ObjectType> void prepareDialog(ModalWindow dialog, ObjectSelectionPanel.Context context, final Component callingComponent, String titleResourceKey, final String idToRefresh) { dialog.setPageCreator(new ObjectSelectionPage.PageCreator(dialog, context)); dialog.setInitialWidth(800);/*from w w w. ja va 2 s .c om*/ dialog.setInitialHeight(500); dialog.setTitle(PageBase.createStringResourceStatic(callingComponent, titleResourceKey)); dialog.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { // We are not able to refresh targets residing in the parent page // from inside the modal window -> so we have to do it in this // context, when the modal window is being closed. public void onClose(AjaxRequestTarget target) { target.add(callingComponent.get(idToRefresh)); } }); dialog.showUnloadConfirmation(false); dialog.setCssClassName(ModalWindow.CSS_CLASS_GRAY); dialog.setCookieName(ObjectSelectionPanel.class.getSimpleName() + ((int) (Math.random() * 100))); dialog.setWidthUnit("px"); }
From source file:name.martingeisse.wicket.component.misc.ExpandableRepeater.java
License:Open Source License
/** * @param item the rendered item//from w w w . ja v a 2s . co m */ protected final void notifyAboutPrototypeItem(final Component item) { final ComponentTag componentTag = (ComponentTag) item.getMarkup().get(0); notifyAboutPrototypeItem(componentTag.getName(), item.getMarkupId()); }
From source file:org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract.java
License:Apache License
protected static void applyCssVisibility(final Component component, final boolean visible) { final AttributeModifier modifier = visible ? new AttributeModifier("class", String.valueOf(component.getMarkupAttributes().get("class")).replaceFirst(INVISIBLE_CLASS, "")) : new AttributeAppender("class", " " + INVISIBLE_CLASS); component.add(modifier);//from ww w .j ava2 s.c o m }
From source file:org.devgateway.eudevfin.ui.common.components.TextInputFieldTest.java
License:Open Source License
@Test public void testTextRender() { TextInputField<String> component = new TextInputField<>("text", new Model<String>()); component.typeString(10);/* w w w .j a v a 2 s .c o m*/ tester.startComponentInPage(component); tester.assertComponent("text", TextInputField.class); TagTester label = TagTester.createTagByAttribute(tester.getLastResponse().getDocument(), "class", "control-label"); assertNotNull(label); assertEquals("label", label.getName()); assertEquals("Label", label.getValue()); TagTester controls = TagTester.createTagByAttribute(tester.getLastResponse().getDocument(), "class", "controls"); assertNotNull(controls); assertEquals("div", controls.getName()); List<TagTester> help = TagTester.createTagsByAttribute(tester.getLastResponse().getDocument(), "class", "help-block", false); assertNotNull(help); assertEquals(1L, help.size()); assertEquals("Help Text", help.get(0).getValue()); Component icon = tester.getComponentFromLastRenderedPage("text:control-group:detailedHelpIcon"); //click on the expand help button and see if the extra help arrives tester.executeBehavior(icon.getBehaviors(AjaxEventBehavior.class).get(0)); help = TagTester.createTagsByAttribute(tester.getLastResponse().getDocument(), "class", "help-block", false); assertNotNull(help); assertEquals(2L, help.size()); assertEquals("Help Text", help.get(0).getValue()); assertEquals("Help Detail", help.get(1).getValue()); TagTester inputField = TagTester.createTagByAttribute(tester.getLastResponse().getDocument(), "type", "text"); assertNotNull(inputField); assertEquals("input", inputField.getName()); assertEquals("Placeholder", inputField.getAttribute("placeholder")); }
From source file:org.efaps.ui.wicket.behaviors.dojo.AutoCompleteBehavior.java
License:Apache License
@Override public void renderHead(final Component _component, final IHeaderResponse _response) { super.renderHead(_component, _response); // add wicket ajax to be sure that is is included CoreLibrariesContributor.contributeAjax(this.component.getApplication(), _response); final CharSequence ajaxBaseUrl = Strings .escapeMarkup(this.component.getRequestCycle().getUrlRenderer().getBaseUrl().toString()); _response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl + "\";", "wicket-ajax-base-url")); _response.render(AbstractEFapsHeaderItem.forCss(AutoCompleteBehavior.CSS)); final String comboBoxId = "cb" + _component.getMarkupId(); final StringBuilder js = new StringBuilder().append("var ").append(comboBoxId); switch (this.settings.getAutoType()) { case SUGGESTION: js.append(" = new AutoSuggestion({"); break;//from w w w . j a v a 2 s. com case TOKEN: js.append(" = new AutoTokenInput({"); break; default: js.append(" = new AutoComplete({"); break; } js.append("id:\"").append(_component.getMarkupId()).append("\",").append("name:\"") .append(this.settings.getFieldName()).append("\",").append("placeHolder:ph,").append("store: as,") .append("value: \"\",").append("callbackUrl:\"" + getCallbackUrl() + "\","); switch (this.settings.getAutoType()) { case TOKEN: break; default: final String id = ((AutoCompleteField) _component).getItemValue(); final String label = ((AutoCompleteField) _component).getItemLabel(); // only if both value are valid it makes sence to add it if (StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(label)) { js.append("item: { id:\"").append(id).append("\", name:\"").append(label).append("\", label:\"") .append(label).append("\"},"); } break; } if (this.settings.getFieldConfiguration().hasProperty(UIFormFieldProperty.WIDTH) && !this.settings.getFieldConfiguration().isTableField()) { js.append("style:\"width:").append(this.settings.getFieldConfiguration().getWidth()).append("\","); } if (!this.settings.isHasDownArrow()) { js.append("hasDownArrow:").append(this.settings.isHasDownArrow()).append(","); } if (this.settings.getMinInputLength() > 1) { js.append("minInputLength:").append(this.settings.getMinInputLength()).append(","); } if (this.settings.getSearchDelay() != 500) { js.append("searchDelay:").append(this.settings.getSearchDelay()).append(","); } if (!"p".equals(this.settings.getParamName())) { js.append("paramName:\"").append(this.settings.getParamName()).append("\","); } if (!this.settings.getExtraParameters().isEmpty()) { js.append("extraParameters:["); boolean first = true; for (final String ep : this.settings.getExtraParameters()) { if (first) { first = false; } else { js.append(","); } js.append("\"").append(ep).append("\""); } js.append("],"); } if (Type.SUGGESTION.equals(this.settings.getAutoType())) { js.append("labelAttr: \"label\","); } js.append("searchAttr: \"name\"}, \"").append(_component.getMarkupId()).append("\");\n"); if (this.settings.isRequired() && !Type.TOKEN.equals(this.settings.getAutoType())) { js.append("on(").append(comboBoxId).append(", 'change', function() {").append("var label=") .append(comboBoxId).append(".item.label;") .append("if (!(label === undefined || label === null)) {").append(comboBoxId) .append(".item.name=label;").append(comboBoxId).append(".set(\"item\",").append(comboBoxId) .append(".item);").append("}"); if (this.fieldUpdate != null) { js.append(this.fieldUpdate.getCallbackScript4Dojo()); } js.append("});\n"); } else if (this.fieldUpdate != null) { js.append("on(").append(comboBoxId).append(", 'change', function() {") .append(this.fieldUpdate.getCallbackScript4Dojo()).append("});\n"); } if (!_component.getBehaviors(SetSelectedRowBehavior.class).isEmpty()) { js.append("on(").append(comboBoxId).append(", 'focus', function() {").append( _component.getBehaviors(SetSelectedRowBehavior.class).get(0).getJavaScript("this.valueNode")) .append("});\n"); } if (Type.TOKEN.equals(this.settings.getAutoType())) { final List<IOption> tokens = ((AutoCompleteField) _component).getTokens(); for (final IOption token : tokens) { js.append(comboBoxId).append(".addToken(\"") .append(StringEscapeUtils.escapeEcmaScript(token.getValue().toString())).append("\",\"") .append(StringEscapeUtils.escapeEcmaScript(token.getLabel())).append("\");\n"); } } _response.render(AutoCompleteHeaderItem.forScript(js.toString(), EnumSet.of(this.settings.getAutoType()))); }
From source file:org.hippoecm.frontend.dialog.Wizard.java
License:Apache License
@Override protected Component newButtonBar(final String id) { final Component buttonBar = super.newButtonBar(id); final AttributeModifier buttonCssClass = CssClass.append("btn btn-default"); buttonBar.get("cancel").add(buttonCssClass); buttonBar.get("previous").add(buttonCssClass); buttonBar.get("next").add(buttonCssClass); buttonBar.get("finish").add(buttonCssClass); return buttonBar; }
From source file:org.onehippo.forge.settings.management.config.brokenlinks.BrokenLinksCheckerConfigPanel.java
License:Apache License
private AjaxFormComponentUpdatingBehavior createSimpleAjaxChangeBehavior(final Component... components) { return new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override//from ww w. ja v a2 s. c o m protected void onUpdate(AjaxRequestTarget target) { if (components != null) { for (final Component component : components) { target.add(component); Component reset = component.getParent().get(component.getId() + "-reset-container"); if (reset != null) { target.add(reset); } } } } }; }
From source file:org.openengsb.ui.admin.edb.EdbHistoryPanelTest.java
License:Apache License
@Test public void testInitPanel_shouldShowHistory() throws Exception { tester.startPage(new EdbHistoryPanel("42")); tester.debugComponentTrees();//from ww w. j ava 2s .c o m ListView<?> list = (ListView<?>) tester.getComponentFromLastRenderedPage("history"); Component line = list.get(0); assertThat(line.get("time").getDefaultModelObjectAsString(), containsString("Jun 28")); assertThat(line.get("committer").getDefaultModelObjectAsString(), is("adams")); }
From source file:org.opensingular.lib.wicket.util.datatable.column.BSActionPanel.java
License:Apache License
protected void onConfigure() { super.onConfigure(); for (Component comp : actions) { MarkupContainer container = (MarkupContainer) comp.get(LINK_ID); if (container != null && container.get(ICONE_ID) == null) { container.add(new IconeView(ICONE_ID)); }/* w w w . j a va 2s. c o m*/ } }