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