本文整理汇总了Java中org.apache.wicket.markup.html.form.RadioGroup类的典型用法代码示例。如果您正苦于以下问题:Java RadioGroup类的具体用法?Java RadioGroup怎么用?Java RadioGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RadioGroup类属于org.apache.wicket.markup.html.form包,在下文中一共展示了RadioGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAndAddRepoConfigDockerSection
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
@Override
public void createAndAddRepoConfigDockerSection(Form form, RepoDescriptor repoDescriptor, boolean isCreate) {
WebMarkupContainer dockerSection = new WebMarkupContainer("dockerSupportSection");
dockerSection.add(new TitledBorderBehavior("fieldset-border", "Docker"));
dockerSection.add(new DisabledAddonBehavior(AddonType.DOCKER));
dockerSection.add(new StyledCheckbox("enableDockerSupport").setTitle("Enable Docker Support").setEnabled(false));
dockerSection.add(new SchemaHelpBubble("enableDockerSupport.help"));
Label label = new Label("dockerRepoUrlLabel", "");
label.setVisible(false);
dockerSection.add(label);
if (repoDescriptor instanceof LocalRepoDescriptor) {
final RadioGroup dockerApiVersion = new RadioGroup("dockerApiVersion");
dockerApiVersion.add(new Radio<>("v1", Model.of(DockerApiVersion.V1)));
dockerApiVersion.add(new HelpBubble("v1.help", "Support Docker V1 API"));
dockerApiVersion.add(new Radio<>("v2", Model.of(DockerApiVersion.V2)));
dockerApiVersion.add(new HelpBubble("v2.help", "Support Docker V2 API"));
dockerSection.add(dockerApiVersion);
} else if (repoDescriptor instanceof RemoteRepoDescriptor) {
dockerSection.add(new StyledCheckbox("dockerTokenAuthentication").setTitle("Enable Token Authentication").setEnabled(false));
dockerSection.add(new SchemaHelpBubble("dockerTokenAuthentication.help"));
}
form.add(dockerSection);
}
示例2: ItemsForm
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
public ItemsForm(String markupId, IModel<List<String>> discoItems) {
super(markupId);
radioGroup = new RadioGroup<String>("radioGroup", new Model<>());
radioGroup.add(new ListView<String>("radioView", discoItems) {
@Override
protected void populateItem(ListItem<String> listItem) {
listItem.add(new Radio<>("radioItem", listItem.getModel()));
listItem.add(new Label("radioLabel", listItem.getModelObject()));
}
});
this.add(radioGroup);
this.add(new AjaxButton("connectBtn") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
String domain = radioGroup.getDefaultModelObjectAsString();
if (null != domain && !domain.trim().isEmpty()) {
String path = "";
if (domain.contains("root")) {
path = "/iaas";
} else if (domain.contains("gateway")) {
path = "/compute";
}
try {
setResponsePage(new BrowserPage(Model.of(new XmppURI(domain, path))));
} catch (URISyntaxException e) {
logger.error("Failed to parse xmpp uri. entity: " + domain + ", resource: " + path);
}
} else {
target.appendJavaScript("alert('Please select a value from the radio group!');");
}
}
});
}
示例3: getComponentsToDecorateWithCSS
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private static List<? extends Component> getComponentsToDecorateWithCSS(FormComponent<?> formComponent) {
if (formComponent.getParent().getMetaData(FORM_GROUP) != null) {
return ImmutableList.of(formComponent.getParent());
} else if (formComponent instanceof RadioGroup) {
return collect(formComponent, Radio.class);
} else if (formComponent instanceof CheckGroup) {
return collect(formComponent, Check.class);
} else {
return ImmutableList.of(formComponent);
}
}
示例4: PollAnswerForm
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
PollAnswerForm(String id, IModel<RoomPollAnswer> model) {
super(id, model);
add(feedback);
add(new Label("user", user));
add(new Label("roomPoll.question"));
add(typeBool.add(new RadioGroup<Boolean>("answer").setRequired(true)
.add(new Radio<>("true", Model.of(Boolean.TRUE))).add(new Radio<>("false", Model.of(Boolean.FALSE)))
).setOutputMarkupPlaceholderTag(true).setVisible(false));
add(typeInt.add(new DropDownChoice<>("pointList", answers).setRequired(true))
.setOutputMarkupPlaceholderTag(true).setVisible(false));
}
示例5: getGroup
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected RadioGroup<T> getGroup() {
RadioGroup<T> group = this.group;
if (group == null) {
group = findParent(RadioGroup.class);
if (group == null) {
throw new WicketRuntimeException(
"Radio component [" +
getPath() +
"] cannot find its parent RadioGroup. All Radio components must be a child of or below in the hierarchy of a RadioGroup component.");
}
}
return group;
}
示例6: isChecked
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private boolean isChecked() {
final RadioGroup<T> group = getGroup();
if (group.hasRawInput()) {
String rawInput = group.getRawInput();
if (rawInput != null && rawInput.equals(radio.getValue())) {
return true;
}
} else if (group.getModelComparator().compare(group, getDefaultModelObject())) {
return true;
}
return false;
}
示例7: addRadioButtons
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private void addRadioButtons()
{
radioGroup = new RadioGroup( "searchOptions", new PropertyModel( this, "selectedRadioButton" ) );
AjaxFormComponentUpdatingBehavior ajaxRadioUpdater = new AjaxFormChoiceComponentUpdatingBehavior()
{
/** Default serialVersionUID */
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate( final AjaxRequestTarget target )
{
processRadioButton( target );
}
};
radioGroup.add( ajaxRadioUpdater );
add( radioGroup );
Radio userRb = new Radio( "userRb", new Model( USERS ) );
radioGroup.add( userRb );
Radio roleRb = new Radio( "roleRb", new Model( ROLES ) );
radioGroup.add( roleRb );
Radio adminRoleRb = new Radio( "adminRoleRb", new Model( ADMIN_ROLES ) );
radioGroup.add( adminRoleRb );
Radio ouRb = new Radio( "ouRb", new Model( OUS ) );
radioGroup.add( ouRb );
Radio permRb = new Radio( "permRb", new Model( PERMS ) );
radioGroup.add( permRb );
radioGroup.setOutputMarkupId( true );
radioGroup.setRenderBodyOnly( false );
userformsearchfields.add( radioGroup );
selectedRadioButton = USERS;
addRoleSearchModal( roleRb );
addAdminRoleSearchModal( adminRoleRb );
addOUSearchModal( ouRb );
addPermSearchModal( permRb );
}
示例8: onInitialize
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
@Override
public void onInitialize() {
super.onInitialize();
//points/percentage entry
RadioGroup<Integer> gradeEntry = new RadioGroup<>("gradeEntry", new PropertyModel<Integer>(model, "gradebookInformation.gradeType"));
gradeEntry.add(new Radio<>("points", new Model<>(1)));
gradeEntry.add(new Radio<>("percentages", new Model<>(2)));
add(gradeEntry);
}
示例9: isRadioChecked
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
/**
* Returns true if the given checkbox is checked. Works whether or not
* the form has been submitted.
*/
public static boolean isRadioChecked(Radio<?> radio) {
Form<?> form = radio.findParent(Form.class);
RadioGroup<?> radioGroup = radio.findParent(RadioGroup.class);
if (form != null && form.isSubmitted()) {
// After form post
return Strings.isEqual(radioGroup.getInput(), radio.getValue());
} else {
// Initial display, before the form is posted
Object o1 = radioGroup.getDefaultModelObject();
return o1 != null && o1.equals(radio.getDefaultModelObject());
}
}
示例10: RadioGroupPanel
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
/**
* @param id
* @param model
* @param labelString
*/
public RadioGroupPanel(final String id, final String groupName, final IModel<T> model)
{
super(id);
radioGroup = new RadioGroup<T>("radioGroup", model) {
/**
* @see org.apache.wicket.markup.html.form.RadioGroup#wantOnSelectionChangedNotifications()
*/
@Override
protected boolean wantOnSelectionChangedNotifications()
{
return RadioGroupPanel.this.wantOnSelectionChangedNotifications();
}
/**
* @see org.apache.wicket.markup.html.form.RadioGroup#onSelectionChanged(java.lang.Object)
*/
@Override
protected void onSelectionChanged(final Object newSelection)
{
RadioGroupPanel.this.onSelectionChanged(newSelection);
}
};
add(radioGroup);
radioGroup.add(repeater = new RepeatingView("repeater"));
setRenderBodyOnly(true);
}
示例11: initLayout
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
final WebMarkupContainer input = new WebMarkupContainer(ID_INPUT);
input.setOutputMarkupId(true);
mainForm.add(input);
final WebMarkupContainer buttonBar = new WebMarkupContainer(ID_BUTTON_BAR);
buttonBar.setOutputMarkupId(true);
mainForm.add(buttonBar);
final IModel<Integer> groupModel = new Model<Integer>(INPUT_FILE);
RadioGroup importRadioGroup = new RadioGroup(ID_IMPORT_RADIO_GROUP, groupModel);
importRadioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(input);
target.add(buttonBar);
}
});
mainForm.add(importRadioGroup);
Radio fileRadio = new Radio(ID_FILE_RADIO, new Model(INPUT_FILE), importRadioGroup);
importRadioGroup.add(fileRadio);
Radio xmlRadio = new Radio(ID_XML_RADIO, new Model(INPUT_XML), importRadioGroup);
importRadioGroup.add(xmlRadio);
WebMarkupContainer inputAce = new WebMarkupContainer(ID_INPUT_ACE);
addVisibileForInputType(inputAce, INPUT_XML, groupModel);
input.add(inputAce);
AceEditor aceEditor = new AceEditor(ID_ACE_EDITOR, xmlEditorModel);
aceEditor.setOutputMarkupId(true);
inputAce.add(aceEditor);
WebMarkupContainer inputFileLabel = new WebMarkupContainer(ID_INPUT_FILE_LABEL);
addVisibileForInputType(inputFileLabel, INPUT_FILE, groupModel);
input.add(inputFileLabel);
WebMarkupContainer inputFile = new WebMarkupContainer(ID_INPUT_FILE);
addVisibileForInputType(inputFile, INPUT_FILE, groupModel);
input.add(inputFile);
FileUploadField fileInput = new FileUploadField(ID_FILE_INPUT);
inputFile.add(fileInput);
initButtons(buttonBar, groupModel);
}
示例12: isChoice
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private static boolean isChoice(Component component) {
return (component instanceof RadioChoice) ||
(component instanceof CheckBoxMultipleChoice) || (component instanceof RadioGroup) ||
(component instanceof CheckGroup);
}
示例13: createAppForm
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private void createAppForm() {
appForm = new Form<>("appForm", new CompoundPropertyModel<>(new FirstApplicationReleaseInfos()));
TextField<String> appLabel = new TextField<>("appLabel");
appLabel.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.label.label"));
appLabel.add(new AbstractValidator<String>() {
@Override
protected void onValidate(IValidatable<String> iValidatable) {
if(!parentPage.isApplicationLabelUnique(iValidatable.getValue())) {
error(iValidatable);
}
}
@Override
protected String resourceKey() {
return "portal.application.label.non.unique";
}
@Override
protected Map<String, Object> variablesMap(IValidatable<String> stringIValidatable) {
Map<String, Object> map = super.variablesMap(stringIValidatable);
map.put("label", stringIValidatable.getValue());
return map;
}
});
appLabel.add(new PropertyValidator<>());
appForm.add(appLabel);
TextField<String> appCode = new TextField<>("appCode");
appCode.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.code.label"));
appCode.add(new PropertyValidator<>());
appForm.add(appCode);
TextArea<String> appDescription = new TextArea<>("appDescription");
appDescription.setLabel(WicketUtils.getStringResourceModel(this, "portal.application.description.label"));
appDescription.add(new PropertyValidator<>());
appForm.add(appDescription);
RadioGroup<Boolean> appVisibility = new RadioGroup<>("appPublic");
appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-public", new Model<>(Boolean.TRUE)));
appVisibility.add(new Radio<Boolean>("appVisibilityRadioGroup-private", new Model<>(Boolean.FALSE)));
appVisibility.add(new PropertyValidator<>());
appForm.add(appVisibility);
appForm.add(new CacheActivatedImage("imageHelp.visibilityField", new ResourceModel("image.help").getObject()));
TextField<String> members = new TextField<>("members");
members.add(new PropertyValidator<>());
appForm.add(members);
appForm.add(new CacheActivatedImage("imageHelp.membersField", new ResourceModel("image.help").getObject()));
releaseFiedsetPanel = new ReleaseFieldsetPanel("releaseFieldsetPanel", parentPage, manageApplicationRelease);
appForm.add(releaseFiedsetPanel);
createFormButtons(appForm);
// set default visibility to private
appForm.getModelObject().setAppPublic(Boolean.FALSE);
add(appForm);
}
示例14: setGroup
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
public StyledRadio setGroup(RadioGroup<T> group) {
this.group = group;
return this;
}
示例15: initLayout
import org.apache.wicket.markup.html.form.RadioGroup; //导入依赖的package包/类
private void initLayout() {
Form mainForm = new com.evolveum.midpoint.web.component.form.Form(ID_MAIN_FORM);
add(mainForm);
final WebMarkupContainer input = new WebMarkupContainer(ID_INPUT);
input.setOutputMarkupId(true);
mainForm.add(input);
final WebMarkupContainer buttonBar = new WebMarkupContainer(ID_BUTTON_BAR);
buttonBar.setOutputMarkupId(true);
mainForm.add(buttonBar);
final IModel<Integer> groupModel = new Model<Integer>(INPUT_FILE);
RadioGroup importRadioGroup = new RadioGroup(ID_IMPORT_RADIO_GROUP, groupModel);
importRadioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(input);
target.add(buttonBar);
}
});
mainForm.add(importRadioGroup);
Radio fileRadio = new Radio(ID_FILE_RADIO, new Model(INPUT_FILE), importRadioGroup);
importRadioGroup.add(fileRadio);
Radio xmlRadio = new Radio(ID_XML_RADIO, new Model(INPUT_XML), importRadioGroup);
importRadioGroup.add(xmlRadio);
WebMarkupContainer inputAce = new WebMarkupContainer(ID_INPUT_ACE);
addVisibileForInputType(inputAce, INPUT_XML, groupModel);
input.add(inputAce);
AceEditor aceEditor = new AceEditor(ID_ACE_EDITOR, xmlEditorModel);
aceEditor.setOutputMarkupId(true);
inputAce.add(aceEditor);
WebMarkupContainer inputFileLabel = new WebMarkupContainer(ID_INPUT_FILE_LABEL);
addVisibileForInputType(inputFileLabel, INPUT_FILE, groupModel);
input.add(inputFileLabel);
WebMarkupContainer inputFile = new WebMarkupContainer(ID_INPUT_FILE);
addVisibileForInputType(inputFile, INPUT_FILE, groupModel);
input.add(inputFile);
FileUploadField fileInput = new FileUploadField(ID_FILE_INPUT);
inputFile.add(fileInput);
initButtons(buttonBar, groupModel);
}