use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class MultiButtonPanel method initLayout.
protected void initLayout() {
RepeatingView buttons = new RepeatingView(ID_BUTTONS);
add(buttons);
for (int id = 0; id < numberOfButtons; id++) {
final int finalId = getButtonId(id);
AjaxButton button = new AjaxButton(String.valueOf(finalId), createStringResource(getCaption(finalId))) {
@Override
public void onClick(AjaxRequestTarget target) {
clickPerformed(finalId, target, MultiButtonPanel.this.getModel());
}
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
}
@Override
public boolean isEnabled() {
return MultiButtonPanel.this.isButtonEnabled(finalId, MultiButtonPanel.this.getModel());
}
@Override
public boolean isVisible() {
return MultiButtonPanel.this.isButtonVisible(finalId, MultiButtonPanel.this.getModel());
}
};
button.add(new AttributeAppender("class", getButtonCssClass(finalId)));
button.add(new AttributeAppender("title", getButtonTitle(finalId)));
buttons.add(button);
buttons.add(new Label("label" + finalId, " "));
}
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class TargetUserSelectorComponent method initLayout.
private void initLayout() {
AjaxLink<String> targetUserButton = new AjaxLink<String>(ID_TARGET_USER_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (showUserSelectionPopup) {
initUserSelectionPopup(createStringResource("AssignmentCatalogPanel.selectTargetUser"), true, target);
}
showUserSelectionPopup = true;
}
};
targetUserButton.add(new AttributeAppender("class", "btn btn-default" + (StringUtils.isEmpty(additionalButtonStyle) ? "" : " " + additionalButtonStyle)));
targetUserButton.setOutputMarkupId(true);
targetUserButton.add(new AttributeAppender("title", getTargetUsersButtonTitle()));
add(targetUserButton);
Label label = new Label(ID_TARGET_USER_LABEL, createStringResource("AssignmentCatalogPanel.selectTargetUser"));
label.setRenderBodyOnly(true);
targetUserButton.add(label);
AjaxLink deleteButton = new AjaxLink(ID_DELETE_TARGET_USER_BUTTON) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showUserSelectionPopup = false;
getRoleCatalogStorage().setTargetUserList(null);
target.add(pageBase);
}
};
deleteButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getRoleCatalogStorage().getTargetUserList() != null && getRoleCatalogStorage().getTargetUserList().size() > 0;
}
});
targetUserButton.add(deleteButton);
}
use of org.apache.wicket.behavior.AttributeAppender 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);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class ProcessInstancesPanel method initLayout.
private void initLayout(UserProfileStorage.TableId tableId, int pageSize, View view, final IModel<String> currentInstanceIdModel) {
BoxedTablePanel<ProcessInstanceDto> table = new BoxedTablePanel<ProcessInstanceDto>(ID_REQUESTS_TABLE, provider, initColumns(view), tableId, pageSize) {
@Override
protected Item<ProcessInstanceDto> customizeNewRowItem(Item<ProcessInstanceDto> item, final IModel<ProcessInstanceDto> rowModel) {
item.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
if (currentInstanceIdModel == null || currentInstanceIdModel.getObject() == null) {
return "";
}
ProcessInstanceDto rowDto = rowModel.getObject();
if (currentInstanceIdModel.getObject().equals(rowDto.getProcessInstanceId())) {
return "info";
} else {
return "";
}
}
}));
return item;
}
};
table.setOutputMarkupId(true);
table.setAdditionalBoxCssClasses("without-box-header-top-border");
add(table);
}
use of org.apache.wicket.behavior.AttributeAppender in project midpoint by Evolveum.
the class OrgUnitAddDeletePopup method initLayout.
public void initLayout(WebMarkupContainer content) {
List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
ObjectDataProvider provider = new ObjectDataProvider(getPageBase(), OrgType.class);
provider.setQuery(getDataProviderQuery());
TablePanel table = new TablePanel<SelectableBean<ObjectType>>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
content.add(table);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("orgUnitAddDeletePopup.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
cancelPerformed(ajaxRequestTarget);
}
};
content.add(cancelButton);
AjaxButton actionButton = new AjaxButton(ID_BUTTON_ACTION, createActionButtonStringResource()) {
@Override
public void onClick(AjaxRequestTarget target) {
actionPerformed(target);
}
};
actionButton.add(new AttributeAppender("class", getActionButtonClass()));
content.add(actionButton);
}
Aggregations