-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dgtkit-3.x' into #356-modal-3
- Loading branch information
Showing
57 changed files
with
2,147 additions
and
470 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
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
64 changes: 64 additions & 0 deletions
64
...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,64 @@ | ||
/** | ||
* 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 boolean isRequired() { | ||
return false; | ||
} | ||
|
||
@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; | ||
} | ||
|
||
} |
Oops, something went wrong.