use of org.apache.wicket.markup.html.form.CheckBox in project midpoint by Evolveum.
the class LiveSyncHandlerPanel method initLayout.
private void initLayout(final PageTaskEdit parentPage) {
WebMarkupContainer tokenContainer = new WebMarkupContainer(ID_TOKEN_CONTAINER);
tokenContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
//TODO
return true;
}
});
tokenContainer.add(new Label(ID_TOKEN, new PropertyModel<>(getModel(), LiveSyncHandlerDto.F_TOKEN)));
LinkIconPanel deleteTokenPanel = new LinkIconPanel(ID_DELETE_TOKEN, new Model("fa fa-fw fa-trash-o fa-lg text-danger"), createStringResource("LiveSyncHandlerPanel.deleteToken")) {
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
parentPage.getController().deleteSyncTokenPerformed(target);
}
};
deleteTokenPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
// TODO ... and security
return !parentPage.isEdit() && getModelObject().hasToken();
}
});
deleteTokenPanel.setRenderBodyOnly(true);
tokenContainer.add(deleteTokenPanel);
add(tokenContainer);
WebMarkupContainer retryContainer = new WebMarkupContainer(ID_TOKEN_RETRY_CONTAINER);
add(retryContainer);
WebMarkupContainer retryCheckboxContainer = new WebMarkupContainer(ID_TOKEN_RETRY_CHECKBOX_CONTAINER);
retryContainer.add(retryCheckboxContainer);
CheckBox retryCheckbox = new CheckBox(ID_TOKEN_RETRY_CHECKBOX, new PropertyModel<Boolean>(getModel(), ResourceRelatedHandlerDto.F_TOKEN_RETRY_UNHANDLED_ERR));
retryCheckbox.add(enabledIfEdit);
retryCheckboxContainer.add(retryCheckbox);
}
use of org.apache.wicket.markup.html.form.CheckBox in project webanno by webanno.
the class AnnotationFeatureForm method createForwardAnnotationCheckBox.
private CheckBox createForwardAnnotationCheckBox() {
return new CheckBox("forwardAnnotation") {
private static final long serialVersionUID = 8908304272310098353L;
{
setOutputMarkupId(true);
add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 5179816588460867471L;
@Override
protected void onUpdate(AjaxRequestTarget aTarget) {
if (AnnotationFeatureForm.this.getModelObject().isForwardAnnotation()) {
List<AnnotationFeature> features = getEnabledFeatures(AnnotationFeatureForm.this.getModelObject().getSelectedAnnotationLayer());
if (features.size() > 1) {
// forward annotation process checking)
return;
}
// forward annotations
if (!features.isEmpty() && features.get(0).getTagset() == null) {
FeatureEditor editor = getFirstFeatureEditor();
if (editor != null) {
aTarget.focusComponent(editor.getFocusComponent());
}
} else {
aTarget.appendJavaScript(JavascriptUtils.getFocusScript(forwardAnnotationText));
selectedTag = "";
}
}
}
});
}
@Override
protected void onConfigure() {
super.onConfigure();
setEnabled(isForwardable());
if (!isForwardable()) {
AnnotationFeatureForm.this.getModelObject().setForwardAnnotation(false);
}
}
};
}
use of org.apache.wicket.markup.html.form.CheckBox in project webanno by webanno.
the class AnnotationPreferencesDialogContent method createLayerContainer.
private ListView<AnnotationLayer> createLayerContainer() {
return new ListView<AnnotationLayer>("annotationLayers") {
private static final long serialVersionUID = -4040731191748923013L;
@Override
protected void populateItem(ListItem<AnnotationLayer> item) {
// add checkbox
// get initial state
AnnotationPreference pref = stateModel.getObject().getPreferences();
List<Long> hiddenLayerIds = pref.getHiddenAnnotationLayerIds();
boolean isPreferredToShow = !hiddenLayerIds.contains(item.getModelObject().getId());
CheckBox layer_cb = new CheckBox("annotationLayerActive", Model.of(isPreferredToShow));
layer_cb.add(new AjaxEventBehavior("change") {
private static final long serialVersionUID = 8378489004897115519L;
@Override
protected void onEvent(AjaxRequestTarget target) {
// check state & live update preferences
List<Long> hiddenLayerIds = stateModel.getObject().getPreferences().getHiddenAnnotationLayerIds();
// get and switch state of checkbox
boolean isPreferredToShow = layer_cb.getModelObject();
layer_cb.setModelObject(!isPreferredToShow);
// live update preferences
if (isPreferredToShow) {
// prefer to deactivate layer
hiddenLayerIds.add(item.getModelObject().getId());
} else {
// prefer to activate layer
hiddenLayerIds.remove(item.getModelObject().getId());
}
}
});
item.add(layer_cb);
// add coloring strategy combobox
ChoiceRenderer<ColoringStrategyType> choiceRenderer = new ChoiceRenderer<>("descriptiveName");
List<ColoringStrategyType> choices = new ArrayList<ColoringStrategyType>(EnumSet.allOf(ColoringStrategyType.class));
Model<ColoringStrategyType> initialSelected = Model.of(form.getModelObject().colorPerLayer.get(item.getModelObject().getId()));
DropDownChoice<ColoringStrategyType> layer_color = new DropDownChoice<ColoringStrategyType>("layercoloring", initialSelected, choices, choiceRenderer);
layer_color.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1060397773470276585L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
AnnotationLayer current_layer = item.getModelObject();
ColoringStrategyType selectedColor = layer_color.getModelObject();
form.getModelObject().colorPerLayer.put(current_layer.getId(), selectedColor);
}
});
item.add(layer_color);
// add label
Label lbl = new Label("annotationLayerDesc", item.getModelObject().getUiName());
item.add(lbl);
}
};
}
use of org.apache.wicket.markup.html.form.CheckBox in project syncope by apache.
the class ConnConfPropertyListView method addCheckboxToggle.
private FormComponent<?> addCheckboxToggle(final ConnConfProperty property) {
final BootstrapToggleConfig config = new BootstrapToggleConfig().withOnStyle(BootstrapToggleConfig.Style.success).withOffStyle(BootstrapToggleConfig.Style.danger).withSize(BootstrapToggleConfig.Size.mini);
return new BootstrapToggle("externalAction", new PropertyModel<Boolean>(property, "overridable"), config) {
private static final long serialVersionUID = -875219845189261873L;
@Override
protected CheckBox newCheckBox(final String id, final IModel<Boolean> model) {
final CheckBox checkBox = super.newCheckBox(id, model);
checkBox.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
}
});
return checkBox;
}
@Override
protected IModel<String> getOnLabel() {
return Model.of("Override");
}
@Override
protected IModel<String> getOffLabel() {
return Model.of("Override?");
}
@Override
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
tag.append("class", "overridable", " ");
}
};
}
use of org.apache.wicket.markup.html.form.CheckBox in project midpoint by Evolveum.
the class DeleteAllPanel method initLayout.
private void initLayout(WebMarkupContainer content) {
CheckBox deleteUsersCheckbox = new CheckBox(ID_CHB_USERS, new PropertyModel<>(model, DeleteAllDto.F_USERS));
deleteUsersCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_USERS);
}
});
content.add(deleteUsersCheckbox);
CheckBox deleteOrgsCheckbox = new CheckBox(ID_CHB_ORG, new PropertyModel<>(model, DeleteAllDto.F_ORGS));
deleteOrgsCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_ORGS);
}
});
content.add(deleteOrgsCheckbox);
CheckBox deleteAccountShadowsCheckbox = new CheckBox(ID_CHB_ACCOUNT_SHADOW, new PropertyModel<>(model, DeleteAllDto.F_ACC_SHADOW));
deleteAccountShadowsCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_ACC_SHADOWS);
}
});
content.add(deleteAccountShadowsCheckbox);
CheckBox deleteNonAccountShadowsCheckbox = new CheckBox(ID_CHB_NON_ACCOUNT_SHADOW, new PropertyModel<>(model, DeleteAllDto.F_NON_ACC_SHADOW));
deleteNonAccountShadowsCheckbox.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateLabelModel(target, ID_TEXT_NON_ACC_SHADOW);
}
});
content.add(deleteNonAccountShadowsCheckbox);
Label usersLabel = new Label(ID_TEXT_USERS, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteUsersMessage();
}
});
usersLabel.setOutputMarkupId(true);
content.add(usersLabel);
Label orgsLabel = new Label(ID_TEXT_ORGS, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteOrgUnitsMessage();
}
});
orgsLabel.setOutputMarkupId(true);
content.add(orgsLabel);
Label accShadowsLabel = new Label(ID_TEXT_ACC_SHADOWS, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteAccountShadowsMessage();
}
});
accShadowsLabel.setOutputMarkupId(true);
content.add(accShadowsLabel);
Label nonAccShadowsLabel = new Label(ID_TEXT_NON_ACC_SHADOW, new LoadableModel<String>() {
@Override
protected String load() {
return createDeleteNonAccountShadowsMessage();
}
});
nonAccShadowsLabel.setOutputMarkupId(true);
content.add(nonAccShadowsLabel);
Label countLabel = new Label(ID_TOTAL, new LoadableModel<String>() {
@Override
protected String load() {
return createTotalMessage();
}
});
countLabel.setOutputMarkupId(true);
content.add(countLabel);
AjaxButton yesButton = new AjaxButton(ID_YES, new StringResourceModel("deleteAllDialog.yes", this, null)) {
@Override
public void onClick(AjaxRequestTarget target) {
yesPerformed(target);
}
};
content.add(yesButton);
AjaxButton noButton = new AjaxButton(ID_NO, new StringResourceModel("deleteAllDialog.no", this, null)) {
@Override
public void onClick(AjaxRequestTarget target) {
noPerformed(target);
}
};
content.add(noButton);
}
Aggregations