本文整理汇总了Java中org.apache.wicket.markup.html.form.Radio类的典型用法代码示例。如果您正苦于以下问题:Java Radio类的具体用法?Java Radio怎么用?Java Radio使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Radio类属于org.apache.wicket.markup.html.form包,在下文中一共展示了Radio类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAndAddRepoConfigDockerSection
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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: add
import org.apache.wicket.markup.html.form.Radio; //导入依赖的package包/类
public Radio<T> add(final Model<T> model, final String labelString, final String tooltip)
{
final WebMarkupContainer cont = new WebMarkupContainer(repeater.newChildId());
repeater.add(cont);
final Radio<T> radio = new Radio<T>("radio", model, radioGroup);
if (autosubmit == true) {
radio.add(AttributeModifier.replace("onchange", "javascript:submit();"));
}
cont.add(radio);
final Label label = new Label("label", labelString);
label.add(AttributeModifier.replace("for", radio.setOutputMarkupId(true).getMarkupId()));
label.setRenderBodyOnly(true);
cont.add(label);
if (tooltip != null) {
WicketUtils.addTooltip(label, tooltip);
}
return radio;
}
示例3: ItemsForm
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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!');");
}
}
});
}
示例4: getComponentsToDecorateWithCSS
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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);
}
}
示例5: PollAnswerForm
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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));
}
示例6: init
import org.apache.wicket.markup.html.form.Radio; //导入依赖的package包/类
protected void init() {
super.add(ResourcePackage.forJavaScript(StyledRadio.class));
super.add(new CssClass("styled-checkbox"));
radio = new Radio<>("radio", new DelegatedModel<T>(this));
radio.setOutputMarkupId(true);
add(radio);
button = new RadioButton("button");
add(button);
}
示例7: addRadioButtons
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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.Radio; //导入依赖的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: RadioButtonPanel
import org.apache.wicket.markup.html.form.Radio; //导入依赖的package包/类
public RadioButtonPanel(String id, IModel<T> valueModel, IModel<String> labelModel) {
super(id);
setLabel(labelModel);
radio = new Radio<T>("field", valueModel) {
@Override
public boolean isEnabled() {
return RadioButtonPanel.this.isEnabled();
}
};
add(radio);
}
示例10: isRadioChecked
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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());
}
}
示例11: RadioButtonLabelPanel
import org.apache.wicket.markup.html.form.Radio; //导入依赖的package包/类
public RadioButtonLabelPanel(final String id, final IModel<T> model, final String label)
{
super(id);
radioButton = new Radio<T>("radioButton", model);
add(radioButton);
final Model<String> labelModel = new Model<String>(label);
radioButton.setLabel(labelModel);
// I18n key must be implemented as Model not as String because in constructor (before adding this component to parent) a warning will be
// logged for using getString(String).
add(new Label("label", labelModel).add(AttributeModifier.replace("for", radioButton.getMarkupId())));
setRenderBodyOnly(true);
}
示例12: addChoice
import org.apache.wicket.markup.html.form.Radio; //导入依赖的package包/类
private void addChoice(String id) {
searchTypeField.add(new Radio(id, new Model(id)) {
@Override
public String getValue() {
return super.getId();
}
protected boolean getStatelessHint() {
return true;
}
});
searchTypeField.add(new Label("lbl_" + id, new StringResourceModel(
"searchType." + id, this, null)));
}
示例13: initLayout
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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);
}
示例14: ConditionalInputBehavior
import org.apache.wicket.markup.html.form.Radio; //导入依赖的package包/类
public ConditionalInputBehavior(Radio<?> enableOption, ConditionalInputAction action) {
this((Component)enableOption, action);
}
示例15: createAppForm
import org.apache.wicket.markup.html.form.Radio; //导入依赖的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);
}