本文整理汇总了Java中org.apache.wicket.markup.html.form.FormComponent.add方法的典型用法代码示例。如果您正苦于以下问题:Java FormComponent.add方法的具体用法?Java FormComponent.add怎么用?Java FormComponent.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.markup.html.form.FormComponent
的用法示例。
在下文中一共展示了FormComponent.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAccessBehaviour
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private void initAccessBehaviour(InputPanel panel) {
List<FormComponent> components = panel.getFormComponents();
for (FormComponent component : components) {
component.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled() {
ValueWrapper wrapper = valueWrapperModel.getObject();
ItemWrapper itemWrapper = wrapper.getItem();
if (valueWrapperModel.getObject().isReadonly()) {
return false;
}
if (itemWrapper.getContainer() == null) {
return true; // TODO
}
ObjectWrapper object = itemWrapper.getContainer().getObject();
ItemDefinition def = itemWrapper.getItem().getDefinition();
return object == null || isAccessible(def, object.getStatus());
}
});
}
}
示例2: createTextPanel
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private <J> Component createTextPanel(String componentId, final IModel<J> model, String expression,
final Boolean mandatory) {
TextPanel<String> textPanel = new TextPanel<String>(componentId, new PropertyModel<String>(model, expression));
FormComponent input = textPanel.getBaseFormComponent();
input.add(new AttributeAppender("style", "width: 100%"));
input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
input.add(new IValidator() {
private static final long serialVersionUID = 1L;
@Override
public void validate(IValidatable validatable) {
if (!mandatory) {
return;
}
if (validatable.getValue() == null) {
validatable.error(new ValidationError("JasperReportConfigurationPanel.errormsg"));
}
}
});
return textPanel;
}
示例3: configure
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
public boolean configure(final IHtmlElement<?, ?> e, final Component c) {
if (e.isModelElement() && !(e.getModelElement() instanceof TableHtmlElement)) {
c.add(new ModelComponentBehavior(e, c, e.getTargetObjectModel()));
}
final FormComponent<?> formComponent = Components.asFormComponent(c);
if (formComponent != null) {
if (e.isModelElement()) {
formComponent.setLabel(e.getTitleModel());
}
if (e.getContext().isUseSqlInjectionValidation()) {
formComponent.add(new SQLInjectionValidator(c));
}
if (e.getModelElement().getBeanPathElement().isProperty()) {
FormComponentAwarePropertyResolver.maybeRegisterElement(e, c, formComponent);
formComponent.add(new ModelPropertyValidator(c));
}
}
c.setOutputMarkupId(true);
return true;
}
示例4: newCheckBox
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
protected FormComponent<Boolean> newCheckBox(String id, IModel<Boolean> model, final T rowObject) {
final FormComponent<Boolean> checkbox = super.newCheckBox(id, model, rowObject);
checkbox.add(new AjaxFormComponentUpdatingBehavior("onclick") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
Boolean checked = checkbox.getModelObject();
AjaxCheckboxColumn.this.onUpdate(checkbox, rowObject, checked, target);
}
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return AjaxCheckboxColumn.this.getAjaxCallDecorator();
}
});
return checkbox;
}
示例5: createTypedInputPanel
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private InputPanel createTypedInputPanel(String componentId, IModel<JasperReportValueDto> model, String expression, JasperReportParameterDto param) {
InputPanel panel;
Class<?> type;
try {
if (param.isMultiValue()) {
type = param.getNestedType();
} else {
type = param.getType();
}
} catch (ClassNotFoundException e) {
getSession().error("Could not find parameter type definition. Check the configuration.");
throw new RestartResponseException(getPageBase());
}
if (type.isEnum()) {
panel = WebComponentUtil.createEnumPanel(type, componentId, new PropertyModel<>(model, expression), this);
} else if (XMLGregorianCalendar.class.isAssignableFrom(type)) {
panel = new DatePanel(componentId, new PropertyModel<>(model, expression));
} else if (param.getProperties() != null && param.getProperties().getTargetType() != null) { // render autocomplete box
LookupTableType lookup = new LookupTableType();
panel = new AutoCompleteTextPanel<String>(componentId, new LookupReportPropertyModel(model, expression, lookup, true), String.class) {
private static final long serialVersionUID = 1L;
@Override
public Iterator<String> getIterator(String input) {
return prepareAutoCompleteList(input, lookup, param).iterator();
}
};
} else {
panel = new TextPanel<>(componentId, new PropertyModel<>(model, expression), type);
}
List<FormComponent> components = panel.getFormComponents();
for (FormComponent component : components) {
component.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
}
panel.setOutputMarkupId(true);
return panel;
}
示例6: AttributeInputPanel
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public AttributeInputPanel(String markupId, IModel<AttributeModel> attributeModel) {
super(markupId);
this.attributeModel = attributeModel;
AttributeModel attribute = attributeModel.getObject();
// attribute name
this.nameLabel = new Label("attributeName", Model.of(attribute.getName() + (attribute.isRequired() ? "*" : "")));
this.nameLabel.setOutputMarkupId(true);
this.add(this.nameLabel);
// attribute description
Label descriptionLabel = new Label("attributeDescription");
if (null == attribute.getDescription() || attribute.getDescription().trim().isEmpty()) {
descriptionLabel.setVisible(false);
} else {
descriptionLabel.setDefaultModel(Model.of(attribute.getDescription()));
}
this.add(descriptionLabel);
// attribute input
AbstractFormComponentPanel inputPanel = newInputPanel("inputPanel", attribute);
this.add(inputPanel);
FormComponent inputFormComponent = inputPanel.getFormComponent();
inputFormComponent.setRequired(attribute.isRequired());
inputFormComponent.add(new AjaxFormComponentValidationBehavior("blur", this.nameLabel));
if (attribute.isRequired() && !attribute.hasValue()) {
this.nameLabel.add(new AjaxFormComponentValidationBehavior.InvalidAttributeModifier());
}
}
示例7: get
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public static IFormComponentChangeObservable get(FormComponent<?> component) {
FormComponentChangeAjaxEventBehavior ajaxEventBehavior = getExisting(component);
if (ajaxEventBehavior == null) {
ajaxEventBehavior = new FormComponentChangeAjaxEventBehavior((FormComponent<?>)component);
component.add(ajaxEventBehavior);
}
return ajaxEventBehavior;
}
示例8: maybeAddValidator
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public static void maybeAddValidator(final IHtmlElement<?, ?> element, final Component component) {
final FormComponent<?> formComponent = Components.asFormComponent(component);
if (formComponent != null) {
if (element.getModelElement().getBeanPathElement() instanceof IValidatableBeanPathElement) {
final IValidatableBeanPathElement cElement = (IValidatableBeanPathElement) element.getModelElement()
.getBeanPathElement();
if (cElement.getValidateElement() != null) {
//need to remember original component instead of formComponent for IFormComponentAware
formComponent.add(new ModelUtilityValidator(element, component));
}
}
}
}
示例9: newEditor
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
protected FormComponent newEditor(MarkupContainer parent, String componentId, IModel model) {
FormComponent editor = super.newEditor(parent, componentId, model);
editor.add(autocomplete);
return editor;
}
示例10: newGeneratePomCheckBox
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private Component newGeneratePomCheckBox() {
FormComponent checkbox = new StyledCheckbox("deployPom");
checkbox.setOutputMarkupId(true);
checkbox.setVisible(!isPomArtifact() && !hasClassifier());
checkbox.setLabel(Model.of("Also Deploy Jar's Internal POM/Generate Default POM"));
checkbox.add(new OnGeneratePomChangeBehavior());
return checkbox;
}
示例11: newGavcField
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private Component newGavcField(String id, boolean required, Behavior behavior) {
FormComponent textField = new TextField(id);
textField.setRequired(required);
textField.setOutputMarkupId(true);
textField.add(behavior);
return textField;
}
示例12: RemoteRepoImportPanel
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public RemoteRepoImportPanel(CachingDescriptorHelper cachingDescriptorHelper) {
setWidth(740);
add(new CssClass("import-remote-repos"));
Form loadForm = new SecureForm("loadForm");
add(loadForm);
MarkupContainer loadBorder = new TitledBorder("loadBorder");
loadForm.add(loadBorder);
loadBorder.add(new HelpBubble("urlHelp",
"Enter the base URL of another Artifactory server you want to import repository definitions from."));
FormComponent<String> urlTextField = new TextField<>("url", new PropertyModel<String>(this, "url"));
urlTextField.add(new UriValidator("http", "https"));
setPersistent(urlTextField);
urlTextField.setOutputMarkupId(true);
urlTextField.setRequired(true);
urlTextField.setDefaultModelObject("http://repo.jfrog.org/artifactory");
loadBorder.add(urlTextField);
loadBorder.add(getLoadButton(loadForm));
Form listForm = new SecureForm("listForm");
add(listForm);
MarkupContainer listBorder = new TitledBorder("listBorder");
listForm.add(listBorder);
createRepositoryList(listBorder);
add(new ModalCloseLink("cancel"));
//Submit button
importButton = getImportButton(cachingDescriptorHelper, listForm);
importButton.setOutputMarkupId(true);
add(importButton);
listForm.add(new DefaultButtonBehavior(importButton));
}
示例13: changeCssClass
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
/**
* Changes the CSS class of the linked {@link FormComponent} via AJAX.
*
* @param ajaxRequestTarget of type AjaxRequestTarget
* @param valid Was the validation succesful?
* @param cssClass The CSS class that must be set on the linked {@link FormComponent}
*/
private void changeCssClass(AjaxRequestTarget ajaxRequestTarget, boolean valid, String cssClass) {
FormComponent formComponent = getFormComponent();
if(formComponent.isValid() == valid){
formComponent.add(new AttributeModifier("class", true, new Model("formInputField " + cssClass)));
ajaxRequestTarget.add(formComponent);
}
if(updateComponent!=null){
ajaxRequestTarget.add(updateComponent);
}
}
示例14: addPropertyValidator
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
/**
* Add a property validator to the component if it does not already have one
* and the component is using an appropriate model, e.g. PropertyModel.
*
* @param fc
*/
private void addPropertyValidator(FormComponent<T> fc) {
if (!hasPropertyValidator(fc)) {
final PropertyValidator<T> propertyValidator = new PropertyValidator<>();
fc.add(propertyValidator);
}
}
示例15: addAjaxFormComponentUpdatingBehavior
import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private void addAjaxFormComponentUpdatingBehavior(FormComponent component){
component.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {}
});
}