use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class DeltaPanel method initLayout.
protected void initLayout() {
Label changeType = new Label(ID_CHANGE_TYPE, new PropertyModel<String>(getModel(), DeltaDto.F_CHANGE_TYPE));
add(changeType);
VisibleEnableBehaviour isAdd = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModel().getObject().isAdd();
}
};
VisibleEnableBehaviour isNotAdd = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getModel().getObject().isAdd();
}
};
Label oidLabel = new Label(ID_OID_LABEL, new ResourceModel("DeltaPanel.label.oid"));
oidLabel.add(isNotAdd);
add(oidLabel);
Label oid = new Label(ID_OID, new PropertyModel<String>(getModel(), DeltaDto.F_OID));
oid.add(isNotAdd);
add(oid);
VisibleEnableBehaviour never = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return false;
}
};
Label objectToAddLabel = new Label(ID_OBJECT_TO_ADD_LABEL, new ResourceModel("DeltaPanel.label.objectToAdd"));
//objectToAddLabel.add(isAdd);
objectToAddLabel.add(never);
add(objectToAddLabel);
ContainerValuePanel objectToAddPanel = new ContainerValuePanel(ID_OBJECT_TO_ADD, new PropertyModel<ContainerValueDto>(getModel(), DeltaDto.F_OBJECT_TO_ADD));
objectToAddPanel.add(isAdd);
add(objectToAddPanel);
Label modificationsLabel = new Label(ID_MODIFICATIONS_LABEL, new ResourceModel("DeltaPanel.label.modifications"));
//modificationsLabel.add(isNotAdd);
modificationsLabel.add(never);
add(modificationsLabel);
ModificationsPanel modificationsPanel = new ModificationsPanel(ID_MODIFICATIONS, getModel());
modificationsPanel.add(isNotAdd);
add(modificationsPanel);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class ModelOperationStatusPanel method initLayout.
protected void initLayout() {
add(new Label(ID_STATE, new StringResourceModel("ModelOperationStatusPanel.state.${}", new PropertyModel<ModelState>(getModel(), ModelOperationStatusDto.F_STATE))));
// add(new Label(ID_FOCUS_TYPE, new PropertyModel<String>(getModel(), ModelOperationStatusDto.F_FOCUS_TYPE)));
// add(new Label(ID_FOCUS_NAME, new PropertyModel<String>(getModel(), ModelOperationStatusDto.F_FOCUS_NAME)));
ScenePanel deltaPanel = new ScenePanel(ID_PRIMARY_DELTA, new PropertyModel<SceneDto>(getModel(), ModelOperationStatusDto.F_PRIMARY_DELTA));
deltaPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject() != null && getModelObject().getPrimaryDelta() != null;
}
});
add(deltaPanel);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method initLayout.
private void initLayout(final PageBase page) {
final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
shadows.setOutputMarkupId(true);
add(shadows);
InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
accountMenu.setVisible(!getObjectWrapper().isReadonly());
shadows.add(accountMenu);
final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
PackageResourceReference packageRef;
final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
final Panel shadowPanel;
if (dto.isLoadedOK()) {
packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
} else {
shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onShowMorePerformed(AjaxRequestTarget target) {
OperationResult fetchResult = dto.getResult();
if (fetchResult != null) {
showResult(fetchResult);
target.add(page.getFeedbackPanel());
}
}
};
}
shadowPanel.setOutputMarkupId(true);
shadowPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
return !shadowWrapper.isMinimalized();
}
});
item.add(shadowPanel);
CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {
private static final long serialVersionUID = 1L;
@Override
protected void onClickPerformed(AjaxRequestTarget target) {
super.onClickPerformed(target);
onExpandCollapse(target, item.getModel());
target.add(shadows);
}
};
if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
}
item.add(shadowHeader);
}
};
AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
if (dto.isLoadedOK()) {
ObjectWrapper<ShadowType> accModel = dto.getObject();
accModel.setSelected(getModelObject());
}
}
target.add(shadows);
}
};
shadows.add(accountCheckAll);
shadows.add(projectionList);
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class UploadDownloadPanel method initLayout.
private void initLayout(final boolean isReadOnly) {
final FileUploadField fileUpload = new FileUploadField(ID_INPUT_FILE);
Form form = this.findParent(Form.class);
fileUpload.add(new AjaxFormSubmitBehavior(form, "change") {
@Override
protected void onSubmit(AjaxRequestTarget target) {
super.onSubmit(target);
UploadDownloadPanel.this.uploadFilePerformed(target);
}
@Override
protected void onError(AjaxRequestTarget target) {
super.onError(target);
UploadDownloadPanel.this.uploadFilePerformed(target);
}
});
fileUpload.setOutputMarkupId(true);
add(fileUpload);
final AjaxDownloadBehaviorFromStream downloadBehavior = new AjaxDownloadBehaviorFromStream() {
@Override
protected InputStream initStream() {
return getStream();
}
};
add(downloadBehavior);
add(new AjaxSubmitButton(ID_BUTTON_DOWNLOAD) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
downloadPerformed(downloadBehavior, target);
}
});
add(new AjaxSubmitButton(ID_BUTTON_DELETE) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
removeFilePerformed(target);
}
});
add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !isReadOnly;
}
});
}
use of com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour in project midpoint by Evolveum.
the class MainMenuPanel method initLayout.
private void initLayout() {
final MainMenuItem menu = getModelObject();
WebMarkupContainer item = new WebMarkupContainer(ID_ITEM);
item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
if (menu.isMenuActive((WebPage) getPage())) {
return "active";
}
for (MenuItem item : menu.getItems()) {
if (item.isMenuActive((WebPage) getPage())) {
return "active";
}
}
return !menu.getItems().isEmpty() ? "treeview" : null;
}
}));
add(item);
WebMarkupContainer link;
if (menu.getPageClass() != null) {
link = new AjaxLink(ID_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
mainMenuPerformed(menu);
}
};
} else if (menu instanceof AdditionalMenuItem) {
link = new AjaxLink(ID_LINK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
additionalMenuPerformed(menu);
}
};
} else {
link = new WebMarkupContainer(ID_LINK);
}
item.add(link);
WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeModifier.replace("class", new PropertyModel<>(menu, MainMenuItem.F_ICON_CLASS)));
link.add(icon);
Label label = new Label(ID_LABEL, menu.getNameModel());
link.add(label);
final PropertyModel<String> bubbleModel = new PropertyModel<>(menu, MainMenuItem.F_BUBBLE_LABEL);
Label bubble = new Label(ID_BUBBLE, bubbleModel);
bubble.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return bubbleModel.getObject() != null;
}
});
link.add(bubble);
WebMarkupContainer arrow = new WebMarkupContainer(ID_ARROW);
arrow.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !menu.getItems().isEmpty() && bubbleModel.getObject() == null;
}
});
link.add(arrow);
WebMarkupContainer submenu = new WebMarkupContainer(ID_SUBMENU);
submenu.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !menu.getItems().isEmpty();
}
});
item.add(submenu);
ListView<MenuItem> subItem = new ListView<MenuItem>(ID_SUB_ITEM, new Model((Serializable) menu.getItems())) {
@Override
protected void populateItem(ListItem<MenuItem> listItem) {
createSubmenu(listItem);
}
};
submenu.add(subItem);
}
Aggregations