use of com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method initMemberTable.
private void initMemberTable(TableId tableId, Form form) {
WebMarkupContainer memberContainer = new WebMarkupContainer(ID_CONTAINER_MEMBER);
memberContainer.setOutputMarkupId(true);
memberContainer.setOutputMarkupPlaceholderTag(true);
form.add(memberContainer);
MainObjectListPanel<ObjectType> childrenListPanel = new MainObjectListPanel<ObjectType>(ID_MEMBER_TABLE, ObjectType.class, tableId, getSearchOptions(), getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ObjectType object) {
detailsPerformed(target, object);
}
@Override
protected boolean isClickable(IModel<SelectableBean<ObjectType>> rowModel) {
if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getValue() == null) {
return false;
}
Class<?> objectClass = rowModel.getObject().getValue().getClass();
return WebComponentUtil.hasDetailsPage(objectClass);
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
AbstractRoleMemberPanel.this.createFocusMemberPerformed(null, target);
}
@Override
protected List<IColumn<SelectableBean<ObjectType>, String>> createColumns() {
return createMembersColumns();
}
@Override
protected IColumn<SelectableBean<ObjectType>, String> createActionsColumn() {
return new InlineMenuHeaderColumn(createMembersHeaderInlineMenu());
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return new ArrayList<>();
}
@Override
protected ObjectQuery createContentQuery() {
ObjectQuery q = super.createContentQuery();
ObjectQuery members = AbstractRoleMemberPanel.this.createContentQuery();
List<ObjectFilter> filters = new ArrayList<>();
if (q != null && q.getFilter() != null) {
filters.add(q.getFilter());
}
if (members != null && members.getFilter() != null) {
filters.add(members.getFilter());
}
if (filters.size() == 1) {
return ObjectQuery.createObjectQuery(filters.iterator().next());
}
return ObjectQuery.createObjectQuery(AndFilter.createAnd(filters));
}
};
childrenListPanel.setOutputMarkupId(true);
memberContainer.add(childrenListPanel);
}
use of com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn 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 com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn in project midpoint by Evolveum.
the class PageCertCampaigns method initColumns.
private List<IColumn<CertCampaignListItemDto, String>> initColumns() {
List<IColumn<CertCampaignListItemDto, String>> columns = new ArrayList<>();
IColumn column;
column = new CheckBoxHeaderColumn<>();
columns.add(column);
column = new LinkColumn<CertCampaignListItemDto>(createStringResource("PageCertCampaigns.table.name"), AccessCertificationCampaignType.F_NAME.getLocalPart(), CertCampaignListItemDto.F_NAME) {
@Override
public void onClick(AjaxRequestTarget target, IModel<CertCampaignListItemDto> rowModel) {
campaignDetailsPerformed(target, rowModel.getObject().getOid());
}
};
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.description"), CertCampaignListItemDto.F_DESCRIPTION);
columns.add(column);
column = new EnumPropertyColumn(createStringResource("PageCertCampaigns.table.state"), CertCampaignListItemDto.F_STATE) {
@Override
protected String translate(Enum en) {
return createStringResourceStatic(getPage(), en).getString();
}
};
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.stage"), CertCampaignListItemDto.F_CURRENT_STAGE_NUMBER);
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.escalationLevel"), CertCampaignListItemDto.F_ESCALATION_LEVEL_NUMBER);
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.stages"), CertCampaignListItemDto.F_NUMBER_OF_STAGES);
columns.add(column);
column = new PropertyColumn(createStringResource("PageCertCampaigns.table.deadline"), CertCampaignListItemDto.F_DEADLINE_AS_STRING);
columns.add(column);
column = new SingleButtonColumn<CertCampaignListItemDto>(new Model(), null) {
@Override
public boolean isButtonEnabled(IModel<CertCampaignListItemDto> model) {
final AccessCertificationCampaignType campaign = model.getObject().getCampaign();
String button = determineAction(campaign);
return button != null;
}
@Override
public boolean isButtonVisible(IModel<CertCampaignListItemDto> model) {
final AccessCertificationCampaignType campaign = model.getObject().getCampaign();
return campaign.getState() != AccessCertificationCampaignStateType.IN_REMEDIATION && campaign.getState() != AccessCertificationCampaignStateType.CLOSED;
}
@Override
public String getCaption() {
AccessCertificationCampaignType campaign = getRowModel().getObject().getCampaign();
String button = determineAction(campaign);
if (button != null) {
return PageCertCampaigns.this.createStringResource(button).getString();
} else {
return "";
}
}
@Override
public String getButtonCssColorClass() {
return DoubleButtonColumn.BUTTON_COLOR_CLASS.PRIMARY.toString();
}
@Override
public String getButtonCssSizeClass() {
return DoubleButtonColumn.BUTTON_SIZE_CLASS.SMALL.toString();
}
@Override
public void clickPerformed(AjaxRequestTarget target, IModel<CertCampaignListItemDto> model) {
AccessCertificationCampaignType campaign = model.getObject().getCampaign();
String action = determineAction(campaign);
switch(action) {
case OP_START_CAMPAIGN:
case OP_OPEN_NEXT_STAGE:
openNextStagePerformed(target, campaign);
break;
case OP_CLOSE_STAGE:
closeStageConfirmation(target, model.getObject());
break;
case OP_START_REMEDIATION:
startRemediationPerformed(target, campaign);
break;
// not used
case OP_CLOSE_CAMPAIGN:
default:
throw new IllegalStateException("Unknown action: " + action);
}
}
};
columns.add(column);
columns.add(new InlineMenuHeaderColumn(createInlineMenu()));
return columns;
}
use of com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn in project midpoint by Evolveum.
the class ResourceContentPanel method initLayout.
private void initLayout() {
WebMarkupContainer totals = new WebMarkupContainer(ID_TOTALS);
totals.setOutputMarkupId(true);
add(totals);
initShadowStatistics(totals);
MainObjectListPanel<ShadowType> shadowListPanel = new MainObjectListPanel<ShadowType>(ID_TABLE, ShadowType.class, getTableId(), null, pageBase) {
private static final long serialVersionUID = 1L;
@Override
protected List<InlineMenuItem> createInlineMenu() {
return ResourceContentPanel.this.createRowMenuItems();
}
@Override
protected List<IColumn<SelectableBean<ShadowType>, String>> createColumns() {
return ResourceContentPanel.this.initColumns();
}
@Override
protected IColumn<SelectableBean<ShadowType>, String> createActionsColumn() {
return new InlineMenuHeaderColumn(createHeaderMenuItems());
}
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ShadowType object) {
shadowDetailsPerformed(target, WebComponentUtil.getName(object), object.getOid());
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
// TODO Auto-generated method stub
}
@Override
protected BaseSortableDataProvider<SelectableBean<ShadowType>> initProvider() {
provider = (SelectableBeanObjectDataProvider<ShadowType>) super.initProvider();
provider.setEmptyListOnNullQuery(true);
provider.setSort(null);
createSearchOptions(provider);
return provider;
}
@Override
protected ObjectQuery createContentQuery() {
ObjectQuery parentQuery = super.createContentQuery();
List<ObjectFilter> filters = new ArrayList<>();
if (parentQuery != null) {
filters.add(parentQuery.getFilter());
}
ObjectQuery customQuery = ResourceContentPanel.this.createQuery();
if (customQuery != null && customQuery.getFilter() != null) {
filters.add(customQuery.getFilter());
}
ObjectQuery query = new ObjectQuery();
if (filters.size() == 1) {
query = ObjectQuery.createObjectQuery(filters.iterator().next());
// setProviderAvailableDataSize(query);
return query;
}
if (filters.size() == 0) {
// setProviderAvailableDataSize(query);
return null;
}
query = ObjectQuery.createObjectQuery(AndFilter.createAnd(filters));
// setProviderAvailableDataSize(query);
return query;
}
@Override
protected Search createSearch() {
return ResourceContentPanel.this.createSearch();
}
};
shadowListPanel.setOutputMarkupId(true);
shadowListPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return createQuery() != null;
}
});
shadowListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_SHADOW_BOX_CSS_CLASSES);
add(shadowListPanel);
Label label = new Label(ID_LABEL, "Nothing to show. Select intent to search");
add(label);
label.setOutputMarkupId(true);
label.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return createQuery() == null;
}
});
OperationResult result = new OperationResult(OPERATION_SEARCH_TASKS_FOR_RESOURCE);
List<PrismObject<TaskType>> tasks = WebModelServiceUtils.searchObjects(TaskType.class, QueryBuilder.queryFor(TaskType.class, getPageBase().getPrismContext()).item(TaskType.F_OBJECT_REF).ref(getResourceModel().getObject().getOid()).build(), result, getPageBase());
List<TaskType> tasksForKind = getTasksForKind(tasks);
List<TaskType> importTasks = new ArrayList<>();
List<TaskType> syncTasks = new ArrayList<>();
List<TaskType> reconTasks = new ArrayList<>();
for (TaskType task : tasksForKind) {
if (TaskCategory.RECONCILIATION.equals(task.getCategory())) {
reconTasks.add(task);
} else if (TaskCategory.LIVE_SYNCHRONIZATION.equals(task.getCategory())) {
syncTasks.add(task);
} else if (TaskCategory.IMPORTING_ACCOUNTS.equals(task.getCategory())) {
importTasks.add(task);
}
}
initButton(ID_IMPORT, "Import", " fa-download", TaskCategory.IMPORTING_ACCOUNTS, importTasks);
initButton(ID_RECONCILIATION, "Reconciliation", " fa-link", TaskCategory.RECONCILIATION, reconTasks);
initButton(ID_LIVE_SYNC, "Live Sync", " fa-refresh", TaskCategory.LIVE_SYNCHRONIZATION, syncTasks);
initCustomLayout();
}
use of com.evolveum.midpoint.web.component.data.column.InlineMenuHeaderColumn in project midpoint by Evolveum.
the class PageConnectorHosts method initConnectorHostsColumns.
private List<IColumn<ConnectorHostType, String>> initConnectorHostsColumns() {
List<IColumn<ConnectorHostType, String>> columns = new ArrayList<>();
IColumn column = new CheckBoxHeaderColumn<ConnectorHostType>();
columns.add(column);
column = new LinkColumn<SelectableBean<ConnectorHostType>>(createStringResource("pageResources.connector.name"), "name", "value.name") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ConnectorHostType>> rowModel) {
ConnectorHostType host = rowModel.getObject().getValue();
// resourceDetailsPerformed(target, host.getOid());
}
};
columns.add(column);
columns.add(new PropertyColumn(createStringResource("pageResources.connector.hostname"), "value.hostname"));
columns.add(new PropertyColumn(createStringResource("pageResources.connector.port"), "value.port"));
columns.add(new PropertyColumn(createStringResource("pageResources.connector.timeout"), "value.timeout"));
columns.add(new CheckBoxColumn(createStringResource("pageResources.connector.protectConnection"), "value.protectConnection"));
InlineMenuHeaderColumn menu = new InlineMenuHeaderColumn(initInlineHostsMenu());
columns.add(menu);
return columns;
}
Aggregations