use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class NavigatorPanel method initNext.
private void initNext() {
WebMarkupContainer next = new WebMarkupContainer(ID_NEXT);
next.add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return isNextEnabled() ? "" : "disabled";
}
}));
add(next);
AjaxLink nextLink = new AjaxLink(ID_NEXT_LINK) {
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
@Override
public void onClick(AjaxRequestTarget target) {
nextPerformed(target);
}
};
nextLink.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return isNextEnabled();
}
});
next.add(nextLink);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class PageAuditLogDetails method initLayout.
private void initLayout() {
WebMarkupContainer eventPanel = new WebMarkupContainer(ID_EVENT_PANEL);
eventPanel.setOutputMarkupId(true);
add(eventPanel);
initAuditLogHistoryPanel(eventPanel);
initEventPanel(eventPanel);
initDeltasPanel(eventPanel);
initLayoutBackButton();
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class PageAuditLogDetails method initEventPanel.
private void initEventPanel(WebMarkupContainer eventPanel) {
WebMarkupContainer eventDetailsPanel = new WebMarkupContainer(ID_EVENT_DETAILS_PANEL);
eventDetailsPanel.setOutputMarkupId(true);
eventPanel.addOrReplace(eventDetailsPanel);
final Label identifier = new Label(ID_PARAMETERS_EVENT_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_IDENTIFIER));
identifier.setOutputMarkupId(true);
eventDetailsPanel.add(identifier);
final Label timestamp = new Label(ID_PARAMETERS_TIMESTAMP, new PropertyModel(recordModel, ID_PARAMETERS_TIMESTAMP));
timestamp.setOutputMarkupId(true);
eventDetailsPanel.add(timestamp);
final Label sessionIdentifier = new Label(ID_PARAMETERS_SESSION_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_SESSION_IDENTIFIER));
sessionIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(sessionIdentifier);
final Label taskIdentifier = new Label(ID_PARAMETERS_TASK_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_TASK_IDENTIFIER));
taskIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(taskIdentifier);
final Label taskOID = new Label(ID_PARAMETERS_TASK_OID, new PropertyModel(recordModel, ID_PARAMETERS_TASK_OID));
taskOID.setOutputMarkupId(true);
eventDetailsPanel.add(taskOID);
final Label hostIdentifier = new Label(ID_PARAMETERS_HOST_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_HOST_IDENTIFIER));
hostIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(hostIdentifier);
final Label nodeIdentifier = new Label(ID_PARAMETERS_NODE_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_NODE_IDENTIFIER));
nodeIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(nodeIdentifier);
final Label remoteHostAddress = new Label(ID_PARAMETERS_REMOTE_HOST_ADDRESS, new PropertyModel(recordModel, ID_PARAMETERS_REMOTE_HOST_ADDRESS));
remoteHostAddress.setOutputMarkupId(true);
eventDetailsPanel.add(remoteHostAddress);
final Label initiatorRef = new Label(ID_PARAMETERS_EVENT_INITIATOR, new Model<>(WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getInitiatorRef(), this, createSimpleTask(ID_PARAMETERS_EVENT_INITIATOR), new OperationResult(ID_PARAMETERS_EVENT_INITIATOR))));
initiatorRef.setOutputMarkupId(true);
eventDetailsPanel.add(initiatorRef);
final Label targetRef = new Label(ID_PARAMETERS_EVENT_TARGET, new Model<>(WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getTargetRef(), this, createSimpleTask(ID_PARAMETERS_EVENT_TARGET), new OperationResult(ID_PARAMETERS_EVENT_TARGET))));
targetRef.setOutputMarkupId(true);
eventDetailsPanel.add(targetRef);
IModel<String> targetOwnerRefModel = new IModel<String>() {
@Override
public String getObject() {
return WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getTargetOwnerRef(), PageAuditLogDetails.this, createSimpleTask(OPERATION_RESOLVE_REFERENCE_NAME), new OperationResult(OPERATION_RESOLVE_REFERENCE_NAME));
}
@Override
public void setObject(String s) {
}
@Override
public void detach() {
}
};
final Label targetOwnerRef = new Label(ID_PARAMETERS_EVENT_TARGET_OWNER, targetOwnerRefModel);
targetOwnerRef.setOutputMarkupId(true);
eventDetailsPanel.add(targetOwnerRef);
final Label eventType = new Label(ID_PARAMETERS_EVENT_TYPE, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_TYPE));
eventType.setOutputMarkupId(true);
eventDetailsPanel.add(eventType);
final Label eventStage = new Label(ID_PARAMETERS_EVENT_STAGE, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_STAGE));
eventStage.setOutputMarkupId(true);
eventDetailsPanel.add(eventStage);
final Label channel = new Label(ID_PARAMETERS_CHANNEL, new PropertyModel(recordModel, ID_PARAMETERS_CHANNEL));
channel.setOutputMarkupId(true);
eventDetailsPanel.add(channel);
final Label eventOutcome = new Label(ID_PARAMETERS_EVENT_OUTCOME, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_OUTCOME));
eventOutcome.setOutputMarkupId(true);
eventDetailsPanel.add(eventOutcome);
final Label eventResult = new Label(ID_PARAMETERS_EVENT_RESULT, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_RESULT));
eventResult.setOutputMarkupId(true);
eventDetailsPanel.add(eventResult);
final Label parameter = new Label(ID_PARAMETERS_PARAMETER, new PropertyModel(recordModel, ID_PARAMETERS_PARAMETER));
parameter.setOutputMarkupId(true);
eventDetailsPanel.add(parameter);
final Label message = new Label(ID_PARAMETERS_MESSAGE, new PropertyModel(recordModel, ID_PARAMETERS_MESSAGE));
message.setOutputMarkupId(true);
eventDetailsPanel.add(message);
ListView<AuditEventRecordItemValueDto> additionalItemsList = new ListView<AuditEventRecordItemValueDto>(ID_ADDITIONAL_ITEM_LINE, new AbstractReadOnlyModel<List<AuditEventRecordItemValueDto>>() {
@Override
public List<AuditEventRecordItemValueDto> getObject() {
List<AuditEventRecordItemValueDto> rv = new ArrayList<>();
for (AuditEventRecordItemType item : getSortedItems()) {
String currentName = getDisplayName(item.getName());
if (item instanceof AuditEventRecordPropertyType) {
for (String value : ((AuditEventRecordPropertyType) item).getValue()) {
rv.add(new AuditEventRecordItemValueDto(currentName, value));
currentName = null;
}
} else if (item instanceof AuditEventRecordReferenceType) {
for (AuditEventRecordReferenceValueType value : ((AuditEventRecordReferenceType) item).getValue()) {
rv.add(new AuditEventRecordItemValueDto(currentName, value.getTargetName() != null ? value.getTargetName().getOrig() : value.getOid()));
currentName = null;
}
} else {
// should not occur
}
}
return rv;
}
// TODO take locale into account when sorting
private List<AuditEventRecordItemType> getSortedItems() {
AuditEventRecordType record = recordModel.getObject();
List<AuditEventRecordItemType> rv = new ArrayList<>();
rv.addAll(record.getProperty());
rv.addAll(record.getReference());
rv.sort((a, b) -> {
// explicitly enumerated are shown first; others are sorted by display name
int index_a = EXTENSION_ITEMS_ORDER.indexOf(a.getName());
int index_b = EXTENSION_ITEMS_ORDER.indexOf(b.getName());
if (index_a != -1 && index_b != -1) {
return Integer.compare(index_a, index_b);
} else if (index_a != -1) {
return -1;
} else if (index_b != -1) {
return 1;
}
String name_a = getDisplayName(a.getName());
String name_b = getDisplayName(b.getName());
return String.CASE_INSENSITIVE_ORDER.compare(name_a, name_b);
});
return rv;
}
private String getDisplayName(String nameKey) {
// null should not occur so we don't try to be nice when displaying it
return nameKey != null ? createStringResource(nameKey).getString() : "(null)";
}
}) {
@Override
protected void populateItem(ListItem<AuditEventRecordItemValueDto> item) {
item.add(new Label(ID_ITEM_NAME, new PropertyModel<String>(item.getModel(), AuditEventRecordItemValueDto.F_NAME)));
item.add(new Label(ID_ITEM_VALUE, new PropertyModel<String>(item.getModel(), AuditEventRecordItemValueDto.F_VALUE)));
}
};
WebMarkupContainer additionalItemsContainer = new WebMarkupContainer(ID_ADDITIONAL_ITEMS);
additionalItemsContainer.add(additionalItemsList);
additionalItemsContainer.add(new VisibleBehaviour(() -> !additionalItemsList.getModelObject().isEmpty()));
eventDetailsPanel.add(additionalItemsContainer);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class OrgTreePanel method initLayout.
private void initLayout() {
WebMarkupContainer treeHeader = new WebMarkupContainer(ID_TREE_HEADER);
treeHeader.setOutputMarkupId(true);
add(treeHeader);
String title = StringUtils.isEmpty(treeTitleKey) ? "TreeTablePanel.hierarchy" : treeTitleKey;
Label treeTitle = new Label(ID_TREE_TITLE, createStringResource(title));
treeHeader.add(treeTitle);
InlineMenu treeMenu = new InlineMenu(ID_TREE_MENU, new Model<>((Serializable) createTreeMenuInternal()));
treeHeader.add(treeMenu);
ISortableTreeProvider provider = new OrgTreeProvider(this, getModel()) {
private static final long serialVersionUID = 1L;
@Override
protected List<InlineMenuItem> createInlineMenuItems(OrgType org) {
return createTreeChildrenMenu(org);
}
};
List<IColumn<SelectableBean<OrgType>, String>> columns = new ArrayList<>();
if (selectable) {
columns.add(new CheckBoxHeaderColumn<SelectableBean<OrgType>>());
}
columns.add(new TreeColumn<SelectableBean<OrgType>, String>(createStringResource("TreeTablePanel.hierarchy")));
columns.add(new InlineMenuHeaderColumn(createTreeChildrenMenu(null)));
WebMarkupContainer treeContainer = new WebMarkupContainer(ID_TREE_CONTAINER) {
private static final long serialVersionUID = 1L;
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
// method computes height based on document.innerHeight() -
// screen height;
Component form = OrgTreePanel.this.getParent().get("memberPanel");
if (form != null) {
response.render(OnDomReadyHeaderItem.forScript("updateHeight('" + getMarkupId() + "', ['#" + form.getMarkupId() + "'], ['#" + OrgTreePanel.this.get(ID_TREE_HEADER).getMarkupId() + "'])"));
}
}
};
add(treeContainer);
TreeStateModel treeStateMode = new TreeStateModel(this, provider) {
private static final long serialVersionUID = 1L;
@Override
public Set<SelectableBean<OrgType>> getExpandedItems() {
return OrgTreePanel.this.getExpandedItems(getOrgTreeStateStorage());
}
@Override
public SelectableBean<OrgType> getCollapsedItem() {
return OrgTreePanel.this.getCollapsedItem(getOrgTreeStateStorage());
}
@Override
public void setCollapsedItem(SelectableBean<OrgType> item) {
OrgTreePanel.this.setCollapsedItem(null, getOrgTreeStateStorage());
}
};
TableTree<SelectableBean<OrgType>, String> tree = new TableTree<SelectableBean<OrgType>, String>(ID_TREE, columns, provider, Integer.MAX_VALUE, treeStateMode) {
private static final long serialVersionUID = 1L;
@Override
protected Component newContentComponent(String id, IModel<SelectableBean<OrgType>> model) {
return new SelectableFolderContent(id, this, model, selected) {
private static final long serialVersionUID = 1L;
@Override
protected void onClick(AjaxRequestTarget target) {
super.onClick(target);
OrgTreePanel.this.setSelectedItem(selected.getObject(), getOrgTreeStateStorage());
selectTreeItemPerformed(selected.getObject(), target);
}
};
}
@Override
protected Item<SelectableBean<OrgType>> newRowItem(String id, int index, final IModel<SelectableBean<OrgType>> model) {
Item<SelectableBean<OrgType>> item = super.newRowItem(id, index, model);
item.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
SelectableBean<OrgType> itemObject = model.getObject();
if (itemObject != null && itemObject.equals(selected.getObject())) {
return "success";
}
return null;
}
}));
return item;
}
@Override
public void collapse(SelectableBean<OrgType> collapsedItem) {
super.collapse(collapsedItem);
Set<SelectableBean<OrgType>> items = OrgTreePanel.this.getExpandedItems(getOrgTreeStateStorage());
if (items != null && items.contains(collapsedItem)) {
items.remove(collapsedItem);
}
OrgTreePanel.this.setExpandedItems((TreeStateSet) items, getOrgTreeStateStorage());
OrgTreePanel.this.setCollapsedItem(collapsedItem, getOrgTreeStateStorage());
}
@Override
protected void onModelChanged() {
super.onModelChanged();
TreeStateSet<SelectableBean<OrgType>> items = (TreeStateSet) getModelObject();
if (!items.isInverse()) {
OrgTreePanel.this.setExpandedItems(items, getOrgTreeStateStorage());
}
}
};
tree.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
tree.getTable().add(AttributeModifier.replace("class", "table table-striped table-condensed"));
tree.add(new WindowsTheme());
// tree.add(AttributeModifier.replace("class", "tree-midpoint"));
treeContainer.add(tree);
}
use of org.apache.wicket.markup.html.WebMarkupContainer in project midpoint by Evolveum.
the class AsyncDashboardPanel method onPostSuccess.
@Override
protected void onPostSuccess(AjaxRequestTarget target) {
WebMarkupContainer dashboardContent = getDashboardContent();
dashboardContent.replace(getMainComponent(ID_CONTENT));
PageBase page = (PageBase) getPage();
showResultIfError(page);
target.add(this, page.getFeedbackPanel());
}
Aggregations