Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Dec 29, 2017
1 parent 46ba0b1 commit ce3c670
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.evolveum.midpoint.gui.api.util;

import com.evolveum.midpoint.web.security.MidPointApplication;

/**
* Created by Viliam Repan (lazyman).
*/
public interface MidPointApplicationConfiguration {

void init(MidPointApplication application);
}
Expand Up @@ -58,7 +58,7 @@ private boolean isContainerMultivalue(){
}

@Override
protected String getLabel() {
public String getLabel() {
return getModelObject() != null ? getModelObject().getDisplayName() : "";
}

Expand Down
Expand Up @@ -274,7 +274,7 @@ private WebMarkupContainer getChildContainersSelectorPanel(){
}

@Override
protected String getLabel() {
public String getLabel() {
return getModel().getObject().getDisplayName();
}

Expand Down
Expand Up @@ -72,7 +72,7 @@ protected void onButtonClick(AjaxRequestTarget target) {

}

protected abstract String getLabel();
public abstract String getLabel();

public boolean isButtonsVisible() {
return true;
Expand Down
Expand Up @@ -19,6 +19,7 @@
import com.evolveum.midpoint.common.refinery.RefinedAttributeDefinition;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.prism.path.ItemPath;
Expand Down Expand Up @@ -60,13 +61,16 @@ public class PrismPropertyPanel<IW extends ItemWrapper> extends Panel {
private static final String ID_LABEL = "label";
private static final String ID_LABEL_CONTAINER = "labelContainer";

private IModel<IW> model;

private PageBase pageBase;

private boolean labelContainerVisible = true;

public PrismPropertyPanel(String id, final IModel<IW> model, Form form, ItemVisibilityHandler visibilityHandler, PageBase pageBase) {
super(id);
Validate.notNull(model, "no model");
this.model = model;
this.pageBase = pageBase;

LOGGER.trace("Creating property panel for {}", model.getObject());
Expand Down Expand Up @@ -96,6 +100,10 @@ public boolean isEnabled() {
initLayout(model, form);
}

public IModel<IW> getModel() {
return model;
}

private void initLayout(final IModel<IW> model, final Form form) {
WebMarkupContainer labelContainer = new WebMarkupContainer(ID_LABEL_CONTAINER);
labelContainer.setOutputMarkupId(true);
Expand Down
Expand Up @@ -19,6 +19,7 @@
import com.evolveum.midpoint.common.LocalizationService;
import com.evolveum.midpoint.common.configuration.api.MidpointConfiguration;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.MidPointApplicationConfiguration;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.model.api.*;
Expand Down Expand Up @@ -79,12 +80,12 @@
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.apache.wicket.util.lang.Bytes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.stereotype.Component;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -187,6 +188,8 @@ public class MidPointApplication extends AuthenticatedWebApplication {
transient LocalizationService localizationService;
@Autowired
transient AsyncWebProcessManager asyncWebProcessManager;
@Autowired
transient ApplicationContext applicationContext;

private WebApplicationConfiguration webApplicationConfiguration;

Expand Down Expand Up @@ -273,6 +276,12 @@ public void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxReque

//descriptor loader, used for customization
new DescriptorLoader().loadData(this);

Map<String, MidPointApplicationConfiguration> map =
applicationContext.getBeansOfType(MidPointApplicationConfiguration.class);
if (map != null) {
map.forEach((key, value) -> value.init(this));
}
}

private boolean isPostMethodTypeBehavior(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes) {
Expand Down

0 comments on commit ce3c670

Please sign in to comment.