private static final long serialVersionUID = -5179621361619239269L;
@Override
public void onClick(AjaxRequestTarget target) {
try {
FollowedArtifact followedArtifact = FollowedArtifactNotificationRulesPanel.this.getModelObject();
ArtifactNotificationRule rule = getModelObject();
followedArtifactService.removeArtifactNotificationRule(followedArtifact, rule);
Session.get().success(getString("artifact.rules.delete.success"));
} catch (Exception e) {
LOGGER.error("An error occured while removing the rule", e);
Session.get().error(getString("artifact.rules.delete.error"));
}
target.add(getPage());
FeedbackUtils.refreshFeedback(target, getPage());
}
});
}
};
add(rulesListView);
add(new WebMarkupContainer("emptyList") {
private static final long serialVersionUID = 6700720373087584498L;
@Override
public void onConfigure() {
super.onConfigure();
setVisible(rulesListView.size() <= 0);
}
});
// Add rule form
final Form<Void> addRuleForm = new Form<Void>("addRuleForm");
IModel<String> regexModel = Model.of();
IModel<ArtifactNotificationRuleType> typeModel = Model.of(ArtifactNotificationRuleType.COMPLY);
// Regex text field
final TextField<String> regexTextField = new RequiredTextField<String>("regexInput", regexModel);
regexTextField.setLabel(new ResourceModel("artifact.rules.field.regex"));
regexTextField.add(new LabelPlaceholderBehavior());
addRuleForm.add(regexTextField);
// Type dropdown
final ArtifactNotificationRuleTypeDropDownChoice typeDropDown = new ArtifactNotificationRuleTypeDropDownChoice("type", typeModel);
typeDropDown.setRequired(true);
addRuleForm.add(typeDropDown);
addRuleForm.add(new AjaxSubmitLink("addRuleLink", addRuleForm) {
private static final long serialVersionUID = 6935376642872117563L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
FollowedArtifact followedArtifact = FollowedArtifactNotificationRulesPanel.this.getModelObject();
String regex = regexTextField.getModelObject();
ArtifactNotificationRuleType type = typeDropDown.getModelObject();
if (StringUtils.hasText(regex) && type != null) {
try {