Skip to content

Commit

Permalink
Deprecating SimplePanel, cleaning up some of the initLayout methods, …
Browse files Browse the repository at this point in the history
…some work on progress reporter refactoring.
  • Loading branch information
semancik committed Jan 11, 2016
1 parent 13a9fff commit 1bf2670
Show file tree
Hide file tree
Showing 47 changed files with 345 additions and 301 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,9 +17,10 @@
package com.evolveum.midpoint.web.component;

import com.evolveum.midpoint.web.resource.img.ImgResources;
import com.evolveum.midpoint.web.component.util.BaseSimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.component.util.FutureUpdateBehavior;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.basic.Label;
Expand All @@ -32,13 +33,13 @@
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import java.util.concurrent.Callable;
import java.io.Serializable;
import java.util.concurrent.Future;

/**
* @author lazyman
*/
public abstract class AsyncUpdatePanel<V, T> extends BaseSimplePanel {
public abstract class AsyncUpdatePanel<V, T extends Serializable> extends BasePanel<T> {

private static final ResourceReference PRELOADER =
new PackageResourceReference(ImgResources.class, "ajax-loader.gif");
Expand All @@ -59,7 +60,8 @@ public AsyncUpdatePanel(String id, IModel<V> callableParameterModel) {
}

public AsyncUpdatePanel(String id, IModel<V> callableParameterModel, Duration durationSecs) {
super(id, new Model());
super(id, new Model<T>());
initLayout();

Authentication auth = SecurityContextHolder.getContext().getAuthentication();
future = GuiComponents.submitCallable(createCallable(auth, callableParameterModel));
Expand All @@ -82,7 +84,7 @@ protected void onUpdateError(AjaxRequestTarget target, Exception ex) {
add(behaviour);
}

protected void initLayout() {
private void initLayout() {
add(getLoadingComponent(ID_LOADING));
add(new Label(ID_BODY));
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,15 +25,14 @@
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.input.TriStateComboPanel;
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

import org.apache.commons.lang.ClassUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
Expand All @@ -48,7 +47,7 @@
/**
* @author lazyman
*/
public class ACAttributeValuePanel extends SimplePanel<ACValueConstructionDto> {
public class ACAttributeValuePanel extends BasePanel<ACValueConstructionDto> {

private static final String ID_INPUT = "input";
private static final String ID_ADD = "add";
Expand All @@ -57,10 +56,10 @@ public class ACAttributeValuePanel extends SimplePanel<ACValueConstructionDto> {
public ACAttributeValuePanel(String id, IModel<ACValueConstructionDto> iModel, Form form) {
super(id, iModel);

initPanel(form);
initLayout(form);
}

private void initPanel(Form form) {
private void initLayout(Form form) {
ACValueConstructionDto dto = getModel().getObject();
PrismPropertyDefinition definition = dto.getAttribute().getDefinition();
boolean required = definition.getMinOccurs() > 0;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,8 +38,8 @@
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.input.TwoStateBooleanPanel;
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.component.util.LoadableModel;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypePanel;
Expand Down Expand Up @@ -79,7 +79,7 @@
/**
* @author lazyman
*/
public class AssignmentEditorPanel extends SimplePanel<AssignmentEditorDto> {
public class AssignmentEditorPanel extends BasePanel<AssignmentEditorDto> {

private static final Trace LOGGER = TraceManager.getTrace(AssignmentEditorPanel.class);

Expand Down Expand Up @@ -131,7 +131,7 @@ protected List<ACAttributeDto> load() {
}
};

initPanelLayout();
initLayout();
}

@Override
Expand All @@ -142,7 +142,7 @@ public void renderHead(IHeaderResponse response) {
new PackageResourceReference(AssignmentEditorPanel.class, "AssignmentEditorPanel.css")));
}

private void initPanelLayout() {
private void initLayout() {
WebMarkupContainer headerRow = new WebMarkupContainer(ID_HEADER_ROW);
headerRow.add(AttributeModifier.append("class", createHeaderClassModel(getModel())));
headerRow.setOutputMarkupId(true);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,11 +35,12 @@
import com.evolveum.midpoint.web.component.menu.cog.InlineMenu;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.page.admin.users.component.*;
import com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
Expand All @@ -52,6 +53,7 @@
import org.apache.wicket.model.Model;

import javax.xml.namespace.QName;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -60,7 +62,7 @@
/**
* @author shood
*/
public class AssignmentTablePanel<T extends ObjectType> extends SimplePanel<List<AssignmentEditorDto>> {
public class AssignmentTablePanel<T extends ObjectType> extends BasePanel<List<AssignmentEditorDto>> {

private static final Trace LOGGER = TraceManager.getTrace(AssignmentTablePanel.class);

Expand All @@ -86,7 +88,7 @@ public AssignmentTablePanel(String id, IModel<String> label,
IModel<List<AssignmentEditorDto>> assignmentModel) {
super(id, assignmentModel);

initPanelLayout(label);
initLayout(label);
}

public List<AssignmentType> getAssignmentTypeList() {
Expand All @@ -101,7 +103,7 @@ private IModel<List<AssignmentEditorDto>> getAssignmentModel() {
return getModel();
}

private void initPanelLayout(IModel<String> labelText) {
private void initLayout(IModel<String> labelText) {
final WebMarkupContainer assignments = new WebMarkupContainer(ID_ASSIGNMENTS);
assignments.setOutputMarkupId(true);
add(assignments);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,10 +17,11 @@
package com.evolveum.midpoint.web.component.data;

import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.web.util.WebMiscUtil;

import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -40,7 +41,7 @@
/**
* @author Viliam Repan (lazyman)
*/
public class BoxedTablePanel<T> extends SimplePanel implements Table {
public class BoxedTablePanel<T> extends BasePanel implements Table {

private static final String ID_HEADER = "header";
private static final String ID_FOOTER = "footer";
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,8 @@

import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.data.column.DoubleButtonColumn;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.model.IModel;
Expand All @@ -27,7 +28,7 @@
/**
* @author shood
* */
public class DoubleButtonPanel<T> extends SimplePanel<T>{
public class DoubleButtonPanel<T> extends BasePanel<T>{

private static final String ID_BUTTON_FIRST = "first";
private static final String ID_BUTTON_SECOND = "second";
Expand All @@ -37,10 +38,10 @@ public class DoubleButtonPanel<T> extends SimplePanel<T>{

public DoubleButtonPanel(String id, IModel<T> model){
super(id, model);
createLayout();
initLayout();
}

private void createLayout(){
private void initLayout(){
AjaxButton firstButton = new AjaxButton(ID_BUTTON_FIRST, createButtonStringResource(getFirstCaption())) {

@Override
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,8 @@

import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.data.column.DoubleButtonColumn;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.basic.Label;
Expand All @@ -29,7 +30,7 @@
* @author shood
* @author mederly
*/
public class MultiButtonPanel<T> extends SimplePanel<T> {
public class MultiButtonPanel<T> extends BasePanel<T> {

private static final String ID_BUTTONS = "buttons";

Expand All @@ -38,10 +39,10 @@ public class MultiButtonPanel<T> extends SimplePanel<T> {
public MultiButtonPanel(String id, int numberOfButtons, IModel<T> model) {
super(id, model);
this.numberOfButtons = numberOfButtons;
createLayout();
initLayout();
}

private void createLayout() {
private void initLayout() {
RepeatingView buttons = new RepeatingView(ID_BUTTONS);
add(buttons);
for (int id = 0; id < numberOfButtons; id++) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,9 @@
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.data.column.DoubleButtonColumn;
import com.evolveum.midpoint.web.component.data.column.SingleButtonColumn;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.component.util.SimplePanel;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.model.IModel;
Expand All @@ -29,18 +31,18 @@
* @author shood
* @author mederly
*/
public class SingleButtonPanel<T> extends SimplePanel<T> {
public class SingleButtonPanel<T> extends BasePanel<T> {

private static final String ID_BUTTON = "button";

private String caption;

public SingleButtonPanel(String id, IModel<T> model){
super(id, model);
createLayout();
initLayout();
}

private void createLayout(){
private void initLayout(){
AjaxButton button = new AjaxButton(ID_BUTTON, createButtonStringResource(getCaption())) {

@Override
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Evolveum
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,9 +16,10 @@

package com.evolveum.midpoint.web.component.form;

import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.BasePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;

import org.apache.commons.lang.StringUtils;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand All @@ -31,7 +32,7 @@
/**
* @author lazyman
*/
public class CheckFormGroup extends SimplePanel<Boolean> {
public class CheckFormGroup extends BasePanel<Boolean> {

private static final String ID_CHECK = "check";
private static final String ID_CHECK_WRAPPER = "checkWrapper";
Expand Down

0 comments on commit 1bf2670

Please sign in to comment.