public FieldPanel<T> setReadOnly(final boolean readOnly) { field.setEnabled(!readOnly); return this; }
/** * Creates script editor component. By default, this creates a simple textarea form component. * @param id form component ID * @param editable flag whether or not the script editor should be editable */ protected FormComponent<?> createScriptEditor(String id, boolean editable) { FormComponent<String> scriptEditor = new TextArea<>(id); scriptEditor.setEnabled(editable); return scriptEditor; } }
/** * Adds an ajax updating form component */ protected void addFormField(final FormComponent<?> component) { add(component); if (edit) { component.setOutputMarkupId(true); component.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(final AjaxRequestTarget target) { FieldEditor.this.onUpdate(target); } }); } else { component.setEnabled(false); } }
@Override public Component appendInput(WicketBuildContext ctx, BSControls formGroup, IModel<String> labelModel) { final IModel<? extends SInstance> model = ctx.getModel(); final FormComponent<?> field = new TextField<>(model.getObject().getName(), new Model<String>() { @Override public String getObject() { return getReadOnlyFormattedText(ctx, model); } @Override public void setObject(String object) {} }); field.setEnabled(false); field.setLabel(labelModel); formGroup.appendInputText(field); return field; }
@Override public Component appendInput(WicketBuildContext ctx, BSControls formGroup, IModel<String> labelModel) { final IModel<? extends SInstance> model = ctx.getModel(); final FormComponent<?> field = new TextField<>(model.getObject().getName(), new Model<String>() { @Override public String getObject() { return getReadOnlyFormattedText(ctx, model); } @Override public void setObject(String object) {} }); field.setEnabled(false); field.setLabel(labelModel); formGroup.appendInputText(field); return field; }
public SecurityNamedServicePanel(String id, IModel<T> model) { super(id, new Model()); this.configModel = model; //check for administrator, if not disable the panel and emit warning message boolean isAdmin = getSecurityManager().checkAuthenticationForAdminRole(); setEnabled(isAdmin); add(new Label("message", isAdmin ? new Model() : new StringResourceModel("notAdmin", this, null))); if (!isAdmin) { get("message").add(new AttributeAppender("class", new Model("info-link"), " ")); } setOutputMarkupId(true); add(new TextField("name").setRequired(true).setEnabled(model.getObject().getId() == null)); add(dialog = new GeoServerDialog("dialog")); }
public SecurityNamedServicePanel(String id, IModel<T> model) { super(id, new Model()); this.configModel = model; //check for administrator, if not disable the panel and emit warning message boolean isAdmin = getSecurityManager().checkAuthenticationForAdminRole(); setEnabled(isAdmin); add(new Label("message", isAdmin ? new Model() : new StringResourceModel("notAdmin", this, null))); if (!isAdmin) { get("message").add(new AttributeAppender("class", new Model("info-link"), " ")); } setOutputMarkupId(true); add(new TextField("name").setRequired(true).setEnabled(model.getObject().getId() == null)); add(dialog = new GeoServerDialog("dialog")); }
public SecurityNamedServicePanel(String id, IModel<T> model) { super(id, new Model()); this.configModel = model; // check for administrator, if not disable the panel and emit warning message boolean isAdmin = getSecurityManager().checkAuthenticationForAdminRole(); setEnabled(isAdmin); add( new Label( "message", isAdmin ? new Model() : new StringResourceModel("notAdmin", this, null))); if (!isAdmin) { get("message").add(new AttributeAppender("class", new Model("info-link"), " ")); } setOutputMarkupId(true); add(new TextField("name").setRequired(true).setEnabled(model.getObject().getId() == null)); add(dialog = new GeoServerDialog("dialog")); }
@Override public void populateItem(Item<ICellPopulator<T>> cellItem, String componentId, IModel<T> rowModel) { T rowObject = rowModel.getObject(); CheckboxPanel panel = new CheckboxPanel(componentId, rowModel); cellItem.add(new CssClass("CheckboxColumn")); cellItem.add(panel); IModel<Boolean> model = newPropertyModel(rowObject); FormComponent checkBox = newCheckBox(CHECKBOX_ID, model, rowObject); panel.add(checkBox); boolean enabled = isEnabled(rowObject); checkBox.setEnabled(enabled); }
@Override protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { ldapPosixGroupsUtils.setDefaultValues(ldapGroupValues); for (final FormComponent<?> component : dependentPosixLdapFormComponentsList) { component.modelChanged(); component.setEnabled(true); } this.setVisible(false); for (final FormComponent<?> comp : dependentPosixLdapFormComponentsList) { target.add(comp); } target.add(this, GroupEditForm.this.feedbackPanel); target.appendJavaScript("hideAllTooltips();"); // Otherwise a tooltip is left as zombie. }
for (final FormComponent<?> component : dependentPosixLdapFormComponentsList) { component.modelChanged(); component.setEnabled(true); for (final FormComponent<?> component : dependentSambaLdapFormComponentsList) { component.modelChanged(); component.setEnabled(true);
fc = new RequiredTextField("matcher"); fc.add(new UniqueSitemapItemValidator(this, hstContext.sitemap)); fc.setEnabled(!lockInfo.isLocked()); form.add(fc);
form.add(new TextField("name", new Model(role.getAuthority())).setRequired(true).setEnabled(hasRoleStore)); form.add(new DropDownChoice("parent", new ParentRoleModel(role), new ParentRolesModel(role)) .setEnabled(hasRoleStore));
form.add(new TextField("name", new Model(role.getAuthority())).setRequired(true).setEnabled(hasRoleStore)); form.add(new DropDownChoice("parent", new ParentRoleModel(role), new ParentRolesModel(role)) .setNullValid(true).setEnabled(hasRoleStore));
new TextField("name", new Model(role.getAuthority())) .setRequired(true) .setEnabled(hasRoleStore)); form.add( new DropDownChoice("parent", new ParentRoleModel(role), new ParentRolesModel(role))
@Override protected void onInitialize() { super.onInitialize(); ModelFacade<T> component = createFormComponent(attribute, model); List<Component> helpComponents = component.getHelpComponents(); if (helpComponents != null) { for (Component child : helpComponents) { add(child); } } FormComponent<T> mainComponent = component.getMainComponent(); mainComponent.setOutputMarkupId(true); mainComponent.setMarkupId(attribute.getId()); // editable is always set to true mainComponent.setEnabled(editable); if (validator != null) { mainComponent.add(validator); } mainComponent.setRequired(attribute.isRequired()); mainComponent.setLabel(new LocalizableStringModel(this, attribute.getName())); SimpleFormComponentLabel label = new SimpleFormComponentLabel("name", mainComponent); label.add(new SimpleAttributeModifier("for", attribute.getId())); if (attribute.isRequired()) { label.add(new SimpleAttributeModifier("class", "required")); } add(label); add(mainComponent); addTooltip(attribute); }
final DropDownChoice<HRPlanningEntryStatus> statusChoice = new DropDownChoice<HRPlanningEntryStatus>(fs.getDropDownChoiceId(), new PropertyModel<HRPlanningEntryStatus>(entry, "status"), statusChoiceRenderer.getValues(), statusChoiceRenderer); statusChoice.setNullValid(true).setRequired(false).setEnabled(!entry.isDeleted()); fs.add(statusChoice); dependentEntryFormComponents.add(statusChoice); final NewProjektSelectPanel projektSelectPanel = new NewProjektSelectPanel(fs.newChildId(), new PropertyModel<ProjektDO>(entry, "projekt"), parentPage, "projektId:" + idx + ":" + uiId); projektSelectPanel.setRequired(false).setEnabled(!entry.isDeleted()); fs.add(projektSelectPanel); projektSelectPanel.init();
fc.setEnabled(!getLockInfo().isLocked()); form.add(fc);
.setReadOnly(config.isInternal())) .setRequired(true) .setEnabled(!config.isInternal()));
.setReadOnly(config.isInternal())) .setRequired(true) .setEnabled(!config.isInternal()));