use of com.evolveum.midpoint.gui.impl.component.menu.LeftMenuPanel in project midpoint by Evolveum.
the class PageBase method initLayout.
private void initLayout() {
TransparentWebMarkupContainer body = new TransparentWebMarkupContainer(ID_BODY);
// body.add(new AttributeAppender("class", "hold-transition ", " "));
// body.add(new AttributeAppender("class", "custom-hold-transition ", " "));
body.add(AttributeAppender.append("class", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
if (info == null || StringUtils.isEmpty(info.getSkin())) {
return CLASS_DEFAULT_SKIN;
}
return info.getSkin();
}
}));
add(body);
WebMarkupContainer mainHeader = new WebMarkupContainer(ID_MAIN_HEADER);
mainHeader.setOutputMarkupId(true);
add(mainHeader);
AjaxLink<String> logo = new AjaxLink<>(ID_LOGO) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Class<? extends Page> page = MidPointApplication.get().getHomePage();
setResponsePage(page);
}
};
logo.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !isCustomLogoVisible();
}
@Override
public boolean isEnabled() {
return isLogoLinkEnabled();
}
});
mainHeader.add(logo);
AjaxLink<String> customLogo = new AjaxLink<>(ID_CUSTOM_LOGO) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
// TODO may be this should lead to customerUrl ?
Class<? extends Page> page = MidPointApplication.get().getHomePage();
setResponsePage(page);
}
};
customLogo.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isCustomLogoVisible();
}
});
mainHeader.add(customLogo);
WebMarkupContainer navigation = new WebMarkupContainer(ID_NAVIGATION);
navigation.setOutputMarkupId(true);
mainHeader.add(navigation);
IModel<IconType> logoModel = new IModel<>() {
private static final long serialVersionUID = 1L;
@Override
public IconType getObject() {
DeploymentInformationType info = MidPointApplication.get().getDeploymentInfo();
return info != null ? info.getLogo() : null;
}
};
ExternalImage customLogoImgSrc = new ExternalImage(ID_CUSTOM_LOGO_IMG_SRC) {
@Override
protected void buildSrcAttribute(ComponentTag tag, IModel<?> srcModel) {
tag.put("src", WebComponentUtil.getIconUrlModel(logoModel.getObject()).getObject());
}
};
customLogoImgSrc.add(new VisibleBehaviour(() -> logoModel.getObject() != null && StringUtils.isEmpty(logoModel.getObject().getCssClass())));
WebMarkupContainer customLogoImgCss = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_CSS);
customLogoImgCss.add(new VisibleBehaviour(() -> logoModel.getObject() != null && StringUtils.isNotEmpty(logoModel.getObject().getCssClass())));
customLogoImgCss.add(new AttributeAppender("class", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return logoModel.getObject() != null ? logoModel.getObject().getCssClass() : null;
}
}));
mainHeader.add(new AttributeAppender("style", new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
return logoModel.getObject() != null ? "background-color: " + GuiStyleConstants.DEFAULT_BG_COLOR + " !important;" : null;
}
}));
customLogo.add(customLogoImgSrc);
customLogo.add(customLogoImgCss);
Label title = new Label(ID_TITLE, createPageTitleModel());
title.setRenderBodyOnly(true);
add(title);
initHeaderLayout(navigation);
initTitleLayout(navigation);
logo.add(createHeaderColorStyleModel(false));
customLogo.add(createHeaderColorStyleModel(false));
mainHeader.add(createHeaderColorStyleModel(false));
navigation.add(createHeaderColorStyleModel(true));
initDebugBarLayout();
LeftMenuPanel sidebarMenu = new LeftMenuPanel(ID_SIDEBAR_MENU);
sidebarMenu.add(createUserStatusBehaviour());
add(sidebarMenu);
WebMarkupContainer footerContainer = new WebMarkupContainer(ID_FOOTER_CONTAINER);
footerContainer.add(new VisibleBehaviour(() -> !isErrorPage() && isFooterVisible()));
add(footerContainer);
WebMarkupContainer version = new WebMarkupContainer(ID_VERSION) {
private static final long serialVersionUID = 1L;
@Deprecated
public String getDescribe() {
return PageBase.this.getDescribe();
}
};
version.add(new VisibleBehaviour(() -> isFooterVisible() && RuntimeConfigurationType.DEVELOPMENT.equals(getApplication().getConfigurationType())));
footerContainer.add(version);
WebMarkupContainer copyrightMessage = new WebMarkupContainer(ID_COPYRIGHT_MESSAGE);
copyrightMessage.add(getFooterVisibleBehaviour());
footerContainer.add(copyrightMessage);
Label subscriptionMessage = new Label(ID_SUBSCRIPTION_MESSAGE, new IModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
String subscriptionId = getSubscriptionId();
if (StringUtils.isEmpty(subscriptionId)) {
return "";
}
if (!WebComponentUtil.isSubscriptionIdCorrect(subscriptionId)) {
return " " + createStringResource("PageBase.nonActiveSubscriptionMessage").getString();
}
if (SubscriptionType.DEMO_SUBSRIPTION.getSubscriptionType().equals(subscriptionId.substring(0, 2))) {
return " " + createStringResource("PageBase.demoSubscriptionMessage").getString();
}
return "";
}
});
subscriptionMessage.setOutputMarkupId(true);
subscriptionMessage.add(getFooterVisibleBehaviour());
footerContainer.add(subscriptionMessage);
WebMarkupContainer feedbackContainer = new WebMarkupContainer(ID_FEEDBACK_CONTAINER);
feedbackContainer.setOutputMarkupId(true);
feedbackContainer.setOutputMarkupPlaceholderTag(true);
add(feedbackContainer);
FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
feedbackList.setOutputMarkupId(true);
feedbackList.setOutputMarkupPlaceholderTag(true);
feedbackContainer.add(feedbackList);
MainPopupDialog mainPopup = new MainPopupDialog(ID_MAIN_POPUP);
// mainPopup.showUnloadConfirmation(false);
// mainPopup.setResizable(false);
add(mainPopup);
}
use of com.evolveum.midpoint.gui.impl.component.menu.LeftMenuPanel in project midpoint by Evolveum.
the class PageBase method getActiveMenu.
private <MI extends BaseMenuItem> MI getActiveMenu() {
LeftMenuPanel sideBarMenu = getSideBarMenuPanel();
if (sideBarMenu == null || !sideBarMenu.isVisible()) {
return null;
}
List<SideBarMenuItem> sideMenuItems = sideBarMenu.getItems();
if (CollectionUtils.isEmpty(sideMenuItems)) {
return null;
}
for (SideBarMenuItem sideBarMenuItem : sideMenuItems) {
MI activeMenu = sideBarMenuItem.getActiveMenu(PageBase.this);
if (activeMenu != null) {
return activeMenu;
}
}
return null;
}
Aggregations