Search in sources :

Example 1 with PackageResourceReference

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);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) Image(org.apache.wicket.markup.html.image.Image) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 2 with PackageResourceReference

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);
}
Also used : ImgResources(com.evolveum.midpoint.web.resource.img.ImgResources) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) PrismObjectPanel(com.evolveum.midpoint.web.component.prism.PrismObjectPanel)

Example 3 with PackageResourceReference

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);
}
Also used : Serializable(java.io.Serializable) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ImgResources(com.evolveum.midpoint.web.resource.img.ImgResources) ListView(org.apache.wicket.markup.html.list.ListView) FocusSubwrapperDto(com.evolveum.midpoint.web.page.admin.users.dto.FocusSubwrapperDto) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) InlineMenu(com.evolveum.midpoint.web.component.menu.cog.InlineMenu) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) AttributeModifier(org.apache.wicket.AttributeModifier) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel) Panel(org.apache.wicket.markup.html.panel.Panel) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 4 with PackageResourceReference

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);
}
Also used : ImgResources(com.evolveum.midpoint.web.resource.img.ImgResources) Form(org.apache.wicket.markup.html.form.Form) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ObjectWrapper(com.evolveum.midpoint.web.component.prism.ObjectWrapper) PrismObjectPanel(com.evolveum.midpoint.web.component.prism.PrismObjectPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 5 with PackageResourceReference

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);
}
Also used : RootXlsx(org.devgateway.ocvn.forms.xlsx.RootXlsx) FileInputBootstrapFormComponent(org.devgateway.toolkit.forms.wicket.components.form.FileInputBootstrapFormComponent) ResourceLink(org.apache.wicket.markup.html.link.ResourceLink) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) TextAreaFieldBootstrapFormComponent(org.devgateway.toolkit.forms.wicket.components.form.TextAreaFieldBootstrapFormComponent) TextFieldBootstrapFormComponent(org.devgateway.toolkit.forms.wicket.components.form.TextFieldBootstrapFormComponent)

Aggregations

PackageResourceReference (org.apache.wicket.request.resource.PackageResourceReference)8 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 ImgResources (com.evolveum.midpoint.web.resource.img.ImgResources)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 PrismObjectPanel (com.evolveum.midpoint.web.component.prism.PrismObjectPanel)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 ObjectBrowserPanel (com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 DescriptorLoader (com.evolveum.midpoint.web.application.DescriptorLoader)1 ConfirmationPanel (com.evolveum.midpoint.web.component.dialog.ConfirmationPanel)1 InlineMenu (com.evolveum.midpoint.web.component.menu.cog.InlineMenu)1 ObjectWrapper (com.evolveum.midpoint.web.component.prism.ObjectWrapper)1 FocusSubwrapperDto (com.evolveum.midpoint.web.page.admin.users.dto.FocusSubwrapperDto)1 Utf8BundleStringResourceLoader (com.evolveum.midpoint.web.util.Utf8BundleStringResourceLoader)1 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)1 Serializable (java.io.Serializable)1 AttributeModifier (org.apache.wicket.AttributeModifier)1 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)1