use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageDebugList method initColumns.
private List<IColumn> initColumns(final Class<? extends ObjectType> type) {
List<IColumn> columns = new ArrayList<>();
IColumn column = new CheckBoxHeaderColumn<ObjectType>();
columns.add(column);
column = new LinkColumn<DebugObjectItem>(createStringResource("pageDebugList.name"), DebugObjectItem.F_NAME, DebugObjectItem.F_NAME) {
@Override
public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, final IModel<DebugObjectItem> rowModel) {
TwoValueLinkPanel panel = new TwoValueLinkPanel(componentId, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
DebugObjectItem object = rowModel.getObject();
if (object == null) {
return null;
}
StringBuilder sb = new StringBuilder();
sb.append(object.getName());
if (object.getStatus() != null && object.getStatus() != OperationResultStatusType.SUCCESS && object.getStatus() != OperationResultStatusType.HANDLED_ERROR) {
sb.append(" (");
sb.append(object.getStatus());
sb.append(")");
}
return sb.toString();
}
}, new PropertyModel<String>(rowModel, DebugObjectItem.F_OID)) {
@Override
public void onClick(AjaxRequestTarget target) {
DebugObjectItem object = rowModel.getObject();
objectEditPerformed(target, object.getOid(), type);
}
@Override
public boolean isEnabled() {
return rowModel.getObject().getOid() != null;
}
};
cellItem.add(panel);
cellItem.add(new AttributeModifier("class", "col-md-3"));
}
};
columns.add(column);
columns.add(new PropertyColumn(createStringResource("pageDebugList.description"), DebugObjectItem.F_DESCRIPTION));
if (ShadowType.class.isAssignableFrom(type)) {
columns.add(new PropertyColumn(createStringResource("pageDebugList.resourceName"), DebugObjectItem.F_RESOURCE_NAME));
columns.add(new PropertyColumn(createStringResource("pageDebugList.resourceType"), DebugObjectItem.F_RESOURCE_TYPE));
}
column = new AbstractColumn<DebugObjectItem, String>(new Model(), null) {
@Override
public String getCssClass() {
return "debug-list-buttons";
}
@Override
public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, IModel<DebugObjectItem> rowModel) {
cellItem.add(new DebugButtonPanel<DebugObjectItem>(componentId, rowModel) {
@Override
public void deletePerformed(AjaxRequestTarget target, IModel<DebugObjectItem> model) {
deleteSelected(target, model.getObject());
}
@Override
public void exportPerformed(AjaxRequestTarget target, IModel<DebugObjectItem> model) {
exportSelected(target, model.getObject());
}
});
}
};
columns.add(column);
column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {
@Override
public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
// we don't need row inline menu
cellItem.add(new Label(componentId));
}
};
columns.add(column);
return columns;
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageDebugView method initLayout.
private void initLayout() {
add(mainForm);
mainForm.add(new AjaxCheckBox("encrypt", encrypt) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
mainForm.add(new AjaxCheckBox("saveAsRaw", saveAsRaw) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
mainForm.add(new AjaxCheckBox("reevaluateSearchFilters", reevaluateSearchFilters) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
mainForm.add(new AjaxCheckBox("validateSchema", validateSchema) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
mainForm.add(new AjaxCheckBox("switchToPlainText", switchToPlainText) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (switchToPlainText.getObject()) {
editor.setVisible(false);
plainTextarea.setVisible(true);
} else {
editor.setVisible(true);
plainTextarea.setVisible(false);
}
target.add(mainForm);
}
});
plainTextarea = new TextArea<>(ID_PLAIN_TEXTAREA, new PropertyModel<String>(model, ObjectViewDto.F_XML));
plainTextarea.setVisible(false);
mainForm.add(plainTextarea);
addOrReplaceEditor();
initButtons(mainForm);
initViewButton(mainForm);
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class PageDebugView method addOrReplaceEditor.
private void addOrReplaceEditor() {
editor = new AceEditor("aceEditor", new PropertyModel<String>(model, ObjectViewDto.F_XML));
editor.setModeForDataLanguage(dataLanguage);
editor.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
}
});
mainForm.addOrReplace(editor);
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class AdminGuiConfigPanel method initLayout.
private void initLayout() {
GenericMultiValueLabelEditPanel<RichHyperlinkType> dashboardLinkEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_DASHBOARD_LINK_EDITOR, new PropertyModel<List<RichHyperlinkType>>(getModel(), "userDashboardLink"), createStringResource("AdminGuiConfigPanel.dashboardLinksConfig"), LABEL_SIZE, INPUT_SIZE, true) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
return new PropertyModel<String>(model, "label");
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
RichHyperlinkConfigPanel contentPanel = new RichHyperlinkConfigPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject(), false) {
private static final long serialVersionUID = 1L;
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getDashboardLinkEditorContainer());
}
@Override
public StringResourceModel getTitle() {
return createStringResource("AdminGuiConfigPanel.dashboardLinkDialogTitle.title");
}
};
showDialog(contentPanel, target);
}
@Override
protected RichHyperlinkType createNewEmptyItem() {
RichHyperlinkType link = new RichHyperlinkType();
link.getAuthorization().add("");
return link;
}
};
dashboardLinkEditor.setOutputMarkupId(true);
add(dashboardLinkEditor);
GenericMultiValueLabelEditPanel<RichHyperlinkType> additionalMenuItemEditor = new GenericMultiValueLabelEditPanel<RichHyperlinkType>(ID_ADDITIONAL_MENU_ITEM_EDITOR, new PropertyModel<List<RichHyperlinkType>>(getModel(), "additionalMenuLink"), createStringResource("AdminGuiConfigPanel.additionalMenuItemConfig"), LABEL_SIZE, INPUT_SIZE, true) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createTextModel(final IModel<RichHyperlinkType> model) {
return new PropertyModel<String>(model, "label");
}
@Override
protected void editValuePerformed(AjaxRequestTarget target, IModel<RichHyperlinkType> rowModel) {
RichHyperlinkConfigPanel contentPanel = new RichHyperlinkConfigPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject(), true) {
private static final long serialVersionUID = 1L;
@Override
protected void savePerformed(AjaxRequestTarget target) {
closeModalWindow(target);
target.add(getAdditionalMenuItemContainer());
}
@Override
public StringResourceModel getTitle() {
return createStringResource("AdminGuiConfigPanel.additionalMenuItemDialog.title");
}
};
showDialog(contentPanel, target);
}
@Override
protected RichHyperlinkType createNewEmptyItem() {
RichHyperlinkType link = new RichHyperlinkType();
link.getAuthorization().add("");
return link;
}
};
additionalMenuItemEditor.setOutputMarkupId(true);
add(additionalMenuItemEditor);
}
use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.
the class ObjectSelectionPanel method initLayout.
public void initLayout(PageBase pageBase) {
Form searchForm = new Form(ID_SEARCH_FORM);
searchForm.setOutputMarkupId(true);
add(searchForm);
searchForm.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return context.isSearchEnabled();
}
});
BasicSearchPanel<ObjectSearchDto> basicSearch = new BasicSearchPanel<ObjectSearchDto>(ID_BASIC_SEARCH) {
@Override
protected IModel<String> createSearchTextModel() {
return new PropertyModel<>(searchModel, ObjectSearchDto.F_SEARCH_TEXT);
}
@Override
protected void searchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.searchPerformed(target);
}
@Override
protected void clearSearchPerformed(AjaxRequestTarget target) {
ObjectSelectionPanel.this.clearSearchPerformed(target);
}
};
searchForm.add(basicSearch);
add(context.createExtraContentContainer(ID_EXTRA_CONTENT_CONTAINER, this));
List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
ObjectDataProvider provider = new ObjectDataProvider(pageBase, this.objectType);
provider.setQuery(context.getDataProviderQuery());
provider.setOptions(context.getDataProviderOptions());
TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
addOrReplace(table);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("chooseTypeDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
modalWindow.close(ajaxRequestTarget);
}
};
add(cancelButton);
}
Aggregations