mirror of https://github.com/zlatinb/muwire
disable button until core initialized
parent
b1d30dc29f
commit
415b6e5287
|
@ -137,12 +137,12 @@ public class Core {
|
|||
|
||||
log.info("initializing host cache")
|
||||
File hostStorage = new File(home, "hosts.json")
|
||||
HostCache hostCache = new HostCache(trustService,hostStorage, 30000, props, i2pSession.getMyDestination())
|
||||
hostCache = new HostCache(trustService,hostStorage, 30000, props, i2pSession.getMyDestination())
|
||||
eventBus.register(HostDiscoveredEvent.class, hostCache)
|
||||
eventBus.register(ConnectionEvent.class, hostCache)
|
||||
|
||||
log.info("initializing connection manager")
|
||||
ConnectionManager connectionManager = props.isLeaf() ?
|
||||
connectionManager = props.isLeaf() ?
|
||||
new LeafConnectionManager(eventBus, me, 3, hostCache) : new UltrapeerConnectionManager(eventBus, me, 512, 512, hostCache, trustService)
|
||||
eventBus.register(TrustEvent.class, connectionManager)
|
||||
eventBus.register(ConnectionEvent.class, connectionManager)
|
||||
|
@ -186,8 +186,8 @@ public class Core {
|
|||
|
||||
public void startServices() {
|
||||
hasherService.start()
|
||||
trustService.waitForLoad()
|
||||
trustService.start()
|
||||
trustService.waitForLoad()
|
||||
persisterService.start()
|
||||
hostCache.start()
|
||||
connectionManager.start()
|
||||
|
|
|
@ -12,6 +12,8 @@ import javax.inject.Inject
|
|||
import static griffon.util.GriffonApplicationUtils.isMacOSX
|
||||
import static groovy.swing.SwingBuilder.lookAndFeel
|
||||
|
||||
import java.beans.PropertyChangeEvent
|
||||
|
||||
@Log
|
||||
class Ready extends AbstractLifecycleHandler {
|
||||
@Inject
|
||||
|
@ -48,6 +50,9 @@ class Ready extends AbstractLifecycleHandler {
|
|||
Core core = new Core(props, home)
|
||||
core.startServices()
|
||||
application.context.put("core",core)
|
||||
application.getPropertyChangeListeners("core").each {
|
||||
it.propertyChange(new PropertyChangeEvent(this, "core", null, core))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,27 @@
|
|||
package com.muwire.gui
|
||||
|
||||
import javax.annotation.Nonnull
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Named
|
||||
|
||||
import com.muwire.core.Core
|
||||
|
||||
import griffon.core.artifact.GriffonModel
|
||||
import griffon.core.GriffonApplication
|
||||
import griffon.inject.Contextual
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.transform.Observable
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
|
||||
@ArtifactProviderFor(GriffonModel)
|
||||
class EventListModel {
|
||||
@Inject @Nonnull GriffonApplication application
|
||||
@Observable int clickCount = 0
|
||||
@Observable boolean coreInitialized = false
|
||||
|
||||
void mvcGroupInit(Map<String, Object> args) {
|
||||
application.addPropertyChangeListener("core", {e ->
|
||||
coreInitialized = (e.getNewValue() != null)
|
||||
})
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ class EventListView {
|
|||
gridLayout(rows: 2, cols: 1)
|
||||
label(id: 'clickLabel', text: bind { model.clickCount },
|
||||
horizontalAlignment: SwingConstants.CENTER)
|
||||
button(id: 'clickButton', clickAction)
|
||||
button(id: 'clickButton', clickAction, enabled: bind {model.coreInitialized})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue