Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
stardat
stardat-ddieditor
Commits
d271c6c0
Commit
d271c6c0
authored
Dec 02, 2020
by
Nugraha, Sigit
Browse files
Enable edit study description
parent
992de093
Pipeline
#15364
passed with stage
in 1 minute and 59 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gesis/stardat/ui/view/study/EditStudyDescriptionWindow.java
View file @
d271c6c0
package
org.gesis.stardat.ui.view.study
;
import
java.util.HashMap
;
import
com.vaadin.ui.TextArea
;
import
org.gesis.stardat.entity.StudyUnit
;
import
org.gesis.stardat.helper.TriggerableWindowMaster
;
import
org.gesis.stardat.service.I18N
;
import
org.gesis.stardat.ui.windows.BaseStoreCancelWindow
;
import
org.vaadin.viritin.fields.*
;
import
org.vaadin.viritin.fluency.ui.FluentHasValue
;
import
com.vaadin.ui.*
;
import
org.vaadin.viritin.fields.IntegerField
;
import
org.vaadin.viritin.fields.MTextField
;
import
java.util.HashMap
;
public
class
EditStudyDescriptionWindow
extends
BaseStoreCancelWindow
{
...
...
@@ -23,7 +24,7 @@ public class EditStudyDescriptionWindow extends BaseStoreCancelWindow{
public
static
final
String
CONTENT
=
"content"
;
private
MTextField
title
=
new
MTextField
();
private
MText
Field
publicationYear
=
new
MText
Field
();
private
Integer
Field
publicationYear
=
new
Integer
Field
();
private
MTextField
evaluationStart
=
new
MTextField
();
private
MTextField
evaluationEnd
=
new
MTextField
();
private
MTextField
publisher
=
new
MTextField
();
...
...
@@ -37,8 +38,8 @@ public class EditStudyDescriptionWindow extends BaseStoreCancelWindow{
public
EditStudyDescriptionWindow
(
String
windowName
,
StudyUnit
studyUnit
,
TriggerableWindowMaster
master
)
{
super
(
windowName
);
setWidth
(
"
550
px"
);
setHeight
(
"
3
00px"
);
setWidth
(
"
1024
px"
);
setHeight
(
"
6
00px"
);
this
.
master
=
master
;
this
.
studyUnit
=
studyUnit
;
...
...
@@ -55,8 +56,14 @@ public class EditStudyDescriptionWindow extends BaseStoreCancelWindow{
.
withCaption
(
I18N
.
get
(
windowName
+
".label"
)
)
.
withWidth
(
"200"
);
if
(
studyUnit
.
getPublicationYear
()!=
null
)
{
publicationYear
.
withValue
(
studyUnit
.
getPublicationYear
().
toString
()
);}
{
Integer
year
=
null
;
try
{
year
=
Integer
.
parseInt
(
studyUnit
.
getPublicationYear
().
toString
());
}
catch
(
Exception
e
){}
publicationYear
.
withValue
(
year
);
}
publicationYear
.
withCaption
(
I18N
.
get
(
windowName
+
".publicationYear"
)
)
.
withWidth
(
"100"
);
...
...
@@ -82,16 +89,21 @@ public class EditStudyDescriptionWindow extends BaseStoreCancelWindow{
categories
.
setValue
(
studyUnit
.
getCategoriesAsString
());}
categories
.
setCaption
(
I18N
.
get
(
windowName
+
".categories"
)
);
categories
.
setWidth
(
"200"
);
categories
.
setRows
(
6
);
categories
.
setDescription
(
I18N
.
get
(
windowName
+
".categories.description"
));
if
(
studyUnit
.
getTopicsAsString
()!=
null
)
{
categories
.
setVisible
(
false
);
// categories s complex object and not suitable for a normal String/Text operation
if
(
studyUnit
.
getTopicsAsString
()!=
null
)
{
topics
.
setValue
(
studyUnit
.
getTopicsAsString
());}
topics
.
setCaption
(
I18N
.
get
(
windowName
+
".topics"
)
);
topics
.
setWidth
(
"200"
);
topics
.
setVisible
(
false
);
// topic s complex object and not suitable for a normal String/Text operation
topics
.
setRows
(
6
);
topics
.
setDescription
(
I18N
.
get
(
windowName
+
".topics.description"
));
if
(
studyUnit
.
getContent
()!=
null
)
{
content
.
setValue
(
studyUnit
.
getContent
());}
content
.
setCaption
(
I18N
.
get
(
windowName
+
".content"
)
);
content
.
setWidth
(
"200"
);
content
.
setRows
(
6
);
getContentLayout
().
addComponents
(
title
,
publicationYear
,
evaluationStart
,
evaluationEnd
,
publisher
,
categories
,
topics
,
content
);
}
...
...
@@ -100,19 +112,19 @@ public class EditStudyDescriptionWindow extends BaseStoreCancelWindow{
@Override
protected
boolean
store
()
{
close
();
getDDIEditor
().
removeWindow
(
this
);
HashMap
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
TITLE
,
title
.
getValue
()
);
args
.
put
(
PUBLICATION_YEAR
,
publicationYear
.
getValue
()
);
args
.
put
(
EVALUATION_START
,
evaluationStart
.
getValue
()
);
args
.
put
(
EVALUATION_END
,
evaluationEnd
.
getValue
()
);
args
.
put
(
PUBLISHER
,
publisher
.
getValue
()
);
args
.
put
(
CATEGORIES
,
categories
.
getValue
()
);
args
.
put
(
TOPICS
,
topics
.
getValue
()
);
args
.
put
(
CONTENT
,
content
.
getValue
()
);
master
.
readyWith
(
GOAL
+
windowName
,
true
,
args
);
return
true
;
close
();
getDDIEditor
().
removeWindow
(
this
);
HashMap
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
TITLE
,
title
.
getValue
()
);
args
.
put
(
PUBLICATION_YEAR
,
publicationYear
.
getValue
()
);
args
.
put
(
EVALUATION_START
,
evaluationStart
.
getValue
()
);
args
.
put
(
EVALUATION_END
,
evaluationEnd
.
getValue
()
);
args
.
put
(
PUBLISHER
,
publisher
.
getValue
()
);
//
args.put( CATEGORIES, categories.getValue() );
//
args.put( TOPICS, topics.getValue() );
args
.
put
(
CONTENT
,
content
.
getValue
()
);
master
.
readyWith
(
GOAL
+
windowName
,
true
,
args
);
return
true
;
}
@Override
...
...
src/main/java/org/gesis/stardat/ui/view/study/StudySelectionView.java
View file @
d271c6c0
...
...
@@ -186,6 +186,7 @@ public class StudySelectionView extends VerticalLayout implements View, Translat
List
<
StudyGroup
>
groups
=
getGroups
();
groupsGrid
.
setItems
(
groups
);
if
(
!
groups
.
isEmpty
()
)
{
groupsGrid
.
select
(
groups
.
get
(
0
));
refreshStudy
(
groups
.
get
(
0
));
}
gesisLogger
.
createAndStoreDisplayEvent
(
VIEW_NAME
,
GesisLogEvent
.
DISPLAY_EVENT_TYPE_PAGE_SHOWN
,
""
);
...
...
@@ -402,33 +403,30 @@ public class StudySelectionView extends VerticalLayout implements View, Translat
cloneStudy
.
setVisible
(
false
);
newQuestionnaire
.
setVisible
(
false
);
Optio
nal
<
StudyUnit
>
selectedStudy
=
studyUnitGrid
.
asSingleSelect
().
getFirstSelectedItem
();
if
(
selectedStudy
.
isPresent
()
)
fi
nal
StudyUnit
currentStudyUnit
=
getDDIEditor
().
getCurrentStudyUnit
();
if
(
currentStudyUnit
!=
null
)
{
if
(
newStudy
.
isVisible
()
)
{
editStudy
.
setVisible
(
true
);
//
editStudyDescription.setVisible( true );
editStudyDescription
.
setVisible
(
true
);
deleteStudy
.
setVisible
(
true
);
cloneStudy
.
setVisible
(
true
);
newQuestionnaire
.
setVisible
(
true
);
}
else
{
groupsGrid
.
asSingleSelect
().
getFirstSelectedItem
().
ifPresent
(
sg
->
{
selectedStudy
.
ifPresent
(
su
->
final
StudyGroup
currentStudyGroup
=
getDDIEditor
().
getCurrentStudyGroup
();
if
(
currentStudyGroup
!=
null
)
{
if
(
DDIEditorSecurityUtils
.
authorizeActions
(
currentStudyGroup
.
getId
(),
currentStudyUnit
.
getId
(),
StudyGroupRole
.
ADMIN_STUDY
,
StudyGroupRole
.
RESEARCH_FELLOW
)
)
{
if
(
DDIEditorSecurityUtils
.
authorizeActions
(
sg
.
getId
(),
su
.
getId
(),
StudyGroupRole
.
ADMIN_STUDY
,
StudyGroupRole
.
RESEARCH_FELLOW
)
)
{
editStudyDescription
.
setVisible
(
true
);
deleteStudy
.
setVisible
(
true
);
cloneStudy
.
setVisible
(
true
);
newQuestionnaire
.
setVisible
(
true
);
}
}
);
}
);
editStudyDescription
.
setVisible
(
true
);
deleteStudy
.
setVisible
(
true
);
cloneStudy
.
setVisible
(
true
);
newQuestionnaire
.
setVisible
(
true
);
}
}
}
}
checkQuestionnaireActionRights
();
...
...
@@ -751,10 +749,25 @@ public class StudySelectionView extends VerticalLayout implements View, Translat
break
;
case
EditStudyWindow
.
GOAL
+
EDITSTUDYWINDOWNAME:
case
EditStudyDescriptionWindow
.
GOAL
+
EDITSTUDYDESCRIPTIONWINDOWNAME:
getDDIEditor
().
setWaiting
();
StudyUnit
editedStudy
=
getStudyUnitGrid
().
asSingleSelect
().
getValue
();
editedStudy
.
setTitle
(
args
.
get
(
EditStudyWindow
.
TITLE
).
toString
()
);
editedStudy
.
setTitle
(
args
.
get
(
EditStudyDescriptionWindow
.
TITLE
).
toString
()
);
if
(
args
.
get
(
EditStudyDescriptionWindow
.
PUBLICATION_YEAR
)
!=
null
)
editedStudy
.
setPublicationYear
(
args
.
get
(
EditStudyDescriptionWindow
.
PUBLICATION_YEAR
).
toString
()
);
if
(
args
.
get
(
EditStudyDescriptionWindow
.
EVALUATION_START
)
!=
null
)
editedStudy
.
setDateofCollectionStart
(
args
.
get
(
EditStudyDescriptionWindow
.
EVALUATION_START
).
toString
()
);
if
(
args
.
get
(
EditStudyDescriptionWindow
.
EVALUATION_END
)
!=
null
)
editedStudy
.
setDateofCollectionEnd
(
args
.
get
(
EditStudyDescriptionWindow
.
EVALUATION_END
).
toString
()
);
if
(
args
.
get
(
EditStudyDescriptionWindow
.
PUBLISHER
)
!=
null
)
editedStudy
.
setPublisher
(
args
.
get
(
EditStudyDescriptionWindow
.
PUBLISHER
).
toString
()
);
// if( args.get( EditStudyDescriptionWindow.CATEGORIES ) != null )
// editedStudy.setCategories( args.get( EditStudyDescriptionWindow.CATEGORIES ).toString() );
// if( args.get( EditStudyDescriptionWindow.TOPICS ) != null )
// editedStudy.setTopics( args.get( EditStudyDescriptionWindow.TOPICS ).toString() );
if
(
args
.
get
(
EditStudyDescriptionWindow
.
CONTENT
)
!=
null
)
editedStudy
.
setContent
(
args
.
get
(
EditStudyDescriptionWindow
.
CONTENT
).
toString
()
);
editedStudy
.
save
();
entityService
.
getRestClient
().
saveElement
(
editedStudy
.
getDdiStore
(),
...
...
@@ -767,6 +780,7 @@ public class StudySelectionView extends VerticalLayout implements View, Translat
getDDIEditor
().
processingSucceeded
();
break
;
case
DeleteStudyWindow
.
GOAL
+
DELETESTUDYWINDOWNAME:
getDDIEditor
().
setWaiting
();
...
...
src/main/resources/org/vaadin/spring/i18n/messages_de.properties
View file @
d271c6c0
...
...
@@ -189,8 +189,8 @@ SelectionView.Study.button.cloneQuestionnaire = Fragebogen klonen
SelectionView.Study.button.editQuestion
=
Frage editieren
SelectionView.study.table.column.header.name
=
Name
SelectionView.Study.button.editStudy
=
Studie editieren
SelectionView.Study.button.editStudyDescription
=
Studie
nbeschreibung
editieren
SelectionView.Study.button.editStudy
=
Studie
titel
editieren
SelectionView.Study.button.editStudyDescription
=
Studie editieren
SelectionView.Study.button.deleteStudy
=
Studie löschen
SelectionView.Study.button.editQuestionnaire
=
Fragebogen editieren
SelectionView.Study.button.deleteQuestionnaire
=
Fragebogen löschen
...
...
@@ -579,7 +579,7 @@ NewStudyWindow.label = Name der Studie
NewStudyWindow.fileName
=
Dateiname
NewStudyWindow.comment
=
Bearbeitungsgrund
EditStudyWindow.title
=
Studie editieren
EditStudyWindow.title
=
Studie
titel
editieren
EditStudyWindow.store
=
Speichern
EditStudyWindow.cancel
=
Abbrechen
EditStudyWindow.help
=
Studie "{0}" editieren.
...
...
@@ -1084,8 +1084,8 @@ EditStudyDescriptionWindow.topics = Themen
EditStudyDescriptionWindow.content
=
Inhalt
EditStudyDescriptionWindow.store
=
Speichern
EditStudyDescriptionWindow.cancel
=
Abbrechen
EditStudyDescriptionWindow.help
=
Studienbeschreibung editieren
EditStudyDescriptionWindow.title
=
Studie
nbeschreibung
editieren
EditStudyDescriptionWindow.help
=
EditStudyDescriptionWindow.title
=
Studieeditieren
EditStudyDescriptionWindow.categories.description
=
ZA-Kategorienschema
EditStudyDescriptionWindow.topics.description
=
CESSDA-Themen-Klassifikation
...
...
src/main/resources/org/vaadin/spring/i18n/messages_en.properties
View file @
d271c6c0
...
...
@@ -147,8 +147,8 @@ SelectionView.Study.button.cloneQuestionnaire = Clone questionnaire
SelectionView.Study.button.editQuestion
=
edit Question
SelectionView.study.table.column.header.name
=
Name
SelectionView.Study.button.editStudy
=
Edit study
SelectionView.Study.button.editStudyDescription
=
Edit study
description
SelectionView.Study.button.editStudy
=
Edit study
title
SelectionView.Study.button.editStudyDescription
=
Edit study
SelectionView.Study.button.deleteStudy
=
Delete study
SelectionView.Study.button.editQuestionnaire
=
Edit questionnaire
SelectionView.Study.button.deleteQuestionnaire
=
Delete questionnaire
...
...
@@ -569,7 +569,7 @@ NewStudyWindow.label = Name of the study
NewStudyWindow.fileName
=
file name
NewStudyWindow.comment
=
Edit reason
EditStudyWindow.title
=
Edit study
EditStudyWindow.title
=
Edit study
title
EditStudyWindow.store
=
Save
EditStudyWindow.cancel
=
Cancel
EditStudyWindow.help
=
...
...
@@ -1079,8 +1079,8 @@ EditStudyDescriptionWindow.topics = Topics
EditStudyDescriptionWindow.content
=
Content
EditStudyDescriptionWindow.store
=
Save
EditStudyDescriptionWindow.cancel
=
Cancel
EditStudyDescriptionWindow.help
=
Edit study description
EditStudyDescriptionWindow.title
=
Edit study
description
EditStudyDescriptionWindow.help
=
EditStudyDescriptionWindow.title
=
Edit study
EditStudyDescriptionWindow.categories.description
=
ZA categories scheme
EditStudyDescriptionWindow.topics.description
=
CESSDA Topic Classification
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment