Expose network information to GUI cleanly

This commit introduces io.bitsquare.network.ClientNode--an interface
whose name and structure will surely change--as a simplistic abstraction
over TomP2PNode that allows for exposing information to the "Network"
tab of the Preferences section of the GUI without actually requiring the
injection of TomP2PNode and other tomp2p internals into the GUI layer.

Changes to 'network' and 'msg' packages:
----------------------------------------

 - Move ConnectionType enum from test into main tree, and expose
   ClientNode#getConnectionType.

 - Both ClientNode and TomP2P are now available for injection. Both
   types are bound to the same TomP2P singleton instance. Note
   especially how NetworkPreferencesViewCB now receives a ClientNode
   instead of a TomP2PNode.

 - Restore package-private visibility to BootstrappedPeerFactory

 - Remove no longer necessary TomP2PNode#getPeerDHT

 - Expose getter for BootstrappedPeerFactory#bootstrapState

Changes to 'gui' package:
-------------------------

 - NetworkPreferencesViewCB has been simplified. All no-op methods have
   been removed, and the class now simply implements JavaFX's
   Initializable interface as opposed to Bitsquare's own ViewCB
   hierarchy, because the latter is not actually necessary (no caching
   is required for the data handled by this controller, etc.

 - In order to make the above possible, PreferencesViewCB now tolerates
   adding non-ViewCB child controllers.

 - NetworkPreferencesPM has been removed (perhaps temporarily), in an
   experiment to see "just how simple" CB controller classes can be.

 - Text fields in NetworkPreferencesView have been renamed.

Notes:
------

The data that now shows up in the "Network" tab is no longer formatted
as it once was; values are essentially nothing more than their #toString
representations. Again, this can be tweaked further, but leaving things
in this raw state provides an opportunity to discuss the current
presentation model approach, ViewCB hierarchy, etc.
This commit is contained in:
Chris Beams 2014-11-12 18:39:55 +01:00
parent d657763596
commit c7f7b37572
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
10 changed files with 123 additions and 202 deletions

View file

@ -18,6 +18,7 @@
package io.bitsquare.msg;
import io.bitsquare.network.BootstrapNodes;
import io.bitsquare.network.ConnectionType;
import io.bitsquare.network.Node;
import io.bitsquare.util.Repeat;
import io.bitsquare.util.RepeatRule;
@ -80,10 +81,6 @@ import static org.junit.Assert.*;
public class TomP2PTests {
private static final Logger log = LoggerFactory.getLogger(TomP2PTests.class);
private enum ConnectionType {
UNKNOWN, DIRECT, NAT, RELAY
}
// If you want to test in one specific connection mode define it directly, otherwise use UNKNOWN
private static final ConnectionType FORCED_CONNECTION_TYPE = ConnectionType.DIRECT;