use of org.apache.wicket.request.resource.PackageResourceReference in project midpoint by Evolveum.
the class PrismOptionButtonPanel method initButtons.
private void initButtons(final IModel<ObjectWrapper> model) {
AjaxLink showEmpty = new AjaxLink("showEmptyButton") {
@Override
public void onClick(AjaxRequestTarget target) {
showEmptyOnClick(target);
}
};
add(showEmpty);
showEmpty.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !model.getObject().isReadonly();
}
});
Image showEmptyImg = new Image("showEmptyImg", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isShowEmpty()) {
return new PackageResourceReference(PrismObjectPanel.class, "ShowEmptyFalse.png");
}
return new PackageResourceReference(PrismObjectPanel.class, "ShowEmptyTrue.png");
}
});
showEmptyImg.add(new AttributeAppender("title", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isShowEmpty()) {
return getString("prismOptionButtonPanel.hideEmpty");
}
return getString("prismOptionButtonPanel.showEmpty");
}
}, ""));
showEmpty.add(showEmptyImg);
AjaxLink minimize = new AjaxLink("minimizeButton") {
@Override
public void onClick(AjaxRequestTarget target) {
minimizeOnClick(target);
}
};
add(minimize);
Image minimizeImg = new Image("minimizeImg", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isMinimalized()) {
return new PackageResourceReference(PrismObjectPanel.class, "Maximize.png");
}
return new PackageResourceReference(PrismObjectPanel.class, "Minimize.png");
}
});
minimizeImg.add(new AttributeAppender("title", new AbstractReadOnlyModel() {
@Override
public Object getObject() {
ObjectWrapper wrapper = model.getObject();
if (wrapper.isMinimalized()) {
return getString("prismOptionButtonPanel.maximize");
}
return getString("prismOptionButtonPanel.minimize");
}
}, ""));
minimize.add(minimizeImg);
}
use of org.apache.wicket.request.resource.PackageResourceReference in project midpoint by Evolveum.
the class FocusDetailsTabPanel method initLayout.
private void initLayout() {
PrismObjectPanel<F> panel = new PrismObjectPanel<F>(ID_FOCUS_FORM, getObjectWrapperModel(), new PackageResourceReference(ImgResources.class, ImgResources.USER_PRISM), getMainForm(), getPageBase());
add(panel);
}
use of org.apache.wicket.request.resource.PackageResourceReference 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 org.apache.wicket.request.resource.PackageResourceReference in project midpoint by Evolveum.
the class PageAccount method initLayout.
private void initLayout() {
Form mainForm = new Form("mainForm");
mainForm.setMultiPart(true);
add(mainForm);
WebMarkupContainer protectedMessage = new WebMarkupContainer(ID_PROTECTED_MESSAGE);
protectedMessage.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
ObjectWrapper wrapper = accountModel.getObject();
return wrapper.isProtectedAccount();
}
});
mainForm.add(protectedMessage);
PrismObjectPanel<ShadowType> userForm = new PrismObjectPanel<ShadowType>("account", accountModel, new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM), mainForm, this);
mainForm.add(userForm);
initButtons(mainForm);
}
use of org.apache.wicket.request.resource.PackageResourceReference in project ocvn by devgateway.
the class EditVietnamImportSourceFiles method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
TextFieldBootstrapFormComponent<String> name = new TextFieldBootstrapFormComponent<>("name");
name.required();
editForm.add(name);
TextAreaFieldBootstrapFormComponent<String> description = new TextAreaFieldBootstrapFormComponent<>("description");
editForm.add(description);
FileInputBootstrapFormComponent prototypeDatabaseFile = new FileInputBootstrapFormComponent("prototypeDatabaseFile");
prototypeDatabaseFile.maxFiles(1);
prototypeDatabaseFile.required();
editForm.add(prototypeDatabaseFile);
FileInputBootstrapFormComponent publicInstitutionsSuppliersFile = new FileInputBootstrapFormComponent("publicInstitutionsSuppliersFile");
publicInstitutionsSuppliersFile.maxFiles(1);
publicInstitutionsSuppliersFile.required();
editForm.add(publicInstitutionsSuppliersFile);
FileInputBootstrapFormComponent cityDepartmentGroupFile = new FileInputBootstrapFormComponent("cityDepartmentGroupFile");
cityDepartmentGroupFile.maxFiles(1);
cityDepartmentGroupFile.required();
editForm.add(cityDepartmentGroupFile);
ResourceLink locationsTemplate = new ResourceLink("locationsTemplate", new PackageResourceReference(RootXlsx.class, "Location_Table_SO.xlsx"));
editForm.add(locationsTemplate);
ResourceLink suppliersTemplate = new ResourceLink("suppliersTemplate", new PackageResourceReference(RootXlsx.class, "UM_PUBINSTITU_SUPPLIERS_DQA.xlsx"));
editForm.add(suppliersTemplate);
ResourceLink prototypeDatabase = new ResourceLink("prototypeDatabase", new PackageResourceReference(RootXlsx.class, "Prototype_Database_OCDSCore.xlsx"));
editForm.add(prototypeDatabase);
ResourceLink cityDepartmentGroupFileTemplate = new ResourceLink("cityDepartmentGroupFileTemplate", new PackageResourceReference(RootXlsx.class, "test_city_department_group.xlsx"));
editForm.add(cityDepartmentGroupFileTemplate);
FileInputBootstrapFormComponent locationsFile = new FileInputBootstrapFormComponent("locationsFile");
locationsFile.maxFiles(1);
locationsFile.required();
editForm.add(locationsFile);
}
Aggregations