show a message instead of search bar while disconnected

pull/4/head
Zlatin Balevsky 2019-06-02 04:12:11 +01:00
parent d18a618575
commit c51e3874da
2 changed files with 28 additions and 8 deletions

View File

@ -120,6 +120,11 @@ class MainFrameModel {
runInsideUIAsync {
connections = core.connectionManager.getConnections().size()
if (connections > 0) {
def topPanel = builder.getVariable("top-panel")
topPanel.getLayout().show(topPanel, "top-search-panel")
}
connectionList.add(e.endpoint.destination)
JTable table = builder.getVariable("connections-table")
table.model.fireTableDataChanged()
@ -129,6 +134,12 @@ class MainFrameModel {
void onDisconnectionEvent(DisconnectionEvent e) {
runInsideUIAsync {
connections = core.connectionManager.getConnections().size()
if (connections == 0) {
def topPanel = builder.getVariable("top-panel")
topPanel.getLayout().show(topPanel, "top-connect-panel")
}
connectionList.remove(e.destination)
JTable table = builder.getVariable("connections-table")
table.model.fireTableDataChanged()

View File

@ -52,6 +52,13 @@ class MainFrameView {
button(text: "Uploads", actionPerformed : showUploadsWindow)
button(text: "Monitor", actionPerformed : showMonitorWindow)
}
panel(id: "top-panel", constraints: BorderLayout.CENTER) {
cardLayout()
panel(constraints : "top-connect-panel") {
label(text : "MuWire is connecting, please wait. You will be able to search soon.")
}
panel(constraints : "top-search-panel") {
borderLayout()
panel(constraints: BorderLayout.CENTER) {
borderLayout()
label(" Enter search here:", constraints: BorderLayout.WEST) // TODO: fix this
@ -62,6 +69,8 @@ class MainFrameView {
button(text: "Search", searchAction)
}
}
}
}
panel (id: "cards-panel", constraints : BorderLayout.CENTER) {
cardLayout()
panel (constraints : "search window") {