Skip to content

Commit

Permalink
Projections tab panel. Renaming "Details" panels to "Main" to avoid c…
Browse files Browse the repository at this point in the history
…onfusion with the tab panel.
  • Loading branch information
semancik committed Jan 8, 2016
1 parent a1fea7e commit 1bd16cc
Show file tree
Hide file tree
Showing 13 changed files with 460 additions and 39 deletions.
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 Evolveum
* Copyright (c) 2015-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 @@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.component.detailspanel;
package com.evolveum.midpoint.web.component.mainpanel;

import java.util.List;

import org.apache.commons.lang.Validate;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
Expand All @@ -42,13 +43,13 @@
* @author semancik
*
*/
public abstract class AbstractObjectDetailsPanel<O extends ObjectType> extends Panel {
public abstract class AbstractObjectMainPanel<O extends ObjectType> extends Panel {

private static final String ID_MAIN_FORM = "mainForm";
private static final String ID_TAB_PANEL = "tabPanel";
private static final String ID_EXECUTE_OPTIONS = "executeOptions";

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

private Form mainForm;

Expand All @@ -60,8 +61,9 @@ protected ExecuteChangeOptionsDto load() {
}
};

public AbstractObjectDetailsPanel(String id, LoadableModel<ObjectWrapper<O>> objectModel, PageAdminObjectDetails<O> parentPage) {
public AbstractObjectMainPanel(String id, LoadableModel<ObjectWrapper<O>> objectModel, PageAdminObjectDetails<O> parentPage) {
super(id, objectModel);
Validate.notNull(objectModel, "Null object model");
this.objectModel = objectModel;
initLayout(parentPage);
}
Expand Down
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.component.detailspanel;
package com.evolveum.midpoint.web.component.mainpanel;

import java.util.List;

Expand All @@ -35,11 +35,11 @@
* @author semancik
*
*/
public class AbstractRoleDetailsPanel<R extends AbstractRoleType> extends FocusDetailsPanel<R> {
public class AbstractRoleMainPanel<R extends AbstractRoleType> extends FocusMainPanel<R> {

private LoadableModel<List<AssignmentEditorDto>> inducementsModel;

public AbstractRoleDetailsPanel(String id, LoadableModel<ObjectWrapper<R>> objectModel, LoadableModel<List<FocusProjectionDto>> projectionModel,
public AbstractRoleMainPanel(String id, LoadableModel<ObjectWrapper<R>> objectModel, LoadableModel<List<FocusProjectionDto>> projectionModel,
LoadableModel<List<AssignmentEditorDto>> inducementsModel, PageAdminFocus<R> parentPage) {
super(id, objectModel, projectionModel, parentPage);
this.inducementsModel = inducementsModel;
Expand Down
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015 Evolveum
* Copyright (c) 2015-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 @@ -13,14 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.component.detailspanel;
package com.evolveum.midpoint.web.component.mainpanel;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.Validate;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand All @@ -34,6 +35,7 @@
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.page.admin.BaseFocusPanel;
import com.evolveum.midpoint.web.page.admin.FocusDetailsTabPanel;
import com.evolveum.midpoint.web.page.admin.FocusProjectionsTabPanel;
import com.evolveum.midpoint.web.page.admin.FocusTabPanel;
import com.evolveum.midpoint.web.page.admin.PageAdminFocus;
import com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails;
Expand All @@ -46,13 +48,14 @@
* @author semancik
*
*/
public class FocusDetailsPanel<F extends FocusType> extends AbstractObjectDetailsPanel<F> {
public class FocusMainPanel<F extends FocusType> extends AbstractObjectMainPanel<F> {

private LoadableModel<List<FocusProjectionDto>> projectionModel;

public FocusDetailsPanel(String id, LoadableModel<ObjectWrapper<F>> objectModel, LoadableModel<List<FocusProjectionDto>> projectionModel,
public FocusMainPanel(String id, LoadableModel<ObjectWrapper<F>> objectModel, LoadableModel<List<FocusProjectionDto>> projectionModel,
PageAdminFocus<F> parentPage) {
super(id, objectModel, parentPage);
Validate.notNull(projectionModel, "Null projection model");
this.projectionModel = projectionModel;
}

Expand Down Expand Up @@ -126,16 +129,27 @@ protected WebMarkupContainer createTabPanel(String panelId, FormSpecificationTyp
}
}

protected WebMarkupContainer createFocusDetailsPanel(String panelId, PageAdminObjectDetails<F> parentPage) {
protected WebMarkupContainer createFocusDetailsTabPanel(String panelId, PageAdminObjectDetails<F> parentPage) {
return new FocusDetailsTabPanel<F>(panelId, getMainForm(), getObjectModel(), parentPage);
}

protected WebMarkupContainer createFocusProjectionsTabPanel(String panelId, PageAdminObjectDetails<F> parentPage) {
return new FocusProjectionsTabPanel<F>(panelId, getMainForm(), getObjectModel(), projectionModel, parentPage);
}

protected void addDefaultTabs(final PageAdminObjectDetails<F> parentPage, List<ITab> tabs) {
tabs.add(
new AbstractTab(parentPage.createStringResource("pageAdminFocus.basic")){
@Override
public WebMarkupContainer getPanel(String panelId) {
return createFocusDetailsPanel(panelId, parentPage);
return createFocusDetailsTabPanel(panelId, parentPage);
}
});
tabs.add(
new AbstractTab(parentPage.createStringResource("pageAdminFocus.projections")){
@Override
public WebMarkupContainer getPanel(String panelId) {
return createFocusProjectionsTabPanel(panelId, parentPage);
}
});
}
Expand Down
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.component.detailspanel;
package com.evolveum.midpoint.web.component.mainpanel;

import java.util.List;

Expand All @@ -36,11 +36,11 @@
* @author semancik
*
*/
public class RoleDetailsPanel extends AbstractRoleDetailsPanel<RoleType> {
public class RoleMainPanel extends AbstractRoleMainPanel<RoleType> {

private LoadableModel<List<AssignmentEditorDto>> inducementsModel;

public RoleDetailsPanel(String id, LoadableModel<ObjectWrapper<RoleType>> objectModel, LoadableModel<List<FocusProjectionDto>> projectionModel,
public RoleMainPanel(String id, LoadableModel<ObjectWrapper<RoleType>> objectModel, LoadableModel<List<FocusProjectionDto>> projectionModel,
LoadableModel<List<AssignmentEditorDto>> inducementsModel, PageAdminFocus<RoleType> parentPage) {
super(id, objectModel, projectionModel, inducementsModel, parentPage);
}
Expand Down
Expand Up @@ -93,9 +93,10 @@ public class FocusDetailsTabPanel<F extends FocusType> extends FocusTabPanel {

public FocusDetailsTabPanel(String id, Form mainForm, LoadableModel<ObjectWrapper<F>> focusModel, PageBase page) {
super(id, mainForm, focusModel, page);
initLayout();
}

public void initLayout() {
private void initLayout() {

PrismObjectPanel userForm = new PrismObjectPanel<F>(ID_FOCUS_FORM, getFocusModel(),
new PackageResourceReference(ImgResources.class, ImgResources.USER_PRISM), getMainForm(), getPageBase()) {
Expand Down
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~ 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.
-->

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="row">
<div class="col-md-6">
<div wicket:id="shadows">
<div class="row assignable-header">
<div class="col-xs-10">
<input type="checkbox" wicket:id="shadowCheckAll" />
<h3>
<wicket:message key="pageAdminFocus.projections" />
</h3>
</div>
<div class="col-xs-2 cog" wicket:id="shadowMenu"
about="shadowMenu" />
</div>
<div wicket:id="shadowList">
<div wicket:id="shadow" />
</div>
</div>
</div>
</div>
</wicket:panel>
</body>
</html>

0 comments on commit 1bd16cc

Please sign in to comment.