В документации п. 5.8.3.2 Платформа 6.6.2
Имеется сущность Аа и связанная 1-N сущность Bb. При редактировании Bb хотелось бы сразу подставленной связи текущей записи Aa, т.е. владельца строки Bb.
XML-дескриптор
<dsContext>
<collectionDatasource id="aasDs"
class="com.company.gtvtest.entity.Aa"
view="aa-view">
<query>
<![CDATA[select e from gtvtest$Aa e]]>
</query>
</collectionDatasource>
<collectionDatasource id="bbsDs"
class="com.company.gtvtest.entity.Bb">
<query>
<![CDATA[select e from gtvtest$Bb e where e.id = :ds$aasDs]]>
</query>
</collectionDatasource>
</dsContext>
<dialogMode height="600"
width="800"/>
<layout expand="aasTable"
spacing="true">
<groupTable id="aasTable" width="100%">
<actions>
<action id="create"/>
<action id="edit"/>
<action id="remove"/>
</actions>
<columns>
<column id="name_a"/>
</columns>
<rows datasource="aasDs"/>
<rowsCount/>
<buttonsPanel id="buttonsPanel" alwaysVisible="true">
<button id="createBtn" action="aasTable.create"/>
<button id="editBtn" action="aasTable.edit"/>
<button id="removeBtn" action="aasTable.remove"/>
</buttonsPanel>
</groupTable>
<dataGrid id="bbsTable"
datasource="bbsDs">
<actions>
<action id="create"/>
<action id="edit"/>
<action id="remove"/>
</actions>
<columns>
<column property="name_b"/>
</columns>
<buttonsPanel id="buttonspanel_1" alwaysVisible="true">
<button id="button_1" action="bbsTable.create"/>
<button id="button_2" action="bbsTable.edit"/>
<button id="button_3" action="bbsTable.remove"/>
</buttonsPanel>
</dataGrid>
Контроллер этого экрана. Причём по совету Eclips вставил несколько строк Import …
package com.company.gtvtest.web.aa;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Named;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.gui.components.actions.CreateAction;
import com.haulmont.cuba.gui.data.CollectionDatasource;
public class AaBrowse extends AbstractLookup {
@Inject
private CollectionDatasource<AA_ID, UUID> aasDs;
@Named("BbsTable.create")
private CreateAction BBCreateAction;
@Override
public void init(Map<String, Object> params) {
AasDs.addItemChangeListener(event -> {
BBCreateAction.setInitialValues(Collections.<String, Object>singletonMap("Aa_id", event.getItem()));
});
}
}
Проект на компилируется, выдаются сообщения
app-web:compileJavaC:\Users\cuba\studio-projects\GtvTest\modules\web\src\com\company\gtvtest\web\aa\AaBrowse.java:14: error: cannot find symbol private CollectionDatasource<AA_ID, UUID> aasDs; symbol: class AA_ID location: class AaBrowse C:\Users\cuba\studio-projects\GtvTest\modules\web\src\com\company\gtvtest\web\aa\AaBrowse.java:14: error: cannot find symbol private CollectionDatasource<AA_ID, UUID> aasDs; symbol: class UUID location: class AaBrowse C:\Users\cuba\studio-projects\GtvTest\modules\web\src\com\company\gtvtest\web\aa\AaBrowse.java:21: error: cannot find symbol AasDs.addItemChangeListener(event -> { ^ symbol: variable AasDs location: class AaBrowse C:\Users\cuba\studio-projects\GtvTest\modules\web\src\com\company\gtvtest\web\aa\AaBrowse.java:22: error: cannot find symbol BBCreateAction.setInitialValues(Collections.<String, Object>singletonMap("Aa_id", event.getItem())); ^ symbol: variable Collections location: class AaBrowse 4 errors
Что не так?