List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink
public AjaxLink(final String id)
From source file:com.evolveum.midpoint.web.component.assignment.UserSelectionButton.java
License:Apache License
private void initLayout() { AjaxLink<String> userSelectionButton = new AjaxLink<String>(ID_USER_SELECTION_BUTTON) { private static final long serialVersionUID = 1L; @Override//from ww w .j av a 2s. co m protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE); } @Override public void onClick(AjaxRequestTarget target) { if (showUserSelectionPopup) { initUserSelectionPopup(target); } showUserSelectionPopup = true; } }; userSelectionButton.add(AttributeModifier.append("class", getTargetUserButtonClass())); userSelectionButton.setOutputMarkupId(true); userSelectionButton.add(new AttributeAppender("title", new IModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return getUserSelectionButtonTitle(); } })); add(userSelectionButton); Label label = new Label(ID_USER_SELECTION_BUTTON_LABEL, new IModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { return getUserButtonLabel(); } }); label.setRenderBodyOnly(true); userSelectionButton.add(label); AjaxLink deleteButton = new AjaxLink(ID_DELETE_SELECTED_USER_BUTTON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { UserSelectionButton.this.onDeleteSelectedUsersPerformed(target); } }; deleteButton.add(new VisibleEnableBehaviour() { private static final long serialVersionUID = 1L; @Override public boolean isVisible() { return isDeleteButtonVisible(); } }); userSelectionButton.add(deleteButton); }
From source file:com.evolveum.midpoint.web.component.data.column.LinkIconPanel.java
License:Apache License
private void initLayout(IModel<String> model, IModel<String> titleModel) { AjaxLink link = new AjaxLink(ID_LINK) { @Override// w w w .j av a 2 s .c om public void onClick(AjaxRequestTarget target) { onClickPerformed(target); } }; Label image = new Label(ID_IMAGE); image.add(AttributeModifier.replace("class", model)); if (titleModel != null) { image.add(AttributeModifier.replace("title", titleModel)); } link.add(image); link.setOutputMarkupId(true); add(link); }
From source file:com.evolveum.midpoint.web.component.data.column.LinkPanel.java
License:Apache License
public LinkPanel(String id, IModel<String> label) { super(id);//from w w w.jav a 2 s. com AjaxLink link = new AjaxLink(ID_LINK) { @Override public void onClick(AjaxRequestTarget target) { LinkPanel.this.onClick(target); } @Override public String getBeforeDisabledLink() { return null; } @Override public String getAfterDisabledLink() { return null; } }; link.add(new Label(ID_LABEL, label)); link.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return LinkPanel.this.isEnabled(); } }); add(link); }
From source file:com.evolveum.midpoint.web.component.data.column.TwoValueLinkPanel.java
License:Apache License
public TwoValueLinkPanel(String id, IModel<String> label, IModel<String> description) { super(id);/*from w ww. ja v a2 s. co m*/ AjaxLink link = new AjaxLink(ID_LINK) { @Override public void onClick(AjaxRequestTarget target) { TwoValueLinkPanel.this.onClick(target); } // @Override // public String getBeforeDisabledLink() { // return null; // } // // @Override // public String getAfterDisabledLink() { // return null; // } }; link.add(new Label(ID_LABEL, label)); link.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return TwoValueLinkPanel.this.isEnabled(); } }); add(link); add(new Label(ID_DESCRIPTION, description)); }
From source file:com.evolveum.midpoint.web.component.data.paging.NavigatorPanel.java
License:Apache License
private void initPrevious() { WebMarkupContainer previous = new WebMarkupContainer(ID_PREVIOUS); previous.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { @Override/*w w w. ja v a 2 s . c o m*/ public String getObject() { return isPreviousEnabled() ? "" : "disabled"; } })); add(previous); AjaxLink previousLink = new AjaxLink(ID_PREVIOUS_LINK) { @Override public void onClick(AjaxRequestTarget target) { previousPerformed(target); } }; previousLink.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return isPreviousEnabled(); } }); previous.add(previousLink); }
From source file:com.evolveum.midpoint.web.component.data.paging.NavigatorPanel.java
License:Apache License
private void initFirst() { WebMarkupContainer first = new WebMarkupContainer(ID_FIRST); first.add(new VisibleEnableBehaviour() { @Override/* ww w . j av a 2 s . c o m*/ public boolean isVisible() { return showPageListing && showFirstAndDots(); } }); add(first); AjaxLink firstLink = new AjaxLink(ID_FIRST_LINK) { @Override public void onClick(AjaxRequestTarget target) { firstPerformed(target); } }; first.add(firstLink); WebMarkupContainer dots = new WebMarkupContainer(ID_DOTS); dots.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return showPageListing && showFirstAndDots(); } }); add(dots); }
From source file:com.evolveum.midpoint.web.component.data.paging.NavigatorPanel.java
License:Apache License
private void initNext() { WebMarkupContainer next = new WebMarkupContainer(ID_NEXT); next.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { @Override/*from w ww .ja v a 2s . c o m*/ public String getObject() { return isNextEnabled() ? "" : "disabled"; } })); add(next); AjaxLink nextLink = new AjaxLink(ID_NEXT_LINK) { @Override public void onClick(AjaxRequestTarget target) { nextPerformed(target); } }; nextLink.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { return isNextEnabled(); } }); next.add(nextLink); }
From source file:com.evolveum.midpoint.web.component.data.TableConfigurationPanel.java
License:Apache License
protected void initLayout() { WebMarkupContainer cogButton = new WebMarkupContainer(ID_COG_BUTTON); cogButton.setOutputMarkupId(true);//from ww w . ja va 2 s . c o m add(cogButton); WebMarkupContainer pageSize = new WebMarkupContainer(ID_PAGE_SIZE); pageSize.setOutputMarkupId(true); cogButton.add(pageSize); AjaxLink tableColumns = new AjaxLink(ID_TABLE_COLUMNS) { @Override public void onClick(AjaxRequestTarget target) { tableColumnsPerformed(target); } }; cogButton.add(tableColumns); tableColumns.setVisible(false); //todo implement [lazyman] initPopoverLayout(); }
From source file:com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel.java
License:Apache License
private void initLayout(final IModel<String> label, final String labelSize, final String textSize) { Label l = new Label(ID_LABEL, label); if (StringUtils.isNotEmpty(labelSize)) { l.add(AttributeAppender.prepend("class", labelSize)); }/* ww w . j ava 2 s .c o m*/ add(l); WebMarkupContainer addFirstContainer = new WebMarkupContainer(ID_ADD_FIRST_CONTAINER); addFirstContainer.setOutputMarkupId(true); addFirstContainer.setOutputMarkupPlaceholderTag(true); addFirstContainer.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return getModelObject().isEmpty(); } }); add(addFirstContainer); AjaxLink addFirst = new AjaxLink(ID_ADD_FIRST) { @Override public void onClick(AjaxRequestTarget target) { addFirstPerformed(target); } }; addFirstContainer.add(addFirst); ListView repeater = new ListView<T>(ID_REPEATER, getModel()) { @Override protected void populateItem(final ListItem<T> listItem) { WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER); textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() { @Override public String getObject() { StringBuilder sb = new StringBuilder(); if (StringUtils.isNotEmpty(textSize)) { sb.append(textSize).append(' '); } if (listItem.getIndex() > 0 && StringUtils.isNotEmpty(getOffsetClass())) { sb.append(getOffsetClass()).append(' '); sb.append(CLASS_MULTI_VALUE); } return sb.toString(); } })); listItem.add(textWrapper); TextField text = new TextField<>(ID_TEXT, createTextModel(listItem.getModel())); text.add(new AjaxFormComponentUpdatingBehavior("onblur") { @Override protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { } }); text.setEnabled(false); text.add(AttributeAppender.replace("placeholder", label)); text.setLabel(label); textWrapper.add(text); FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(text)); textWrapper.add(feedback); WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP); buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() { @Override public String getObject() { if (listItem.getIndex() > 0 && StringUtils.isNotEmpty(labelSize)) { return CLASS_MULTI_VALUE; } return null; } })); AjaxLink edit = new AjaxLink(ID_EDIT) { @Override public void onClick(AjaxRequestTarget target) { editValuePerformed(target, listItem.getModel()); } }; textWrapper.add(edit); listItem.add(buttonGroup); initButtons(buttonGroup, listItem); } }; initDialog(); add(repeater); }
From source file:com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel.java
License:Apache License
private void initButtons(WebMarkupContainer buttonGroup, final ListItem<T> item) { AjaxLink add = new AjaxLink(ID_ADD) { @Override// w w w. java2s . com public void onClick(AjaxRequestTarget target) { addValuePerformed(target); } }; add.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return isAddButtonVisible(item); } }); buttonGroup.add(add); AjaxLink remove = new AjaxLink(ID_REMOVE) { @Override public void onClick(AjaxRequestTarget target) { removeValuePerformed(target, item); } }; remove.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return isRemoveButtonVisible(); } }); buttonGroup.add(remove); }