Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tp-4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pirkl-poo-2018
tp-4
Commits
a34f5167
Commit
a34f5167
authored
6 years ago
by
Alexis Durgnat
Browse files
Options
Downloads
Patches
Plain Diff
Label change when journeying
parent
c87b0aac
No related branches found
No related tags found
1 merge request
!21
*poof* final version
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/ch/hepia/api/transport/Connection.java
+7
-0
7 additions, 0 deletions
src/main/java/ch/hepia/api/transport/Connection.java
src/main/java/ch/hepia/ui/MainWindowController.java
+34
-26
34 additions, 26 deletions
src/main/java/ch/hepia/ui/MainWindowController.java
with
41 additions
and
26 deletions
src/main/java/ch/hepia/api/transport/Connection.java
+
7
−
0
View file @
a34f5167
...
...
@@ -71,6 +71,13 @@ public class Connection implements Serializable {
return
new
ArrayList
<>(
sections
);
}
public
Stop
getFrom
(){
return
this
.
from
;
}
public
Stop
getTo
(){
return
this
.
to
;
}
/**
* Builder of Connection object
...
...
This diff is collapsed.
Click to expand it.
src/main/java/ch/hepia/ui/MainWindowController.java
+
34
−
26
View file @
a34f5167
...
...
@@ -75,6 +75,8 @@ public class MainWindowController implements Initializable {
private
List
<
Connection
>
currentConnections
;
private
Connection
currentJourney
;
/**
* Shows a sad message when the API crashes.
*/
...
...
@@ -252,6 +254,19 @@ public class MainWindowController implements Initializable {
}
}
/**
* Create a new journey and broadcast it
* @param app App context
* @param pnl Panel containing the journey information
*/
private
void
createJourney
(
AppContext
app
,
Pane
pnl
)
{
Integer
pos
=
Integer
.
parseInt
(
pnl
.
getId
());
app
.
getMessageManager
().
sendJoinedJourney
(
new
JoinedJourney
(
app
.
getUser
().
get
(),
currentConnections
.
get
(
pos
)));
currentJourney
=
currentConnections
.
get
(
pos
);
currentJourneyLabel
.
setText
(
"Vous voyagez de "
+
currentJourney
.
getFrom
().
getLocation
().
getName
()
+
" vers "
+
currentJourney
.
getTo
().
getLocation
().
getName
()
+
"."
);
}
/**
* Parse the line and search for chat command.
* @param cmd The line to parse.
...
...
@@ -357,8 +372,7 @@ public class MainWindowController implements Initializable {
connectionContainer
.
getChildren
().
add
(
pane
);
pane
.
setOnMouseClicked
(
e
->
{
Pane
pnl
=
(
Pane
)
e
.
getSource
();
Integer
pos
=
Integer
.
parseInt
(
pnl
.
getId
());
app
.
getMessageManager
().
sendJoinedJourney
(
new
JoinedJourney
(
app
.
getUser
().
get
(),
currentConnections
.
get
(
pos
)));
createJourney
(
app
,
pnl
);
});
});
}
...
...
@@ -367,10 +381,8 @@ public class MainWindowController implements Initializable {
}
});
// Subscribe to chat message
app
.
getMessageManager
().
conditionalSubscribeChatMessage
(
chatMessage
->
{
app
.
getMessageManager
().
conditionalSubscribeChatMessage
(
chatMessage
->
{
Platform
.
runLater
(()
->
{
User
sender
=
chatMessage
.
getUser
();
String
message
=
sender
.
getName
()
+
": "
+
chatMessage
.
getMessage
();
...
...
@@ -380,9 +392,7 @@ public class MainWindowController implements Initializable {
drawMessage
(
message
,
AppConfig
.
CHAT_MESSAGE_ICON
,
AppConfig
.
COLOR_BLUE_10_OPACITY
);
}
});
},
chatMessage
->
!(
app
.
getUser
().
get
().
getIgnoredUserList
().
contains
(
chatMessage
.
getUser
()))
);
},
chatMessage
->
!(
app
.
getUser
().
get
().
getIgnoredUserList
().
contains
(
chatMessage
.
getUser
())));
// Subscribe to joined journey
app
.
getMessageManager
().
conditionalSubscribeJoinedJourney
(
joinedJourney
->
Platform
.
runLater
(()
->
{
...
...
@@ -393,8 +403,7 @@ public class MainWindowController implements Initializable {
}
else
{
drawMessage
(
message
,
AppConfig
.
CHAT_MESSAGE_ICON
,
AppConfig
.
COLOR_BLUE_10_OPACITY
);
}
}),
joinedJourney
->
!(
app
.
getUser
().
get
().
getIgnoredUserList
().
contains
(
joinedJourney
.
getUser
())));
}),
joinedJourney
->
!(
app
.
getUser
().
get
().
getIgnoredUserList
().
contains
(
joinedJourney
.
getUser
())));
// Subscribe to left journey
app
.
getMessageManager
().
conditionalSubscribeLeftJourney
(
leftJourney
->
Platform
.
runLater
(()
->
{
...
...
@@ -405,8 +414,7 @@ public class MainWindowController implements Initializable {
}
else
{
drawMessage
(
message
,
AppConfig
.
CHAT_MESSAGE_ICON
,
AppConfig
.
COLOR_BLUE_10_OPACITY
);
}
}),
leftJourney
->
!(
app
.
getUser
().
get
().
getIgnoredUserList
().
contains
(
leftJourney
.
getUser
())));
}),
leftJourney
->
!(
app
.
getUser
().
get
().
getIgnoredUserList
().
contains
(
leftJourney
.
getUser
())));
// Login messages:
drawCommands
();
...
...
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