本文整理汇总了Java中org.apache.wicket.markup.html.form.ChoiceRenderer类的典型用法代码示例。如果您正苦于以下问题:Java ChoiceRenderer类的具体用法?Java ChoiceRenderer怎么用?Java ChoiceRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChoiceRenderer类属于org.apache.wicket.markup.html.form包,在下文中一共展示了ChoiceRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DocumentListPanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public DocumentListPanel(String aId, IModel<Project> aProject)
{
super(aId);
setOutputMarkupId(true);
project = aProject;
selectedDocuments = new CollectionModel<>();
Form<Void> form = new Form<>("form");
add(form);
overviewList = new ListMultipleChoice<>("documents");
overviewList.setChoiceRenderer(new ChoiceRenderer<>("name"));
overviewList.setModel(selectedDocuments);
overviewList.setChoices(LambdaModel.of(this::listSourceDocuments));
form.add(overviewList);
confirmationDialog = new ConfirmationDialog("confirmationDialog");
confirmationDialog.setTitleModel(new StringResourceModel("DeleteDialog.title", this));
add(confirmationDialog);
form.add(new LambdaAjaxButton<>("delete", this::actionDelete));
}
示例2: onInitialize
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
Form form = new Form<String>("form");
Model<ModuleEntity> model = new Model<>(SingularSession.get().getCategoriaSelecionada());
final DropDownChoice<ModuleEntity> select = new DropDownChoice<>("select", model, categorias,
new ChoiceRenderer<>("name", "cod"));
form.add(select);
select.add(new BSSelectInitBehaviour());
select.add(new FormComponentAjaxUpdateBehavior("change", (target, component) -> {
final ModuleEntity categoriaSelecionada = (ModuleEntity) component.getDefaultModelObject();
SingularSession.get().setCategoriaSelecionada(categoriaSelecionada);
getPage().getPageParameters().set(MODULE_PARAM_NAME, categoriaSelecionada.getCod());
final BoxConfigurationData boxConfigurationMetadataDTO = getDefaultMenuSelection(categoriaSelecionada);
if (boxConfigurationMetadataDTO != null) {
getPage().getPageParameters().set(MENU_PARAM_NAME, boxConfigurationMetadataDTO.getLabel());
} else {
getPage().getPageParameters().remove(MENU_PARAM_NAME);
}
setResponsePage(getPage().getClass(), getPage().getPageParameters());
}));
add(form);
}
示例3: buildFilterExpressionOperatorDropDownChoice
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
private void buildFilterExpressionOperatorDropDownChoice() {
this.filterExpressionOperator = (FilterExpressionOperatorEnum) this.element.getValue();
final DropDownChoice<FilterExpressionOperatorEnum> filterExpressionOperatorDropDownChoice = new DropDownChoice<FilterExpressionOperatorEnum>("filterExpressionOperatorDropDownChoice", new PropertyModel<FilterExpressionOperatorEnum>(this, "filterExpressionOperator"), Arrays.asList(FilterExpressionOperatorEnum.values()), new ChoiceRenderer<FilterExpressionOperatorEnum>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(final FilterExpressionOperatorEnum element) {
return element.getValue();
}
});
filterExpressionOperatorDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -5452061293278720695L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
FilterExpressionPanel.this.element.setValue(FilterExpressionPanel.this.filterExpressionOperator);
FilterExpressionPanel.this.table.getSelectedElements().remove(FilterExpressionPanel.this.element);
target.add(FilterExpressionPanel.this.table);
}
});
filterExpressionOperatorDropDownChoice.setOutputMarkupId(true);
this.layoutForm.add(filterExpressionOperatorDropDownChoice);
}
示例4: makeUserChoiceRenderer
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
private IChoiceRenderer<User> makeUserChoiceRenderer()
{
return new ChoiceRenderer<User>()
{
private static final long serialVersionUID = 4607720784161484145L;
@Override
public Object getDisplayValue(User aObject)
{
List<ProjectPermission> projectPermissions = projectRepository
.listProjectPermissionLevel(aObject, projectModel.getObject());
List<String> permissionLevels = new ArrayList<>();
for (ProjectPermission projectPermission : projectPermissions) {
permissionLevels.add(projectPermission.getLevel().getName());
}
return aObject.getUsername() + " " + permissionLevels
+ (aObject.isEnabled() ? "" : " (login disabled)");
}
};
}
示例5: TagSetSelectionPanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public TagSetSelectionPanel(String id, IModel<Project> aProject, IModel<TagSet> aTagset)
{
super(id, aProject);
setOutputMarkupId(true);
setOutputMarkupPlaceholderTag(true);
selectedProject = aProject;
overviewList = new OverviewListChoice<>("tagset");
overviewList.setChoiceRenderer(new ChoiceRenderer<>("name"));
overviewList.setModel(aTagset);
overviewList.setChoices(LambdaModel.of(this::listTagSets));
overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange));
add(overviewList);
add(new LambdaAjaxLink("create", this::actionCreate));
}
示例6: TagSelectionPanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public TagSelectionPanel(String id, IModel<TagSet> aTagset, IModel<Tag> aTag)
{
super(id, aTagset);
setOutputMarkupId(true);
setOutputMarkupPlaceholderTag(true);
selectedTagSet = aTagset;
overviewList = new OverviewListChoice<>("tag");
overviewList.setChoiceRenderer(new ChoiceRenderer<>("name"));
overviewList.setModel(aTag);
overviewList.setChoices(LambdaModel.of(this::listTags));
overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange));
add(overviewList);
add(new LambdaAjaxLink("create", this::actionCreate));
}
示例7: ProjectCasDoctorPanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public ProjectCasDoctorPanel(String id, IModel<Project> aProjectModel)
{
super(id, aProjectModel);
setOutputMarkupId(true);
Form<FormModel> form = new Form<>("casDoctorForm", PropertyModel.of(this, "formModel"));
add(form);
CheckBoxMultipleChoice<Class<? extends Repair>> repairs = new CheckBoxMultipleChoice<>(
"repairs");
repairs.setModel(PropertyModel.of(this, "formModel.repairs"));
repairs.setChoices(CasDoctor.scanRepairs());
repairs.setChoiceRenderer(new ChoiceRenderer<>("simpleName"));
repairs.setPrefix("<div class=\"checkbox\">");
repairs.setSuffix("</div>");
repairs.setLabelPosition(LabelPosition.WRAP_AFTER);
form.add(repairs);
form.add(new LambdaAjaxButton<FormModel>("check", this::actionCheck));
form.add(new LambdaAjaxButton<FormModel>("repair", this::actionRepair));
add(createMessageSetsView());
}
示例8: UserSelectionPanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public UserSelectionPanel(String id, IModel<User> aModel)
{
super(id);
overviewList = new OverviewListChoice<>("user");
overviewList.setChoiceRenderer(new ChoiceRenderer<User>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(User aUser)
{
return aUser.getUsername() + (aUser.isEnabled() ? "" : " (disabled)");
}
});
overviewList.setModel(aModel);
overviewList.setChoices(LambdaModel.of(this::listUsers));
overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change", this::onChange));
add(overviewList);
add(new LambdaAjaxLink("create", this::actionCreate));
}
示例9: initComponentsApplicationSelect
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
private void initComponentsApplicationSelect(WebMarkupContainer selectApplicationContainer) {
List<Application> appList = new ArrayList<>();
if (showApplicationSelection) {
if (app == null) {
appList = (List<Application>) manageApplication.findMyApplications();
} else {
appList = Arrays.asList(app);
}
}
ChoiceRenderer<Application> choiceRenderer = new ChoiceRenderer<Application>("label", "uid");
applicationDropDownChoice = new DropDownChoice<Application>("application", appList, choiceRenderer);
if (app != null) {
applicationDropDownChoice.setEnabled(false);
}
// app required
applicationDropDownChoice.setRequired(true);
applicationDropDownChoice.add(new PropertyValidator<>());
selectApplicationContainer.add(applicationDropDownChoice);
selectApplicationContainer.add(new CacheActivatedImage("applicationHelp",new ResourceModel("image.help").getObject()));
}
示例10: AddCriteriaForm
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
/**
* @param id
* The wicket:id component ID of this form.
*/
public AddCriteriaForm(String id) {
super(id, new CompoundPropertyModel<ElementCrit>(new ElementCrit()));
List<Element> ptypeElements = fm.safeGetElementsForProductType(type);
Collections.sort(ptypeElements, new Comparator<Element>() {
public int compare(Element e1, Element e2) {
return e1.getElementName().compareTo(e2.getElementName());
}
});
add(new DropDownChoice<Element>("criteria_list", new PropertyModel(
getDefaultModelObject(), "elem"), new ListModel<Element>(
ptypeElements), new ChoiceRenderer<Element>("elementName",
"elementId")));
add(new TextField<TermQueryCriteria>(
"criteria_form_add_element_value",
new PropertyModel<TermQueryCriteria>(getDefaultModelObject(), "value")));
add(new Button("criteria_elem_add"));
}
示例11: initLayout
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
protected void initLayout() {
TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), ID_NAME),
createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
add(name);
TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION,
new PropertyModel<String>(getModel(), ID_DESCRIPTION),
createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
add(description);
IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
IChoiceRenderer renderer = new EnumChoiceRenderer();
DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new PropertyModel<ExportType>(getModel(), ReportDto.F_EXPORT_TYPE), choices, renderer,
createStringResource("ReportType.export"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
add(exportType);
TextFormGroup virtualizerKickOn = null;
DropDownFormGroup virtualizer = new DropDownFormGroup(ID_VIRTUALIZER, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER),
createVirtualizerListModel(), new ChoiceRenderer<String>(),
createStringResource("ReportType.virtualizer"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
//virtualizer.add(new VirtualizerAjaxFormUpdatingBehaviour(virtualizerKickOn));
add(virtualizer);
virtualizerKickOn = new TextFormGroup(ID_VIRTUALIZER_KICKON, new PropertyModel<String>(getModel(), ReportDto.F_VIRTUALIZER_KICKON),
createStringResource("ReportType.virtualizerKickOn"), ID_LABEL_SIZE, "col-md-4", false);
add(virtualizerKickOn);
TextFormGroup maxPages = new TextFormGroup(ID_MAXPAGES, new PropertyModel<String>(getModel(), ReportDto.F_MAXPAGES),
createStringResource("ReportType.maxPages"), ID_LABEL_SIZE, "col-md-4", false);
add(maxPages);
TextFormGroup timeout = new TextFormGroup(ID_TIMEOUT, new PropertyModel<String>(getModel(), ReportDto.F_TIMEOUT),
createStringResource("ReportType.timeout"), ID_LABEL_SIZE, "col-md-4", false);
add(timeout);
}
示例12: addUsersDropDownChoice
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
private void addUsersDropDownChoice() {
IModel<List<Actor>> actorsModel = $m.get(() -> moduleDriver.findEligibleUsers(moduleEntity.getObject(),
dataModel.getObject(), itemAction.getConfirmation()));
usersDropDownChoice = new DropDownChoice<>("usersDropDownChoice",
new Model<>(),
actorsModel,
new ChoiceRenderer<>("nome", "codUsuario"));
usersDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("change") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(confirmButton);
}
});
border.add(usersDropDownChoice);
}
示例13: buildAttributeDropDownChoice
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
private void buildAttributeDropDownChoice() {
this.attributeDropDownChoice = new DropDownChoice<TypeTreeNode>("attributeDropDownChoice", new Model<TypeTreeNode>(), new ArrayList<TypeTreeNode>(), new ChoiceRenderer<TypeTreeNode>() {
private static final long serialVersionUID = 1L;
@Override
public Object getDisplayValue(final TypeTreeNode attribute) {
return attribute.getAttributeExpression();
}
}) {
private static final long serialVersionUID = 474559809405809953L;
@Override
public boolean isEnabled() {
return AttributeSelectionPanel.this.allComponentsEnabled && AttributeSelectionPanel.this.eventTypeElementDropDownChoice.getModelObject() != null && !AttributeSelectionPanel.this.currentDateUsed;
}
};
this.attributeDropDownChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
if (AttributeSelectionPanel.this.attributeDropDownChoice.getModelObject() != null) {
AttributeSelectionPanel.this.updateExpressionFromDropDownChoice();
AttributeSelectionPanel.this.attributeIdentifiersAndExpressions.put(AttributeSelectionPanel.this.attributeIdentifier, AttributeSelectionPanel.this.expressionFromDropDownChoices);
}
}
});
this.attributeDropDownChoice.setEnabled(false);
this.attributeDropDownChoice.setOutputMarkupId(true);
this.layoutForm.add(this.attributeDropDownChoice);
}
示例14: OcciRequestPanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public OcciRequestPanel(String id, IModel<MethodModel> methodModel, IModel<OcciRepresentationModel> representationModel) {
super(id);
OcciRepresentationModel representation = representationModel.getObject();
// KIND
KindModel kindModel = representation.getKind();
if (null != kindModel) {
this.add(new KindRequestPanel("kindPanel", methodModel, new Model<>(kindModel)));
} else {
this.add(new EmptyPanel("kindPanel"));
}
// MIXINs
this.add(new MixinListRequestPanel("mixinListPanel", methodModel, new ListModel<>(representation.getMixins())));
// LINKs
this.linkListPanel = new LinkListRequestPanel("linkListPanel", methodModel, new ListModel<>(representation.getLinks()));
this.linkListPanel.setOutputMarkupId(true);
this.add(this.linkListPanel);
Form linkForm = new Form("linkForm");
this.add(linkForm);
DropDownChoice<LinkModel> linkChoice = new DropDownChoice<>("linkSelect", new Model<>(),
representation.getLinkDefinitions(), new ChoiceRenderer<>("id"));
linkForm.add(linkChoice);
linkForm.add(new AjaxButton("addLink") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
representation.addToLinkList(linkChoice.getModelObject());
target.add(OcciRequestPanel.this.linkListPanel);
}
});
linkForm.setVisible(!representation.getLinkDefinitions().isEmpty());
}
示例15: AjaxDropDownChoicePanel
import org.apache.wicket.markup.html.form.ChoiceRenderer; //导入依赖的package包/类
public AjaxDropDownChoicePanel(
final String id,
final String name,
final IModel<T> model,
final boolean active,
final boolean nullValid) {
super(id, name, model, active);
field = new DropDownChoice("dropDownChoiceField", model,
Collections.EMPTY_LIST, new ChoiceRenderer());
((DropDownChoice) field).setNullValid(nullValid);
add(field.setLabel(new Model(name)).setOutputMarkupId(true));
if (active) {
field.add(new AjaxFormComponentUpdatingBehavior("onblur") {
private static final long serialVersionUID =
-1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
// nothing to do
}
});
}
}