Commit 879e4809 authored by Nugraha, Sigit's avatar Nugraha, Sigit
Browse files

Fix the source-language selection problem in question & fix rating translation

parent 4ef3595d
package org.gesis.stardat.helper;
import java.util.Locale;
import org.gesis.stardat.entity.DDIElement;
import org.gesis.stardat.management.ManagementService;
import org.gesis.stardat.management.dto.StardatObjectDTO;
......@@ -9,12 +11,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventBus.UIEventBus;
import org.vaadin.spring.i18n.support.Translatable;
import org.vaadin.teemu.ratingstars.RatingStars;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.ui.*;
public class QuestionRatingComponent extends HorizontalLayout
public class QuestionRatingComponent extends HorizontalLayout implements Translatable
{
private Logger logger = LoggerFactory.getLogger( QuestionRatingComponent.class );
......@@ -62,4 +65,11 @@ public class QuestionRatingComponent extends HorizontalLayout
: String.valueOf( stardatObjectDTO.getNoOfRating() ) );
userRating.setReadOnly( true );
}
@Override
public void updateMessageStrings(Locale locale) {
if( stardatObjectDTO != null)
numberOfRatings.setValue( stardatObjectDTO.getNoOfRating() == 0 ? I18N.get("QuestionRatingComponent.no.rating")
: String.valueOf( stardatObjectDTO.getNoOfRating() ) );
}
}
......@@ -2,40 +2,14 @@ package org.gesis.stardat.service;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.gesis.stardat.DDIEditor;
import org.gesis.stardat.ddiflatdb.client.DDIStore;
import org.gesis.stardat.ddiflatdb.client.Document;
import org.gesis.stardat.entity.Category;
import org.gesis.stardat.entity.CategoryScheme;
import org.gesis.stardat.entity.Code;
import org.gesis.stardat.entity.CodeList;
import org.gesis.stardat.entity.Concept;
import org.gesis.stardat.entity.ControlConstructReference;
import org.gesis.stardat.entity.DDIElement;
import org.gesis.stardat.entity.Instrument;
import org.gesis.stardat.entity.InterviewerInstruction;
import org.gesis.stardat.entity.MultipleQuestionItem;
import org.gesis.stardat.entity.QuestionConstruct;
import org.gesis.stardat.entity.QuestionItem;
import org.gesis.stardat.entity.Sequence;
import org.gesis.stardat.entity.Statement;
import org.gesis.stardat.entity.StudyGroup;
import org.gesis.stardat.entity.StudyUnit;
import org.gesis.stardat.entity.TextDomain;
import org.gesis.stardat.entity.Universe;
import org.gesis.stardat.entity.Variable;
import org.gesis.stardat.entity.*;
import org.gesis.stardat.security.DDIEditorSecurityUtils;
import org.gesis.stardat.security.oauth2.StardatOAuth2User;
import org.gesis.stardat.ui.QuestionnaireEditorView;
......
......@@ -1116,7 +1116,7 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
{
questionGrid.getCurrentSelectedItems().forEach( item ->
{
final String SOURCE_LANG = item.getObject().getLanguage();
String SOURCE_LANG = item.getObject().getLanguage();
ArrayList<String> availableLanguages = null;
if ( item.getObject().getType().equals( DDIElement.STATEMENT ) )
......@@ -1125,7 +1125,9 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
}
else
{
availableLanguages = ((QuestionConstruct) item.getObject()).getQuestion().getAvailableLanguages();
final QuestionConstruct questionConstruct = (QuestionConstruct) item.getObject();
SOURCE_LANG = questionConstruct.getQuestion().getLanguage();
availableLanguages = questionConstruct.getQuestion().getAvailableLanguages();
}
MVerticalLayout questionPrev = new MVerticalLayout().withFullWidth().withMargin( false );
......@@ -1942,6 +1944,7 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
I18N.get( "QuestionConstruct.InterviewerInstruction.label" ) );
previewLabelMap.put( QuestionConstruct.FILTER_LABEL, I18N.get( "QuestionConstruct.Filter.label" ) );
previewLabelMap.put( QuestionItem.VARIABLE_LABEL, I18N.get( "QuestionItem.Variable.label" ) );
userRating.updateMessageStrings(locale);
updateCurrentQuestionPreview();
}
......
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