use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.
the class AssignmentEditorPanel method initHeaderRow.
protected void initHeaderRow() {
AjaxCheckBox selected = new AjaxCheckBox(ID_SELECTED, new PropertyModel<>(getModel(), AssignmentEditorDto.F_SELECTED)) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
// do we want to update something?
}
};
selected.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModel().getObject().isSimpleView();
}
});
headerRow.add(selected);
WebMarkupContainer typeImage = new WebMarkupContainer(ID_TYPE_IMAGE);
typeImage.add(AttributeModifier.append("class", createImageTypeModel(getModel())));
headerRow.add(typeImage);
Label errorIcon = new Label(ID_ERROR_ICON);
errorIcon.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !isTargetValid();
}
});
headerRow.add(errorIcon);
AjaxLink name = new AjaxLink(ID_NAME) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
nameClickPerformed(target);
}
};
headerRow.add(name);
AjaxLink errorLink = new AjaxLink(ID_BUTTON_SHOW_MORE) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showErrorPerformed(target);
}
};
errorLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !isTargetValid();
}
});
headerRow.add(errorLink);
Label nameLabel = new Label(ID_NAME_LABEL, createAssignmentNameLabelModel(false));
nameLabel.setOutputMarkupId(true);
name.add(nameLabel);
Label activation = new Label(ID_ACTIVATION, createActivationModel());
headerRow.add(activation);
ToggleIconButton expandButton = new ToggleIconButton(ID_EXPAND, GuiStyleConstants.CLASS_ICON_EXPAND, GuiStyleConstants.CLASS_ICON_COLLAPSE) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
nameClickPerformed(target);
}
@Override
public boolean isOn() {
return !AssignmentEditorPanel.this.getModelObject().isMinimized();
}
};
expandButton.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModel().getObject().isSimpleView();
}
});
headerRow.add(expandButton);
}
use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.
the class AssignmentTablePanel method initLayout.
private void initLayout(IModel<String> labelText) {
final WebMarkupContainer assignments = new WebMarkupContainer(ID_ASSIGNMENTS);
assignments.setOutputMarkupId(true);
add(assignments);
Label label = new Label(ID_HEADER, labelText);
assignments.add(label);
InlineMenu assignmentMenu = new InlineMenu(ID_MENU, new Model((Serializable) createAssignmentMenu()));
assignmentMenu.setVisible(getAssignmentMenuVisibility());
assignments.add(assignmentMenu);
ListView<AssignmentEditorDto> list = new ListView<AssignmentEditorDto>(ID_LIST, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<AssignmentEditorDto> item) {
AssignmentTablePanel.this.populateAssignmentDetailsPanel(item);
}
};
list.setOutputMarkupId(true);
assignments.add(list);
AjaxCheckBox checkAll = new AjaxCheckBox(ID_CHECK_ALL, new Model()) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
List<AssignmentEditorDto> assignmentEditors = getAssignmentModel().getObject();
for (AssignmentEditorDto dto : assignmentEditors) {
dto.setSelected(this.getModelObject());
}
target.add(assignments);
}
};
checkAll.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
int count = 0;
for (AssignmentEditorDto dto : getModelObject()) {
if (dto.isSimpleView()) {
count++;
}
}
if (count == getModelObject().size()) {
return false;
} else {
return true;
}
}
});
assignments.add(checkAll);
}
use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.
the class PageResourceEdit method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
final IModel<Boolean> editable = new LoadableModel<Boolean>(false) {
@Override
protected Boolean load() {
return !isEditing();
}
};
mainForm.add(new AjaxCheckBox(ID_EDIT, editable) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
editPerformed(target, editable.getObject());
}
});
AceEditor editor = new AceEditor(ID_ACE_EDITOR, new PropertyModel<String>(model, ObjectViewDto.F_XML));
editor.setReadonly(new LoadableModel<Boolean>(false) {
@Override
protected Boolean load() {
return isEditing();
}
});
mainForm.add(editor);
initButtons(mainForm);
}
use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.
the class PrismOptionButtonPanel method initLayout.
private void initLayout(final IModel<ObjectWrapper> model) {
AjaxCheckBox check = new AjaxCheckBox("check", new PropertyModel<Boolean>(model, "selected")) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
PrismOptionButtonPanel.this.checkBoxOnUpdate(target);
}
};
check.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().isSelectable();
}
});
check.setOutputMarkupId(true);
add(check);
initButtons(model);
}
Aggregations