-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from devgateway/master-updates
Master updates
- Loading branch information
Showing
74 changed files
with
894 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ateway/toolkit/forms/wicket/components/form/OptionallyRequiredTextAreaFieldComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright (c) 2015 Development Gateway, Inc and others. | ||
* <p> | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the MIT License (MIT) | ||
* which accompanies this distribution, and is available at | ||
* https://opensource.org/licenses/MIT | ||
* <p> | ||
* Contributors: | ||
* Development Gateway - initial API and implementation | ||
*/ | ||
/** | ||
* | ||
*/ | ||
package org.devgateway.toolkit.forms.wicket.components.form; | ||
|
||
import org.apache.wicket.markup.html.form.TextArea; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.validation.validator.StringValidator; | ||
import org.devgateway.toolkit.forms.WebConstants; | ||
|
||
/** | ||
* @author mpostelnicu | ||
* | ||
* A {@link TextAreaFieldBootstrapFormComponent} that has TextArea{@link #isRequired()} exposed | ||
* | ||
*/ | ||
public abstract class OptionallyRequiredTextAreaFieldComponent<TYPE> extends TextAreaFieldBootstrapFormComponent<TYPE> { | ||
private StringValidator validator = WebConstants.StringValidators.MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXTAREA; | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public OptionallyRequiredTextAreaFieldComponent(final String id, final IModel<String> labelModel, | ||
final IModel<TYPE> model) { | ||
super(id, labelModel, model); | ||
} | ||
|
||
public OptionallyRequiredTextAreaFieldComponent(final String id, final IModel<String> labelModel) { | ||
super(id, labelModel, null); | ||
} | ||
|
||
/** | ||
* @param id | ||
*/ | ||
public OptionallyRequiredTextAreaFieldComponent(final String id) { | ||
super(id); | ||
} | ||
|
||
public abstract boolean isRequired(); | ||
|
||
@Override | ||
protected TextArea<TYPE> inputField(final String id, final IModel<TYPE> model) { | ||
TextArea<TYPE> textArea = new TextArea<TYPE>(id, initFieldModel()) { | ||
@Override | ||
public boolean isRequired() { | ||
return OptionallyRequiredTextAreaFieldComponent.this.isRequired(); | ||
} | ||
}; | ||
return textArea; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.