List of usage examples for org.apache.wicket.util.string Strings isEqual
public static boolean isEqual(final String string1, final String string2)
From source file:com.googlecode.wicket.kendo.ui.datatable.button.AbstractButton.java
License:Apache License
/** * Indicates whether this {@link AbstractButton} name match to the supplied name. * * @param name the name to compare to/*from w w w.jav a 2 s . c o m*/ * @return true if equal */ public boolean match(String name) { return Strings.isEqual(name, this.name); }
From source file:org.cast.cwm.data.UserContent.java
License:Open Source License
/** * Sets the text value, as well as the lastUpdated field if the text has changed. * This enforces that lastUpdated will track any changes to the text. * @param text// www.j av a 2 s .c om */ public void setText(String text) { if (!Strings.isEqual(this.text, text)) this.lastUpdated = new Date(); this.text = text; }
From source file:org.cast.cwm.data.UserContent.java
License:Open Source License
/** * Sets the title value, as well as the lastUpdated field if the title has changed. * This enforces that lastUpdated will track any changes to the title. * @param title text to set/*from ww w.j a v a 2 s.c o m*/ */ public void setTitle(String title) { if (!Strings.isEqual(this.title, title)) this.lastUpdated = new Date(); this.title = title; }
From source file:org.devgateway.eudevfin.mcm.pages.EditOrganizationPage.java
License:Open Source License
public EditOrganizationPage(final PageParameters parameters) { super(parameters); final Organization org; if (Strings.isEqual(parameters.get(PARAM_ORG_ID).toString(), PARAM_ORG_ID_VALUE_NEW)) { org = new Organization(); org.setDac(false);//from w w w . j a v a 2s .c o m Organization organizationForCurrentUser = AuthUtils.getOrganizationForCurrentUser(); org.setDonorCode(organizationForCurrentUser.getDonorCode()); org.setDonorName(organizationForCurrentUser.getDonorName()); } else { long orgId = parameters.get(PARAM_ORG_ID).toLong(); org = organizationService.findOne(orgId).getEntity(); } Form<Organization> form = new Form<Organization>("form"); CompoundPropertyModel<Organization> model = new CompoundPropertyModel<>(org); setModel(model); TextInputField<String> name = new TextInputField<>("name", new RWComponentPropertyModel<String>("name")) .required().typeString(); form.add(name); TextInputField<String> acronym = new TextInputField<>("acronym", new RWComponentPropertyModel<String>("acronym")).required().typeString(); form.add(acronym); TextInputField<String> code = new TextInputField<>("code", new RWComponentPropertyModel<String>("code")) .required().typeString(); form.add(code); TextInputField<String> donorName = new TextInputField<>("donorName", new RWComponentPropertyModel<String>("donorName")).required().typeString(); donorName.getField().setEnabled(false); form.add(donorName); form.add(new BootstrapSubmitButton("submit", new StringResourceModel("button.submit", this, null, (Object) null)) { private static final long serialVersionUID = 1748161296530970075L; @Override protected void onError(AjaxRequestTarget target, Form<?> form) { // TODO Auto-generated method stub super.onError(target, form); target.add(feedbackPanel); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { logger.info("Submitted ok!"); logger.info("Object:" + getModel().getObject()); organizationService.save(org); mondrianCacheUtil.flushMondrianCDACache(); setResponsePage(ListOrganizationsPage.class); } }); form.add(new BootstrapDeleteButton("delete", new StringResourceModel("button.delete", this, null)) { private static final long serialVersionUID = 6700688063444818086L; protected void onSubmit(AjaxRequestTarget target, Form<?> form) { Organization org = (Organization) form.getInnermostModel().getObject(); logger.debug("Object:" + org); logger.info("Deleting!"); target.add(feedbackPanel); try { if (org.getId() == null) return; organizationService.delete(org); info(new NotificationMessage( new StringResourceModel("notification.deleted", EditOrganizationPage.this, null))); mondrianCacheUtil.flushMondrianCDACache(); } catch (Exception e) { logger.error("Exception while trying to delete:", e); error(new NotificationMessage( new StringResourceModel("notification.cannotdelete", EditOrganizationPage.this, null))); return; } setResponsePage(ListOrganizationsPage.class); logger.info("Deleted ok!"); }; }); form.add(new BootstrapCancelButton("cancel", new StringResourceModel("button.cancel", this, null, (Object) null)) { private static final long serialVersionUID = 6700688063444818086L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { logger.info("Cancel pressed"); setResponsePage(ListOrganizationsPage.class); } }); form.add(new UniqueOrganizationCodeAndDonorCodeValidator(code.getField(), donorName.getField(), org.getId())); add(form); feedbackPanel = new NotificationPanel("feedback"); feedbackPanel.setOutputMarkupId(true); feedbackPanel.hideAfter(Duration.seconds(4)); add(feedbackPanel); }
From source file:org.devgateway.eudevfin.ui.common.validators.BilateralField10CodeValidator.java
License:Open Source License
@Override public void validate(IValidatable<Category> validatable) { // allowed values are 1,3,7 if (!Strings.isEmpty(transactionType) && (Strings.isEqual(transactionType, SB.BILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.BILATERAL_ODA_CRS) || Strings.isEqual(transactionType, SB.BILATERAL_ODA_FORWARD_SPENDING))) { if (validatable.getValue() == null || validatable.getValue().getCode().equals(CategoryConstants.BiMultilateral.BI_MULTILATERAL_1) || validatable.getValue().getCode().equals(CategoryConstants.BiMultilateral.BI_MULTILATERAL_3) || validatable.getValue().getCode().equals(CategoryConstants.BiMultilateral.BI_MULTILATERAL_7)) return; ValidationError error = new ValidationError(this); validatable.error(decorate(error, validatable)); }/*from w w w .ja v a 2s. c o m*/ }
From source file:org.devgateway.eudevfin.ui.common.validators.BilateralField10TypeOfAidCodeValidator.java
License:Open Source License
@Override public void validate(IValidatable<Category> validatable) { if (!Strings.isEmpty(transactionType) && (Strings.isEqual(transactionType, SB.BILATERAL_ODA_CRS) || Strings.isEqual(transactionType, SB.BILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.BILATERAL_ODA_FORWARD_SPENDING))) { validateB01ForBiMulti3(validatable); }//www.j ava2s . co m }
From source file:org.devgateway.eudevfin.ui.common.validators.Field11CodeValidator.java
License:Open Source License
@Override public void validate(IValidatable<Category> validatable) { if (!Strings.isEmpty(transactionType) && (Strings.isEqual(transactionType, SB.BILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.BILATERAL_ODA_CRS) || Strings.isEqual(transactionType, SB.BILATERAL_ODA_FORWARD_SPENDING) || Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_CRS))) { if (validatable.getValue() != null && validatable.getValue().getCode().equals(CategoryConstants.TypeOfFlow.ODA)) return; ValidationError error = new ValidationError(this); validatable.error(decorate(error, validatable)); }/*w w w .j a va2s . c om*/ }
From source file:org.devgateway.eudevfin.ui.common.validators.Field12CodeValidator.java
License:Open Source License
@Override public void validate(IValidatable<Category> validatable) { if (!Strings.isEmpty(transactionType)) { if (validatable.getValue() != null && validatable.getValue().isLastAncestor()) { ValidationError error = new ValidationError(this); validatable.error(decorateParentError(error, validatable)); }/* w ww .j a v a 2s. co m*/ } if ((Strings.isEqual(transactionType, SB.BILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_ADVANCE_QUESTIONNAIRE))) { // Check value against pattern if (validatable.getValue() != null && pattern.matcher(validatable.getValue().getDisplayableCode()).matches() == reverse) { ValidationError error = new ValidationError(this); error.setVariable("pattern", pattern.pattern()); validatable.error(decorate(error, validatable)); } } }
From source file:org.devgateway.eudevfin.ui.common.validators.Field8CodeValidator.java
License:Open Source License
@Override public void validate(IValidatable<Category> validatable) { if (!Strings.isEmpty(transactionType) && (Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_CRS))) { // Check value against pattern if (validatable.getValue() != null && pattern.matcher(validatable.getValue().getCode()).matches() == reverse) { ValidationError error = new ValidationError(this); error.setVariable("pattern", pattern.pattern()); validatable.error(decorate(error, validatable)); }//from w w w . j a va2 s . c om } }
From source file:org.devgateway.eudevfin.ui.common.validators.MultilateralField10CodeValidator.java
License:Open Source License
@Override public void validate(IValidatable<Category> validatable) { if (!Strings.isEmpty(transactionType) && (Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_ADVANCE_QUESTIONNAIRE) || Strings.isEqual(transactionType, SB.MULTILATERAL_ODA_CRS))) { if (validatable.getValue() != null && validatable.getValue().getCode().equals(CategoryConstants.BiMultilateral.BI_MULTILATERAL_2)) return; ValidationError error = new ValidationError(this); validatable.error(decorate(error, validatable)); }/*from www . j a v a 2 s. co m*/ }