Commit 2855f41d authored by Nugraha, Sigit's avatar Nugraha, Sigit
Browse files

Fix create new statement jump to beginning

parent 4179480d
Pipeline #15369 passed with stage
in 1 minute and 59 seconds
......@@ -672,7 +672,7 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
}
}
private void createStatementItem( HashMap<String, Object> values )
private String createStatementItem( HashMap<String, Object> values )
{
setRunFilltreeAfterEdit( true );
Statement statement = entityService.addNewStatement( getCurrentSequence(),
......@@ -688,7 +688,7 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
.withLabel( statement.getDescription() )
.withObject( statement );
questionGridRows.add( questionRow );
return statement.getId();
}
public void importElements( List<DDIElement> toImport )
......@@ -1773,7 +1773,8 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
else if ( goal.endsWith( CREATE_STATEMENT_WINDOW ) )
{
createStatementItem( args );
String statementId = createStatementItem( args );
args.put("id",statementId );
}
else if ( goal.endsWith( REORDER_QUESTION_WINDOW ) )
{
......@@ -1828,7 +1829,7 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
setRunFilltreeAfterEdit( false );
questionGrid.getDataProvider().refreshAll();
if ( goal.endsWith( QuestionWindow.WINDOW_NAME ) ) {
if ( goal.endsWith( QuestionWindow.WINDOW_NAME ) || goal.endsWith( CREATE_STATEMENT_WINDOW ) ) {
if (args.get("id") != null) {
final QuestionGridRow questionGridRowToBeSelected = questionGridRows.stream()
.filter(qgr -> qgr.getId().equals(args.get("id"))).findFirst()
......
package org.gesis.stardat.ui.windows;
import java.util.HashMap;
import java.util.UUID;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import org.gesis.stardat.ddiflatdb.client.DDIStore;
import org.gesis.stardat.entity.Statement;
import org.gesis.stardat.service.CachingDDIFlatDBRestClient;
import org.gesis.stardat.service.I18N;
import org.gesis.stardat.ui.QuestionnaireEditorView;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import java.util.HashMap;
import java.util.UUID;
public class StatementWindow extends BaseStoreCancelWindow
{
......@@ -97,10 +97,13 @@ public class StatementWindow extends BaseStoreCancelWindow
statement.setDescription( descriptionField.getValue() );
statement.setDisplayText( textField.getValue() );
statement.save();
statement.setDdiStore( master.getEntityService().saveElement( statement,
final DDIStore ddiStore = master.getEntityService().saveElement(statement,
getDDIEditor().getCurrentUserId(),
comment ));
master.readyWith( GOAL + windowName, true, null );
comment);
statement.setDdiStore( ddiStore );
HashMap<String, Object> values = new HashMap<>();
values.put( "id", ddiStore.getElementId() );
master.readyWith( GOAL + windowName, true, values );
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment