Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NomadGUI
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Instrument Control
NomadGUI
Commits
3117ea59
Commit
3117ea59
authored
4 years ago
by
helene ortiz
Browse files
Options
Downloads
Patches
Plain Diff
file attachments in chat (to be continued...)
parent
5f80617c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/ill/ics/client/control/chat/ChatFileManager.java
+12
-3
12 additions, 3 deletions
.../java/fr/ill/ics/client/control/chat/ChatFileManager.java
with
12 additions
and
3 deletions
src/main/java/fr/ill/ics/client/control/chat/ChatFileManager.java
+
12
−
3
View file @
3117ea59
...
...
@@ -52,6 +52,7 @@ public class ChatFileManager {
private
final
static
String
MESSAGE_PREFIX
=
"message:"
;
private
final
static
String
SENDER_PREFIX
=
"sender:"
;
private
final
static
String
TIMESTAMP_PREFIX
=
"timestamp:"
;
private
final
static
String
FILE_PREFIX
=
"file:"
;
private
final
static
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
...
...
@@ -94,7 +95,15 @@ public class ChatFileManager {
String
timestampString
=
tokenizer
.
nextToken
();
timestampString
=
timestampString
.
replace
(
TIMESTAMP_PREFIX
,
""
);
LocalDateTime
timestamp
=
LocalDateTime
.
parse
(
timestampString
,
formatter
);
ChatEvent
event
=
new
ChatEvent
(
sender
,
message
,
timestamp
);
ChatEvent
event
;
if
(
tokenizer
.
hasMoreTokens
())
{
String
file
=
tokenizer
.
nextToken
();
file
=
file
.
replace
(
FILE_PREFIX
,
""
);
event
=
new
AttachedFileChatEvent
(
sender
,
message
,
file
,
file
.
substring
(
file
.
lastIndexOf
(
"."
)+
1
));
}
else
{
event
=
new
ChatEvent
(
sender
,
message
,
timestamp
);
}
messages
.
add
(
event
);
}
}
catch
(
NoSuchElementException
e
)
{
...
...
@@ -138,7 +147,7 @@ public class ChatFileManager {
String
chatLine
=
MESSAGE_PREFIX
+
message
+
CHAT_DELIMITER
+
SENDER_PREFIX
+
event
.
getSender
()
+
CHAT_DELIMITER
+
TIMESTAMP_PREFIX
+
formatter
.
format
(
event
.
getTimestamp
());
if
(
event
.
hasAttachment
())
{
chatLine
=
chatLine
+
CHAT_DELIMITER
+
((
AttachedFileChatEvent
)
event
).
getShortFileName
();
chatLine
=
chatLine
+
CHAT_DELIMITER
+
FILE_PREFIX
+
((
AttachedFileChatEvent
)
event
).
getShortFileName
();
}
// Update chat's file
...
...
@@ -153,7 +162,7 @@ public class ChatFileManager {
private
String
getFilePath
(
long
proposNo
)
{
return
getDirectoryPath
()
+
"chat"
+
proposNo
+
".xml"
;
}
private
String
getAttachedFilePath
(
long
proposNo
)
{
return
getDirectoryPath
()
+
proposNo
+
ConfigManager
.
FILE_SEPARATOR
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment