com.ocs.dynamo.ui.composite.layout.FixedDetailLayout Maven / Gradle / Ivy
/*
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.ocs.dynamo.ui.composite.layout;
import java.io.Serializable;
import com.ocs.dynamo.domain.AbstractEntity;
import com.ocs.dynamo.domain.model.EntityModel;
import com.ocs.dynamo.service.BaseService;
import com.ocs.dynamo.ui.CanAssignEntity;
import com.vaadin.flow.data.provider.SortOrder;
/**
* Split layout that displays a fixed set of items related to a parent entity
*
* @author bas.rutten
* @param the type of the primary key
* @param the type of the entity
* @param the type of the primary key of the parent entity
* @param the type of the parent entity
*/
public class FixedDetailLayout, ID2 extends Serializable, Q extends AbstractEntity>
extends FixedSplitLayout implements CanAssignEntity {
private static final long serialVersionUID = 4606800218149558500L;
private final BaseService parentService;
private Q parentEntity;
/**
* Constructor
*
* @param service the service
* @param parentEntity the parent entity
* @param parentService the parent service
* @param entityModel the entity model that is used to build the form
* @param formOptions form options
* @param fieldFilters filters that will be applied to the fields in the detail
* view
* @param sortOrder
*/
public FixedDetailLayout(BaseService service, Q parentEntity, BaseService parentService,
EntityModel entityModel, FormOptions formOptions, SortOrder> sortOrder) {
super(service, entityModel, formOptions, sortOrder);
this.parentEntity = parentEntity;
this.parentService = parentService;
}
public Q getParentEntity() {
return parentEntity;
}
public void setParentEntity(Q parentEntity) {
this.parentEntity = parentEntity;
}
public BaseService getParentService() {
return parentService;
}
@Override
public void assignEntity(Q parentEntity) {
setParentEntity(parentEntity);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy