mirror of https://github.com/zlatinb/muwire
enable/disable say field when not connected
parent
2954bd2f1a
commit
c6becb93dc
|
@ -26,6 +26,7 @@ class ChatServerModel {
|
||||||
@Observable boolean disconnectActionEnabled
|
@Observable boolean disconnectActionEnabled
|
||||||
@Observable String buttonText = "Disconnect"
|
@Observable String buttonText = "Disconnect"
|
||||||
@Observable ChatConnectionAttemptStatus status
|
@Observable ChatConnectionAttemptStatus status
|
||||||
|
@Observable boolean sayActionEnabled
|
||||||
|
|
||||||
volatile ChatLink link
|
volatile ChatLink link
|
||||||
volatile Thread poller
|
volatile Thread poller
|
||||||
|
@ -71,6 +72,7 @@ class ChatServerModel {
|
||||||
|
|
||||||
runInsideUIAsync {
|
runInsideUIAsync {
|
||||||
status = e.status
|
status = e.status
|
||||||
|
sayActionEnabled = status == ChatConnectionAttemptStatus.SUCCESSFUL
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.status == ChatConnectionAttemptStatus.SUCCESSFUL) {
|
if (e.status == ChatConnectionAttemptStatus.SUCCESSFUL) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import javax.swing.SwingConstants
|
||||||
import javax.swing.SpringLayout.Constraints
|
import javax.swing.SpringLayout.Constraints
|
||||||
|
|
||||||
import com.muwire.core.Persona
|
import com.muwire.core.Persona
|
||||||
|
import com.muwire.core.chat.ChatConnectionAttemptStatus
|
||||||
|
|
||||||
import java.awt.BorderLayout
|
import java.awt.BorderLayout
|
||||||
import java.awt.event.MouseAdapter
|
import java.awt.event.MouseAdapter
|
||||||
|
@ -38,6 +39,7 @@ class ChatRoomView {
|
||||||
|
|
||||||
void initUI() {
|
void initUI() {
|
||||||
int rowHeight = application.context.get("row-height")
|
int rowHeight = application.context.get("row-height")
|
||||||
|
def parentModel = mvcGroup.parentGroup.model
|
||||||
if (model.console || model.privateChat) {
|
if (model.console || model.privateChat) {
|
||||||
pane = builder.panel {
|
pane = builder.panel {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
|
@ -50,8 +52,8 @@ class ChatRoomView {
|
||||||
panel(constraints : BorderLayout.SOUTH) {
|
panel(constraints : BorderLayout.SOUTH) {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
label(text : "Say something here: ", constraints : BorderLayout.WEST)
|
label(text : "Say something here: ", constraints : BorderLayout.WEST)
|
||||||
sayField = textField(actionPerformed : {controller.say()}, constraints : BorderLayout.CENTER)
|
sayField = textField(enabled : bind {parentModel.sayActionEnabled}, actionPerformed : {controller.say()}, constraints : BorderLayout.CENTER)
|
||||||
button(text : "Say", constraints : BorderLayout.EAST, sayAction)
|
button(enabled : bind {parentModel.sayActionEnabled},text : "Say", constraints : BorderLayout.EAST, sayAction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,8 +84,8 @@ class ChatRoomView {
|
||||||
panel(constraints : BorderLayout.SOUTH) {
|
panel(constraints : BorderLayout.SOUTH) {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
label(text : "Say something here: ", constraints : BorderLayout.WEST)
|
label(text : "Say something here: ", constraints : BorderLayout.WEST)
|
||||||
sayField = textField(actionPerformed : {controller.say()}, constraints : BorderLayout.CENTER)
|
sayField = textField(enabled : bind {parentModel.sayActionEnabled}, actionPerformed : {controller.say()}, constraints : BorderLayout.CENTER)
|
||||||
button(text : "Say", constraints : BorderLayout.EAST, sayAction)
|
button(enabled : bind {parentModel.sayActionEnabled}, text : "Say", constraints : BorderLayout.EAST, sayAction)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue