use of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow in project midpoint by Evolveum.
the class PageCertCampaigns method getDeleteCampaignConfirmationPanel.
private Popupable getDeleteCampaignConfirmationPanel() {
return new ConfirmationPanel(getMainPopupBodyId(), createDeleteCampaignConfirmString()) {
private static final long serialVersionUID = 1L;
@Override
public void yesPerformed(AjaxRequestTarget target) {
ModalWindow modalWindow = findParent(ModalWindow.class);
if (modalWindow != null) {
modalWindow.close(target);
deleteCampaignConfirmedPerformed(target);
}
}
@Override
public StringResourceModel getTitle() {
return createStringResource("PageCertCampaigns.dialog.title.confirmDeleteCampaign");
}
};
}
use of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow in project midpoint by Evolveum.
the class PageBase method createModalWindow.
protected ModalWindow createModalWindow(final String id, IModel<String> title, int width, int height) {
final ModalWindow modal = new ModalWindow(id);
add(modal);
modal.setResizable(false);
modal.setTitle(title);
modal.setCookieName(PageBase.class.getSimpleName() + ((int) (Math.random() * 100)));
modal.setInitialWidth(width);
modal.setWidthUnit("px");
modal.setInitialHeight(height);
modal.setHeightUnit("px");
modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
@Override
public boolean onCloseButtonClicked(AjaxRequestTarget target) {
return true;
}
});
modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
@Override
public void onClose(AjaxRequestTarget target) {
modal.close(target);
}
});
modal.add(new AbstractDefaultAjaxBehavior() {
@Override
public void renderHead(Component component, IHeaderResponse response) {
response.render(OnDomReadyHeaderItem.forScript("Wicket.Window.unloadConfirmation = false;"));
response.render(JavaScriptHeaderItem.forScript("$(document).ready(function() {\n" + " $(document).bind('keyup', function(evt) {\n" + " if (evt.keyCode == 27) {\n" + getCallbackScript() + "\n" + " evt.preventDefault();\n" + " }\n" + " });\n" + "});", id));
}
@Override
protected void respond(AjaxRequestTarget target) {
modal.close(target);
}
});
return modal;
}
use of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow in project midpoint by Evolveum.
the class WizardSteps method initModals.
private void initModals() {
ModalWindow helpWindow = new WizardHelpDialog(ID_HELP_MODAL, getActiveStep());
add(helpWindow);
}
use of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow in project midpoint by Evolveum.
the class CapabilityStep method initLayout.
protected void initLayout() {
final ListDataProvider<CapabilityDto<CapabilityType>> capabilityProvider = new ListDataProvider<>(this, new PropertyModel<List<CapabilityDto<CapabilityType>>>(dtoModel, CapabilityStepDto.F_CAPABILITIES));
WebMarkupContainer tableBody = new WebMarkupContainer(ID_CAPABILITY_TABLE);
tableBody.setOutputMarkupId(true);
add(tableBody);
WebMarkupContainer configBody = new WebMarkupContainer(ID_CAPABILITY_CONFIG);
configBody.setOutputMarkupId(true);
add(configBody);
DataView<CapabilityDto<CapabilityType>> capabilityDataView = new DataView<CapabilityDto<CapabilityType>>(ID_CAPABILITY_ROW, capabilityProvider) {
@Override
protected void populateItem(final Item<CapabilityDto<CapabilityType>> capabilityRow) {
final CapabilityDto<CapabilityType> dto = capabilityRow.getModelObject();
AjaxLink name = new AjaxLink(ID_CAPABILITY_LINK) {
@Override
public void onClick(AjaxRequestTarget target) {
editCapabilityPerformed(target, dto);
}
};
Label label = new Label(ID_CAPABILITY_NAME, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
String rv = dto.getDisplayName();
if (Boolean.FALSE.equals(dto.getCapability().isEnabled())) {
rv += " " + getString("CapabilityStep.disabled");
}
return rv;
}
});
name.add(label);
capabilityRow.add(name);
Label tooltipLabel = new Label(ID_TOOLTIP, new Model<>());
if (dto.getTooltipKey() != null) {
tooltipLabel.add(new AttributeAppender("data-original-title", getString(dto.getTooltipKey())));
tooltipLabel.add(new InfoTooltipBehavior());
} else {
tooltipLabel.setVisible(false);
}
tooltipLabel.setOutputMarkupId(true);
tooltipLabel.setOutputMarkupPlaceholderTag(true);
name.add(tooltipLabel);
AjaxLink deleteLink = new AjaxLink(ID_CAPABILITY_DELETE) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteCapabilityPerformed(target, dto);
}
};
deleteLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !dto.isAmongNativeCapabilities() && !parentPage.isReadOnly();
}
});
name.add(deleteLink);
capabilityRow.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<Object>() {
@Override
public Object getObject() {
return isSelected(capabilityRow.getModelObject()) ? "success" : null;
}
}));
}
};
tableBody.add(capabilityDataView);
AjaxLink addLink = new AjaxLink(ID_CAPABILITY_ADD) {
@Override
public void onClick(AjaxRequestTarget target) {
addCapabilityPerformed(target);
}
};
parentPage.addEditingVisibleBehavior(addLink);
add(addLink);
ModalWindow dialog = new AddCapabilityDialog(DIALOG_SELECT_CAPABILITY, dtoModel) {
@Override
protected void addPerformed(AjaxRequestTarget target) {
addCapabilitiesPerformed(target, getSelectedData());
}
};
add(dialog);
}
use of org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow in project midpoint by Evolveum.
the class AssociationValueChoicePanel method choosePerformed.
protected void choosePerformed(AjaxRequestTarget target, C object) {
ModalWindow window = (ModalWindow) get(MODAL_ID_OBJECT_SELECTION_POPUP);
window.close(target);
replace(object);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("New object instance has been added to the model.");
}
}
Aggregations