use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractOrgTabPanel method initLayout.
private void initLayout() {
final IModel<List<ITab>> tabModel = new LoadableModel<List<ITab>>(false) {
private static final long serialVersionUID = 1L;
@Override
protected List<ITab> load() {
LOGGER.debug("Loading org. roots for tabs for tabbed panel.");
roots = loadOrgRoots();
final List<ITab> tabs = new ArrayList<>();
for (PrismObject<OrgType> root : roots) {
final String oid = root.getOid();
tabs.add(new AbstractTab(createTabTitle(root)) {
private static final long serialVersionUID = 1L;
private int tabId = tabs.size();
@Override
public WebMarkupContainer getPanel(String panelId) {
add(new AjaxEventBehavior("load") {
private static final long serialVersionUID = 1L;
protected void onEvent(final AjaxRequestTarget target) {
SessionStorage storage = getPageBase().getSessionStorage();
storage.getUsers().setSelectedTabId(tabId);
}
});
Panel panel = createTreePanel(panelId, new Model(oid), getPageBase());
panel.setOutputMarkupId(true);
return panel;
}
});
}
LOGGER.debug("Tab count is {}", new Object[] { tabs.size() });
return tabs;
}
};
final SessionStorage storage = getPageBase().getSessionStorage();
int selectedTab = storage.getUsers().getSelectedTabId() == -1 ? 0 : storage.getUsers().getSelectedTabId();
List<ITab> tabsList = tabModel.getObject();
if (tabsList == null || (selectedTab > tabsList.size() - 1)) {
storage.getUsers().setSelectedTabId(0);
selectedTab = 0;
}
AjaxTabbedPanel<ITab> tabbedPanel = new AjaxTabbedPanel<ITab>(ID_TABS, tabModel.getObject(), new Model<>(selectedTab), null) {
private static final long serialVersionUID = 1L;
@Override
public TabbedPanel<ITab> setSelectedTab(int index) {
changeTabPerformed(index);
return super.setSelectedTab(index);
}
};
tabbedPanel.setOutputMarkupId(true);
if (tabsList == null || tabsList.size() == 0) {
tabbedPanel.setVisible(false);
}
add(tabbedPanel);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class OrgTreeAssignablePanel method initLayout.
private void initLayout() {
AbstractOrgTabPanel tabbedPanel = new AbstractOrgTabPanel(ID_ORG_TABS, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected Panel createTreePanel(String id, Model<String> model, PageBase pageBase) {
OrgTreePanel panel = new OrgTreePanel(id, model, selectable) {
private static final long serialVersionUID = 1L;
@Override
protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
onItemSelect(selected, target);
}
};
panel.setOutputMarkupId(true);
return panel;
}
};
tabbedPanel.setOutputMarkupId(true);
add(tabbedPanel);
AjaxButton assignButton = new AjaxButton(ID_ASSIGN, getPageBase().createStringResource("Button.assign")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AbstractOrgTabPanel orgPanel = (AbstractOrgTabPanel) getParent().get(ID_ORG_TABS);
OrgTreePanel treePanel = (OrgTreePanel) orgPanel.getPanel();
List<OrgType> selectedOrgs = treePanel.getSelectedOrgs();
assignSelectedOrgPerformed(selectedOrgs, target);
}
};
assignButton.setOutputMarkupId(true);
assignButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return selectable;
}
});
add(assignButton);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class AbstractTreeTablePanel method createOrgChildQuery.
protected ObjectQuery createOrgChildQuery() {
SelectableBean<OrgType> dto = selected.getObject();
String oid = dto != null && dto.getValue() != null ? dto.getValue().getOid() : getModel().getObject();
BasicSearchPanel<String> basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH));
String object = basicSearch.getModelObject();
DropDownChoice<String> searchScopeChoice = (DropDownChoice) get(createComponentPath(ID_SEARCH_FORM, ID_SEARCH_SCOPE));
String scope = searchScopeChoice.getModelObject();
if (StringUtils.isBlank(object)) {
object = null;
}
PageBase page = getPageBase();
PrismContext context = page.getPrismContext();
S_AtomicFilterExit q;
if (object == null || SEARCH_SCOPE_ONE.equals(scope)) {
q = QueryBuilder.queryFor(OrgType.class, context).isDirectChildOf(oid);
} else {
q = QueryBuilder.queryFor(OrgType.class, context).isChildOf(oid);
}
if (object == null) {
return q.build();
}
PolyStringNormalizer normalizer = context.getDefaultPolyStringNormalizer();
String normalizedString = normalizer.normalize(object);
if (StringUtils.isEmpty(normalizedString)) {
return q.build();
}
ObjectQuery query = q.and().block().item(OrgType.F_NAME).containsPoly(normalizedString).matchingNorm().or().item(OrgType.F_DISPLAY_NAME).containsPoly(normalizedString).matchingNorm().build();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Searching child orgs of org {} with query:\n{}", oid, query.debugDump());
}
return query;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class OrgUnitAddDeletePopup method initColumns.
private List<IColumn<SelectableBean<ObjectType>, String>> initColumns() {
List<IColumn<SelectableBean<ObjectType>, String>> columns = new ArrayList<IColumn<SelectableBean<ObjectType>, String>>();
IColumn column = new CheckBoxHeaderColumn<OrgType>();
columns.add(column);
column = new LinkColumn<SelectableBean<OrgType>>(createStringResource("orgUnitAddDeletePopup.column.name"), getSortableProperty(), "value.name") {
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<OrgType>> rowModel) {
OrgType org = rowModel.getObject().getValue();
chooseOperationPerformed(target, org);
}
};
columns.add(column);
return columns;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType in project midpoint by Evolveum.
the class OrgTreeProvider method createObjectWrapper.
private SelectableBean<OrgType> createObjectWrapper(SelectableBean<OrgType> parent, PrismObject<OrgType> unit) {
if (unit == null) {
return null;
}
//todo relation [lazyman]
// OrgTreeDto orgDto = new OrgTreeDto(parent, unit);
OrgType org = unit.asObjectable();
if (parent != null) {
org.getParentOrg().clear();
org.getParentOrg().add(parent.getValue());
}
SelectableBean<OrgType> orgDto = new SelectableBean<OrgType>(org);
orgDto.getMenuItems().addAll(createInlineMenuItems(orgDto.getValue()));
return orgDto;
}
Aggregations