use of com.evolveum.midpoint.web.component.message.FeedbackAlerts in project midpoint by Evolveum.
the class PageBase method initLayout.
private void initLayout() {
WebMarkupContainer mainHeader = new WebMarkupContainer(ID_MAIN_HEADER);
mainHeader.setOutputMarkupId(true);
add(mainHeader);
AjaxLink 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() {
@Override
public boolean isVisible() {
return !isCustomLogoVisible();
}
});
mainHeader.add(logo);
AjaxLink 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() {
@Override
public boolean isVisible() {
return isCustomLogoVisible();
}
});
mainHeader.add(customLogo);
WebMarkupContainer navigation = new WebMarkupContainer(ID_NAVIGATION);
mainHeader.add(navigation);
WebMarkupContainer customLogoImgSrc = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_SRC);
WebMarkupContainer customLogoImgCss = new WebMarkupContainer(ID_CUSTOM_LOGO_IMG_CSS);
if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null && deploymentInfoModel.getObject().getLogo() != null) {
if (StringUtils.isNotEmpty(deploymentInfoModel.getObject().getLogo().getCssClass())) {
customLogoImgCss.add(new AttributeAppender("class", deploymentInfoModel.getObject().getLogo().getCssClass()));
customLogoImgSrc.setVisible(false);
} else {
customLogoImgSrc.add(new AttributeAppender("src", deploymentInfoModel.getObject().getLogo().getImageUrl()));
customLogoImgCss.setVisible(false);
}
mainHeader.add(new AttributeAppender("style", "background-color: " + GuiStyleConstants.DEFAULT_BG_COLOR + "; !important;"));
}
customLogo.add(customLogoImgSrc);
customLogo.add(customLogoImgCss);
Label title = new Label(ID_TITLE, createPageTitleModel());
title.setRenderBodyOnly(true);
add(title);
initHeaderLayout(navigation);
initTitleLayout(navigation);
if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null && StringUtils.isNotEmpty(deploymentInfoModel.getObject().getHeaderColor())) {
logo.add(new AttributeAppender("style", "background-color: " + deploymentInfoModel.getObject().getHeaderColor() + "; !important;"));
customLogo.add(new AttributeAppender("style", "background-color: " + deploymentInfoModel.getObject().getHeaderColor() + "; !important;"));
mainHeader.add(new AttributeAppender("style", "background-color: " + deploymentInfoModel.getObject().getHeaderColor() + "; !important;"));
navigation.add(new AttributeAppender("style", "background-color: " + deploymentInfoModel.getObject().getHeaderColor() + "; !important;"));
}
initDebugBarLayout();
List<SideBarMenuItem> menuItems = createMenuItems();
SideBarMenuPanel sidebarMenu = new SideBarMenuPanel(ID_SIDEBAR_MENU, new Model((Serializable) menuItems));
sidebarMenu.add(createUserStatusBehaviour(true));
add(sidebarMenu);
WebMarkupContainer footerContainer = new WebMarkupContainer(ID_FOOTER_CONTAINER);
footerContainer.setOutputMarkupId(true);
footerContainer.add(getFooterVisibleBehaviour());
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 VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return 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 AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
String subscriptionId = getSubscriptionId();
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);
add(feedbackContainer);
FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
feedbackList.setOutputMarkupId(true);
feedbackContainer.add(feedbackList);
MainPopupDialog mainPopup = new MainPopupDialog(ID_MAIN_POPUP);
mainPopup.setOutputMarkupId(true);
add(mainPopup);
}
Aggregations