remove trailing spaces
This commit is contained in:
@@ -30,9 +30,9 @@ class I2PStatusController {
|
||||
model.receiveBps = router._context.bandwidthLimiter().getReceiveBps15s()
|
||||
model.sendBps = router._context.bandwidthLimiter().getSendBps15s()
|
||||
model.participatingBW = router._context.bandwidthLimiter().getCurrentParticipatingBandwidth()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void close() {
|
||||
view.dialog.setVisible(false)
|
||||
|
@@ -36,19 +36,19 @@ class MainFrameController {
|
||||
@Inject @Nonnull GriffonApplication application
|
||||
@MVCMember @Nonnull
|
||||
FactoryBuilderSupport builder
|
||||
|
||||
|
||||
@MVCMember @Nonnull
|
||||
MainFrameModel model
|
||||
@MVCMember @Nonnull
|
||||
MainFrameView view
|
||||
|
||||
private volatile Core core
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void search() {
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel, "search window")
|
||||
|
||||
|
||||
def search = builder.getVariable("search-field").text
|
||||
search = search.trim()
|
||||
if (search.length() == 0)
|
||||
@@ -72,7 +72,7 @@ class MainFrameController {
|
||||
// not a hash search
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def searchEvent
|
||||
if (hashSearch) {
|
||||
searchEvent = new SearchEvent(searchHash : root, uuid : uuid, oobInfohash: true)
|
||||
@@ -84,11 +84,11 @@ class MainFrameController {
|
||||
terms.each { if (it.length() > 0) nonEmpty << it }
|
||||
searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true)
|
||||
}
|
||||
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true,
|
||||
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true,
|
||||
replyTo: core.me.destination, receivedOn: core.me.destination,
|
||||
originator : core.me))
|
||||
}
|
||||
|
||||
|
||||
void search(String infoHash, String tabTitle) {
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel, "search window")
|
||||
@@ -98,14 +98,14 @@ class MainFrameController {
|
||||
params["uuid"] = uuid.toString()
|
||||
def group = mvcGroup.createMVCGroup("SearchTab", uuid.toString(), params)
|
||||
model.results[uuid.toString()] = group
|
||||
|
||||
|
||||
def searchEvent = new SearchEvent(searchHash : Base64.decode(infoHash), uuid:uuid,
|
||||
oobInfohash: true)
|
||||
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : true,
|
||||
replyTo: core.me.destination, receivedOn: core.me.destination,
|
||||
originator : core.me))
|
||||
}
|
||||
|
||||
|
||||
private def selectedResult() {
|
||||
def selected = builder.getVariable("result-tabs").getSelectedComponent()
|
||||
def group = selected.getClientProperty("mvc-group")
|
||||
@@ -116,10 +116,10 @@ class MainFrameController {
|
||||
def sortEvt = group.view.lastSortEvent
|
||||
if (sortEvt != null) {
|
||||
row = group.view.resultsTable.rowSorter.convertRowIndexToModel(row)
|
||||
}
|
||||
group.model.results[row]
|
||||
}
|
||||
group.model.results[row]
|
||||
}
|
||||
|
||||
|
||||
private int selectedDownload() {
|
||||
def downloadsTable = builder.getVariable("downloads-table")
|
||||
def selected = downloadsTable.getSelectedRow()
|
||||
@@ -128,27 +128,27 @@ class MainFrameController {
|
||||
selected = downloadsTable.rowSorter.convertRowIndexToModel(selected)
|
||||
selected
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void download() {
|
||||
def result = selectedResult()
|
||||
if (result == null)
|
||||
return
|
||||
|
||||
|
||||
if (!model.canDownload(result.infohash))
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def file = new File(application.context.get("muwire-settings").downloadLocation, result.name)
|
||||
|
||||
|
||||
def selected = builder.getVariable("result-tabs").getSelectedComponent()
|
||||
def group = selected.getClientProperty("mvc-group")
|
||||
|
||||
|
||||
def resultsBucket = group.model.hashBucket[result.infohash]
|
||||
def sources = group.model.sourcesBucket[result.infohash]
|
||||
|
||||
|
||||
core.eventBus.publish(new UIDownloadEvent(result : resultsBucket, sources: sources, target : file))
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void trust() {
|
||||
def result = selectedResult()
|
||||
@@ -156,7 +156,7 @@ class MainFrameController {
|
||||
return // TODO disable button
|
||||
core.eventBus.publish( new TrustEvent(persona : result.sender, level : TrustLevel.TRUSTED))
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void distrust() {
|
||||
def result = selectedResult()
|
||||
@@ -164,22 +164,22 @@ class MainFrameController {
|
||||
return // TODO disable button
|
||||
core.eventBus.publish( new TrustEvent(persona : result.sender, level : TrustLevel.DISTRUSTED))
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
|
||||
@ControllerAction
|
||||
void cancel() {
|
||||
def downloader = model.downloads[selectedDownload()].downloader
|
||||
downloader.cancel()
|
||||
model.downloadInfoHashes.remove(downloader.getInfoHash())
|
||||
core.eventBus.publish(new UIDownloadCancelledEvent(downloader : downloader))
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void resume() {
|
||||
def downloader = model.downloads[selectedDownload()].downloader
|
||||
downloader.resume()
|
||||
core.eventBus.publish(new UIDownloadResumedEvent())
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void pause() {
|
||||
def downloader = model.downloads[selectedDownload()].downloader
|
||||
@@ -194,21 +194,21 @@ class MainFrameController {
|
||||
builder.getVariable(tableName).model.fireTableDataChanged()
|
||||
core.eventBus.publish(new TrustEvent(persona : list[row], level : level))
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void markTrusted() {
|
||||
markTrust("distrusted-table", TrustLevel.TRUSTED, model.distrusted)
|
||||
model.markTrustedButtonEnabled = false
|
||||
model.markNeutralFromDistrustedButtonEnabled = false
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void markNeutralFromDistrusted() {
|
||||
markTrust("distrusted-table", TrustLevel.NEUTRAL, model.distrusted)
|
||||
model.markTrustedButtonEnabled = false
|
||||
model.markNeutralFromDistrustedButtonEnabled = false
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void markDistrusted() {
|
||||
markTrust("trusted-table", TrustLevel.DISTRUSTED, model.trusted)
|
||||
@@ -216,7 +216,7 @@ class MainFrameController {
|
||||
model.markDistrustedButtonEnabled = false
|
||||
model.markNeutralFromTrustedButtonEnabled = false
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void markNeutralFromTrusted() {
|
||||
markTrust("trusted-table", TrustLevel.NEUTRAL, model.trusted)
|
||||
@@ -224,7 +224,7 @@ class MainFrameController {
|
||||
model.markDistrustedButtonEnabled = false
|
||||
model.markNeutralFromTrustedButtonEnabled = false
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void subscribe() {
|
||||
int row = view.getSelectedTrustTablesRow("trusted-table")
|
||||
@@ -238,7 +238,7 @@ class MainFrameController {
|
||||
model.markDistrustedButtonEnabled = false
|
||||
model.markNeutralFromTrustedButtonEnabled = false
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void review() {
|
||||
RemoteTrustList list = getSelectedTrustList()
|
||||
@@ -249,9 +249,9 @@ class MainFrameController {
|
||||
env["trustService"] = core.trustService
|
||||
env["eventBus"] = core.eventBus
|
||||
mvcGroup.createMVCGroup("trust-list", env)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void update() {
|
||||
RemoteTrustList list = getSelectedTrustList()
|
||||
@@ -259,7 +259,7 @@ class MainFrameController {
|
||||
return
|
||||
core.eventBus.publish(new TrustSubscriptionEvent(persona : list.persona, subscribe : true))
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void unsubscribe() {
|
||||
RemoteTrustList list = getSelectedTrustList()
|
||||
@@ -272,42 +272,42 @@ class MainFrameController {
|
||||
table.model.fireTableDataChanged()
|
||||
core.eventBus.publish(new TrustSubscriptionEvent(persona : list.persona, subscribe : false))
|
||||
}
|
||||
|
||||
|
||||
private RemoteTrustList getSelectedTrustList() {
|
||||
int row = view.getSelectedTrustTablesRow("subscription-table")
|
||||
if (row < 0)
|
||||
return null
|
||||
model.subscriptions[row]
|
||||
}
|
||||
|
||||
|
||||
void unshareSelectedFile() {
|
||||
SharedFile sf = view.selectedSharedFile()
|
||||
if (sf == null)
|
||||
return
|
||||
core.eventBus.publish(new FileUnsharedEvent(unsharedFile : sf))
|
||||
}
|
||||
|
||||
|
||||
void stopWatchingDirectory() {
|
||||
String directory = mvcGroup.view.getSelectedWatchedDirectory()
|
||||
if (directory == null)
|
||||
return
|
||||
core.muOptions.watchedDirectories.remove(directory)
|
||||
saveMuWireSettings()
|
||||
saveMuWireSettings()
|
||||
core.eventBus.publish(new DirectoryUnsharedEvent(directory : new File(directory)))
|
||||
|
||||
|
||||
model.watched.remove(directory)
|
||||
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
||||
}
|
||||
|
||||
|
||||
void saveMuWireSettings() {
|
||||
File f = new File(core.home, "MuWire.properties")
|
||||
f.withOutputStream {
|
||||
f.withOutputStream {
|
||||
core.muOptions.write(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
application.addPropertyChangeListener("core", {e->
|
||||
application.addPropertyChangeListener("core", {e->
|
||||
core = e.getNewValue()
|
||||
})
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ class MuWireStatusController {
|
||||
@ControllerAction
|
||||
void refresh() {
|
||||
Core core = application.context.get("core")
|
||||
|
||||
|
||||
int incoming = 0
|
||||
int outgoing = 0
|
||||
core.connectionManager.getConnections().each {
|
||||
@@ -29,14 +29,14 @@ class MuWireStatusController {
|
||||
}
|
||||
model.incomingConnections = incoming
|
||||
model.outgoingConnections = outgoing
|
||||
|
||||
|
||||
model.knownHosts = core.hostCache.hosts.size()
|
||||
|
||||
|
||||
model.sharedFiles = core.fileManager.fileToSharedFile.size()
|
||||
|
||||
|
||||
model.downloads = core.downloadManager.downloaders.size()
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void close() {
|
||||
view.dialog.setVisible(false)
|
||||
|
@@ -26,41 +26,41 @@ class OptionsController {
|
||||
String text
|
||||
Core core = application.context.get("core")
|
||||
MuWireSettings settings = application.context.get("muwire-settings")
|
||||
|
||||
|
||||
def i2pProps = core.i2pOptions
|
||||
|
||||
|
||||
text = view.inboundLengthField.text
|
||||
model.inboundLength = text
|
||||
i2pProps["inbound.length"] = text
|
||||
|
||||
|
||||
text = view.inboundQuantityField.text
|
||||
model.inboundQuantity = text
|
||||
i2pProps["inbound.quantity"] = text
|
||||
|
||||
|
||||
text = view.outboundQuantityField.text
|
||||
model.outboundQuantity = text
|
||||
i2pProps["outbound.quantity"] = text
|
||||
|
||||
|
||||
text = view.outboundLengthField.text
|
||||
model.outboundLength = text
|
||||
i2pProps["outbound.length"] = text
|
||||
|
||||
|
||||
if (settings.embeddedRouter) {
|
||||
text = view.i2pNTCPPortField.text
|
||||
model.i2pNTCPPort = text
|
||||
i2pProps["i2np.ntcp.port"] = text
|
||||
|
||||
|
||||
text = view.i2pUDPPortField.text
|
||||
model.i2pUDPPort = text
|
||||
i2pProps["i2np.udp.port"] = text
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
File i2pSettingsFile = new File(core.home, "i2p.properties")
|
||||
i2pSettingsFile.withOutputStream {
|
||||
i2pSettingsFile.withOutputStream {
|
||||
i2pProps.store(it,"")
|
||||
}
|
||||
|
||||
|
||||
text = view.retryField.text
|
||||
model.downloadRetryInterval = text
|
||||
|
||||
@@ -73,12 +73,12 @@ class OptionsController {
|
||||
boolean autoDownloadUpdate = view.autoDownloadUpdateCheckbox.model.isSelected()
|
||||
model.autoDownloadUpdate = autoDownloadUpdate
|
||||
settings.autoDownloadUpdate = autoDownloadUpdate
|
||||
|
||||
|
||||
|
||||
|
||||
boolean shareDownloaded = view.shareDownloadedCheckbox.model.isSelected()
|
||||
model.shareDownloadedFiles = shareDownloaded
|
||||
settings.shareDownloadedFiles = shareDownloaded
|
||||
|
||||
|
||||
String downloadLocation = model.downloadLocation
|
||||
settings.downloadLocation = new File(downloadLocation)
|
||||
|
||||
@@ -90,70 +90,70 @@ class OptionsController {
|
||||
model.outBw = text
|
||||
settings.outBw = Integer.valueOf(text)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
boolean onlyTrusted = view.allowUntrustedCheckbox.model.isSelected()
|
||||
model.onlyTrusted = onlyTrusted
|
||||
settings.setAllowUntrusted(!onlyTrusted)
|
||||
|
||||
|
||||
boolean trustLists = view.allowTrustListsCheckbox.model.isSelected()
|
||||
model.trustLists = trustLists
|
||||
settings.allowTrustLists = trustLists
|
||||
|
||||
|
||||
String trustListInterval = view.trustListIntervalField.text
|
||||
model.trustListInterval = trustListInterval
|
||||
settings.trustListInterval = Integer.parseInt(trustListInterval)
|
||||
|
||||
File settingsFile = new File(core.home, "MuWire.properties")
|
||||
settingsFile.withOutputStream {
|
||||
settingsFile.withOutputStream {
|
||||
settings.write(it)
|
||||
}
|
||||
|
||||
|
||||
// UI Setttings
|
||||
|
||||
|
||||
UISettings uiSettings = application.context.get("ui-settings")
|
||||
text = view.lnfField.text
|
||||
model.lnf = text
|
||||
uiSettings.lnf = text
|
||||
|
||||
|
||||
text = view.fontField.text
|
||||
model.font = text
|
||||
uiSettings.font = text
|
||||
|
||||
|
||||
// boolean showMonitor = view.monitorCheckbox.model.isSelected()
|
||||
// model.showMonitor = showMonitor
|
||||
// uiSettings.showMonitor = showMonitor
|
||||
|
||||
|
||||
boolean clearCancelledDownloads = view.clearCancelledDownloadsCheckbox.model.isSelected()
|
||||
model.clearCancelledDownloads = clearCancelledDownloads
|
||||
uiSettings.clearCancelledDownloads = clearCancelledDownloads
|
||||
|
||||
|
||||
boolean clearFinishedDownloads = view.clearFinishedDownloadsCheckbox.model.isSelected()
|
||||
model.clearFinishedDownloads = clearFinishedDownloads
|
||||
uiSettings.clearFinishedDownloads = clearFinishedDownloads
|
||||
|
||||
|
||||
boolean excludeLocalResult = view.excludeLocalResultCheckbox.model.isSelected()
|
||||
model.excludeLocalResult = excludeLocalResult
|
||||
uiSettings.excludeLocalResult = excludeLocalResult
|
||||
|
||||
|
||||
// boolean showSearchHashes = view.showSearchHashesCheckbox.model.isSelected()
|
||||
// model.showSearchHashes = showSearchHashes
|
||||
// uiSettings.showSearchHashes = showSearchHashes
|
||||
|
||||
|
||||
File uiSettingsFile = new File(core.home, "gui.properties")
|
||||
uiSettingsFile.withOutputStream {
|
||||
uiSettingsFile.withOutputStream {
|
||||
uiSettings.write(it)
|
||||
}
|
||||
|
||||
|
||||
cancel()
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void cancel() {
|
||||
view.d.setVisible(false)
|
||||
mvcGroup.destroy()
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void downloadLocation() {
|
||||
def chooser = new JFileChooser()
|
||||
|
@@ -17,9 +17,9 @@ class TrustListController {
|
||||
TrustListModel model
|
||||
@MVCMember @Nonnull
|
||||
TrustListView view
|
||||
|
||||
|
||||
EventBus eventBus
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void trustFromTrusted() {
|
||||
int selectedRow = view.getSelectedRow("trusted-table")
|
||||
@@ -29,7 +29,7 @@ class TrustListController {
|
||||
eventBus.publish(new TrustEvent(persona : p, level : TrustLevel.TRUSTED))
|
||||
view.fireUpdate("trusted-table")
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void trustFromDistrusted() {
|
||||
int selectedRow = view.getSelectedRow("distrusted-table")
|
||||
@@ -39,7 +39,7 @@ class TrustListController {
|
||||
eventBus.publish(new TrustEvent(persona : p, level : TrustLevel.TRUSTED))
|
||||
view.fireUpdate("distrusted-table")
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void distrustFromTrusted() {
|
||||
int selectedRow = view.getSelectedRow("trusted-table")
|
||||
@@ -49,7 +49,7 @@ class TrustListController {
|
||||
eventBus.publish(new TrustEvent(persona : p, level : TrustLevel.DISTRUSTED))
|
||||
view.fireUpdate("trusted-table")
|
||||
}
|
||||
|
||||
|
||||
@ControllerAction
|
||||
void distrustFromDistrusted() {
|
||||
int selectedRow = view.getSelectedRow("distrusted-table")
|
||||
|
@@ -34,24 +34,24 @@ class Initialize extends AbstractLifecycleHandler {
|
||||
def home = portableHome == null ?
|
||||
selectHome() :
|
||||
portableHome
|
||||
|
||||
|
||||
home = new File(home)
|
||||
if (!home.exists()) {
|
||||
log.info("creating home dir $home")
|
||||
home.mkdirs()
|
||||
}
|
||||
|
||||
|
||||
application.context.put("muwire-home", home.getAbsolutePath())
|
||||
|
||||
|
||||
System.getProperties().setProperty("awt.useSystemAAFontSettings", "true")
|
||||
|
||||
|
||||
def guiPropsFile = new File(home, "gui.properties")
|
||||
UISettings uiSettings
|
||||
if (guiPropsFile.exists()) {
|
||||
Properties props = new Properties()
|
||||
guiPropsFile.withInputStream { props.load(it) }
|
||||
uiSettings = new UISettings(props)
|
||||
|
||||
|
||||
log.info("settting user-specified lnf $uiSettings.lnf")
|
||||
try {
|
||||
lookAndFeel(uiSettings.lnf)
|
||||
@@ -59,7 +59,7 @@ class Initialize extends AbstractLifecycleHandler {
|
||||
log.log(Level.WARNING,"couldn't set desired look and feeel, switching to defaults", bad)
|
||||
uiSettings.lnf = lookAndFeel("system","gtk","metal").getID()
|
||||
}
|
||||
|
||||
|
||||
if (uiSettings.font != null) {
|
||||
log.info("setting user-specified font $uiSettings.font")
|
||||
Font font = new Font(uiSettings.font, Font.PLAIN, 12)
|
||||
@@ -90,10 +90,10 @@ class Initialize extends AbstractLifecycleHandler {
|
||||
log.info("ended up applying $chosen.name")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
application.context.put("ui-settings", uiSettings)
|
||||
}
|
||||
|
||||
|
||||
private static String selectHome() {
|
||||
def home = new File(System.properties["user.home"])
|
||||
def defaultHome = new File(home, ".MuWire")
|
||||
|
@@ -24,9 +24,9 @@ import java.util.logging.Level
|
||||
|
||||
@Log
|
||||
class Ready extends AbstractLifecycleHandler {
|
||||
|
||||
|
||||
@Inject Metadata metadata
|
||||
|
||||
|
||||
@Inject
|
||||
Ready(@Nonnull GriffonApplication application) {
|
||||
super(application)
|
||||
@@ -35,7 +35,7 @@ class Ready extends AbstractLifecycleHandler {
|
||||
@Override
|
||||
void execute() {
|
||||
log.info "starting core services"
|
||||
|
||||
|
||||
def home = new File(application.getContext().getAsString("muwire-home"))
|
||||
def props = new Properties()
|
||||
def propsFile = new File(home, "MuWire.properties")
|
||||
@@ -56,12 +56,12 @@ class Ready extends AbstractLifecycleHandler {
|
||||
"Your nickname is displayed when you send search results so other MuWire users can choose to trust you",
|
||||
"Please choose a nickname", JOptionPane.PLAIN_MESSAGE)
|
||||
if (nickname == null || nickname.trim().length() == 0) {
|
||||
JOptionPane.showMessageDialog(null, "Nickname cannot be empty", "Select another nickname",
|
||||
JOptionPane.showMessageDialog(null, "Nickname cannot be empty", "Select another nickname",
|
||||
JOptionPane.WARNING_MESSAGE)
|
||||
continue
|
||||
}
|
||||
if (nickname.contains("@")) {
|
||||
JOptionPane.showMessageDialog(null, "Nickname cannot contain @, choose another",
|
||||
JOptionPane.showMessageDialog(null, "Nickname cannot contain @, choose another",
|
||||
"Select another nickname", JOptionPane.WARNING_MESSAGE)
|
||||
continue
|
||||
}
|
||||
@@ -69,8 +69,8 @@ class Ready extends AbstractLifecycleHandler {
|
||||
break
|
||||
}
|
||||
props.setNickname(nickname)
|
||||
|
||||
|
||||
|
||||
|
||||
def portableDownloads = System.getProperty("portable.downloads")
|
||||
if (portableDownloads != null) {
|
||||
props.downloadLocation = new File(portableDownloads)
|
||||
@@ -86,12 +86,12 @@ class Ready extends AbstractLifecycleHandler {
|
||||
}
|
||||
props.downloadLocation = chooser.getSelectedFile()
|
||||
}
|
||||
|
||||
|
||||
propsFile.withOutputStream {
|
||||
props.write(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Core core
|
||||
try {
|
||||
core = new Core(props, home, metadata["application.version"])
|
||||
@@ -102,15 +102,15 @@ class Ready extends AbstractLifecycleHandler {
|
||||
System.exit(0)
|
||||
}
|
||||
Runtime.getRuntime().addShutdownHook({
|
||||
core.shutdown()
|
||||
core.shutdown()
|
||||
})
|
||||
core.startServices()
|
||||
application.context.put("muwire-settings", props)
|
||||
application.context.put("core",core)
|
||||
application.getPropertyChangeListeners("core").each {
|
||||
it.propertyChange(new PropertyChangeEvent(this, "core", null, core))
|
||||
application.getPropertyChangeListeners("core").each {
|
||||
it.propertyChange(new PropertyChangeEvent(this, "core", null, core))
|
||||
}
|
||||
|
||||
|
||||
core.eventBus.publish(new UILoadedEvent())
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ class Shutdown extends AbstractLifecycleHandler {
|
||||
Shutdown(@Nonnull GriffonApplication application) {
|
||||
super(application)
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
void execute() {
|
||||
log.info("shutting down")
|
||||
|
@@ -17,10 +17,10 @@ import griffon.metadata.ArtifactProviderFor
|
||||
class EventListModel {
|
||||
@Inject @Nonnull GriffonApplication application
|
||||
@Observable boolean coreInitialized = false
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, Object> args) {
|
||||
application.addPropertyChangeListener("core", {e ->
|
||||
coreInitialized = (e.getNewValue() != null)
|
||||
application.addPropertyChangeListener("core", {e ->
|
||||
coreInitialized = (e.getNewValue() != null)
|
||||
})
|
||||
}
|
||||
}
|
@@ -11,7 +11,7 @@ import griffon.metadata.ArtifactProviderFor
|
||||
class I2PStatusModel {
|
||||
@MVCMember @Nonnull
|
||||
I2PStatusController controller
|
||||
|
||||
|
||||
@Observable int ntcpConnections
|
||||
@Observable int ssuConnections
|
||||
@Observable String networkStatus
|
||||
@@ -21,7 +21,7 @@ class I2PStatusModel {
|
||||
@Observable int receiveBps
|
||||
@Observable int sendBps
|
||||
@Observable int participatingBW
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
controller.refresh()
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ class MainFrameModel {
|
||||
@Inject @Nonnull GriffonApplication application
|
||||
@Observable boolean coreInitialized = false
|
||||
@Observable boolean routerPresent
|
||||
|
||||
|
||||
def results = new ConcurrentHashMap<>()
|
||||
def downloads = []
|
||||
def uploads = []
|
||||
@@ -70,7 +70,7 @@ class MainFrameModel {
|
||||
def trusted = []
|
||||
def distrusted = []
|
||||
def subscriptions = []
|
||||
|
||||
|
||||
@Observable int connections
|
||||
@Observable String me
|
||||
@Observable int loadedFiles
|
||||
@@ -91,34 +91,34 @@ class MainFrameModel {
|
||||
@Observable boolean unsubscribeButtonEnabled
|
||||
|
||||
private final Set<InfoHash> infoHashes = new HashSet<>()
|
||||
|
||||
|
||||
private final Set<InfoHash> downloadInfoHashes = new HashSet<>()
|
||||
|
||||
@Observable volatile Core core
|
||||
@Observable volatile Core core
|
||||
|
||||
private long lastRetryTime = System.currentTimeMillis()
|
||||
|
||||
|
||||
UISettings uiSettings
|
||||
|
||||
|
||||
void updateTablePreservingSelection(String tableName) {
|
||||
def downloadTable = builder.getVariable(tableName)
|
||||
int selectedRow = downloadTable.getSelectedRow()
|
||||
downloadTable.model.fireTableDataChanged()
|
||||
downloadTable.selectionModel.setSelectionInterval(selectedRow,selectedRow)
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, Object> args) {
|
||||
|
||||
|
||||
uiSettings = application.context.get("ui-settings")
|
||||
|
||||
|
||||
Timer timer = new Timer("download-pumper", true)
|
||||
timer.schedule({
|
||||
runInsideUIAsync {
|
||||
if (!mvcGroup.alive)
|
||||
return
|
||||
|
||||
|
||||
// remove cancelled or finished downloads
|
||||
def toRemove = []
|
||||
def toRemove = []
|
||||
downloads.each {
|
||||
if (uiSettings.clearCancelledDownloads &&
|
||||
it.downloader.getCurrentState() == Downloader.DownloadState.CANCELLED)
|
||||
@@ -129,10 +129,10 @@ class MainFrameModel {
|
||||
}
|
||||
toRemove.each {
|
||||
downloads.remove(it)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
builder.getVariable("uploads-table")?.model.fireTableDataChanged()
|
||||
|
||||
|
||||
updateTablePreservingSelection("downloads-table")
|
||||
updateTablePreservingSelection("trusted-table")
|
||||
updateTablePreservingSelection("distrusted-table")
|
||||
@@ -163,7 +163,7 @@ class MainFrameModel {
|
||||
core.eventBus.register(AllFilesLoadedEvent.class, this)
|
||||
core.eventBus.register(UpdateDownloadedEvent.class, this)
|
||||
core.eventBus.register(TrustSubscriptionUpdatedEvent.class, this)
|
||||
|
||||
|
||||
timer.schedule({
|
||||
if (core.shutdown.get())
|
||||
return
|
||||
@@ -176,7 +176,7 @@ class MainFrameModel {
|
||||
runInsideUIAsync {
|
||||
downloads.each {
|
||||
def state = it.downloader.currentState
|
||||
if (state == Downloader.DownloadState.FAILED ||
|
||||
if (state == Downloader.DownloadState.FAILED ||
|
||||
state == Downloader.DownloadState.DOWNLOADING)
|
||||
it.downloader.resume()
|
||||
updateTablePreservingSelection("downloads-table")
|
||||
@@ -186,87 +186,87 @@ class MainFrameModel {
|
||||
}
|
||||
}
|
||||
}, 60000, 60000)
|
||||
|
||||
|
||||
runInsideUIAsync {
|
||||
trusted.addAll(core.trustService.good.values())
|
||||
distrusted.addAll(core.trustService.bad.values())
|
||||
|
||||
|
||||
resumeButtonText = "Retry"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
||||
runInsideUIAsync {
|
||||
watched.addAll(core.muOptions.watchedDirectories)
|
||||
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
||||
watched.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) }
|
||||
|
||||
|
||||
core.muOptions.trustSubscriptions.each {
|
||||
core.eventBus.publish(new TrustSubscriptionEvent(persona : it, subscribe : true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onUpdateDownloadedEvent(UpdateDownloadedEvent e) {
|
||||
runInsideUIAsync {
|
||||
JOptionPane.showMessageDialog(null, "MuWire $e.version has been downloaded. You can update now",
|
||||
JOptionPane.showMessageDialog(null, "MuWire $e.version has been downloaded. You can update now",
|
||||
"Update Downloaded", JOptionPane.INFORMATION_MESSAGE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onUIResultEvent(UIResultEvent e) {
|
||||
MVCGroup resultsGroup = results.get(e.uuid)
|
||||
resultsGroup?.model.handleResult(e)
|
||||
}
|
||||
|
||||
|
||||
void onUIResultBatchEvent(UIResultBatchEvent e) {
|
||||
MVCGroup resultsGroup = results.get(e.uuid)
|
||||
resultsGroup?.model?.handleResultBatch(e.results)
|
||||
}
|
||||
|
||||
|
||||
void onDownloadStartedEvent(DownloadStartedEvent e) {
|
||||
runInsideUIAsync {
|
||||
downloads << e
|
||||
downloadInfoHashes.add(e.downloader.infoHash)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onConnectionEvent(ConnectionEvent e) {
|
||||
if (e.getStatus() != ConnectionAttemptStatus.SUCCESSFUL)
|
||||
return
|
||||
runInsideUIAsync {
|
||||
connections = core.connectionManager.getConnections().size()
|
||||
|
||||
|
||||
if (connections > 0) {
|
||||
def topPanel = builder.getVariable("top-panel")
|
||||
topPanel.getLayout().show(topPanel, "top-search-panel")
|
||||
}
|
||||
|
||||
|
||||
UIConnection con = new UIConnection(destination : e.endpoint.destination, incoming : e.incoming)
|
||||
connectionList.add(con)
|
||||
JTable table = builder.getVariable("connections-table")
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
|
||||
UIConnection con = new UIConnection(destination : e.destination)
|
||||
connectionList.remove(con)
|
||||
JTable table = builder.getVariable("connections-table")
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onFileHashingEvent(FileHashingEvent e) {
|
||||
runInsideUIAsync {
|
||||
loadedFiles = shared.size()
|
||||
@@ -281,7 +281,7 @@ class MainFrameModel {
|
||||
if (e.error != null)
|
||||
return // TODO do something
|
||||
if (infoHashes.contains(e.sharedFile.infoHash))
|
||||
return
|
||||
return
|
||||
infoHashes.add(e.sharedFile.infoHash)
|
||||
runInsideUIAsync {
|
||||
shared << e.sharedFile
|
||||
@@ -290,7 +290,7 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onFileLoadedEvent(FileLoadedEvent e) {
|
||||
if (infoHashes.contains(e.loadedFile.infoHash))
|
||||
return
|
||||
@@ -302,7 +302,7 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onFileUnsharedEvent(FileUnsharedEvent e) {
|
||||
InfoHash infohash = e.unsharedFile.infoHash
|
||||
if (!infoHashes.remove(infohash))
|
||||
@@ -314,7 +314,7 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onUploadEvent(UploadEvent e) {
|
||||
runInsideUIAsync {
|
||||
uploads << e.uploader
|
||||
@@ -322,7 +322,7 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onUploadFinishedEvent(UploadFinishedEvent e) {
|
||||
runInsideUIAsync {
|
||||
uploads.remove(e.uploader)
|
||||
@@ -330,26 +330,26 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onTrustEvent(TrustEvent e) {
|
||||
runInsideUIAsync {
|
||||
|
||||
|
||||
trusted.clear()
|
||||
trusted.addAll(core.trustService.good.values())
|
||||
distrusted.clear()
|
||||
distrusted.addAll(core.trustService.bad.values())
|
||||
|
||||
|
||||
updateTablePreservingSelection("trusted-table")
|
||||
updateTablePreservingSelection("distrusted-table")
|
||||
|
||||
results.values().each { MVCGroup group ->
|
||||
|
||||
results.values().each { MVCGroup group ->
|
||||
if (group.alive) {
|
||||
group.view.pane.getClientProperty("results-table")?.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onTrustSubscriptionUpdatedEvent(TrustSubscriptionUpdatedEvent e) {
|
||||
runInsideUIAsync {
|
||||
if (!subscriptions.contains(e.trustList))
|
||||
@@ -357,11 +357,11 @@ class MainFrameModel {
|
||||
updateTablePreservingSelection("subscription-table")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onQueryEvent(QueryEvent e) {
|
||||
if (e.replyTo == core.me.destination)
|
||||
return
|
||||
|
||||
|
||||
def search
|
||||
if (e.searchEvent.searchHash != null) {
|
||||
if (!uiSettings.showSearchHashes) {
|
||||
@@ -408,7 +408,7 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IncomingSearch {
|
||||
String search
|
||||
Destination replyTo
|
||||
@@ -426,11 +426,11 @@ class MainFrameModel {
|
||||
this.timestamp = Calendar.getInstance()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onUpdateAvailableEvent(UpdateAvailableEvent e) {
|
||||
runInsideUIAsync {
|
||||
|
||||
int option = JOptionPane.showConfirmDialog(null,
|
||||
|
||||
int option = JOptionPane.showConfirmDialog(null,
|
||||
"MuWire $e.version is available from $e.signer. You have "+ metadata["application.version"]+" Update?",
|
||||
"New MuWire version availble", JOptionPane.OK_CANCEL_OPTION)
|
||||
if (option == JOptionPane.CANCEL_OPTION)
|
||||
@@ -438,7 +438,7 @@ class MainFrameModel {
|
||||
controller.search(e.infoHash,"MuWire update")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onRouterDisconnectedEvent(RouterDisconnectedEvent e) {
|
||||
runInsideUIAsync {
|
||||
JOptionPane.showMessageDialog(null, "MuWire lost connection to the I2P router and will now exit.",
|
||||
@@ -446,7 +446,7 @@ class MainFrameModel {
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onFileDownloadedEvent(FileDownloadedEvent e) {
|
||||
if (!core.muOptions.shareDownloadedFiles)
|
||||
return
|
||||
@@ -457,16 +457,16 @@ class MainFrameModel {
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class UIConnection {
|
||||
Destination destination
|
||||
boolean incoming
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
destination.hashCode()
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof UIConnection))
|
||||
@@ -475,7 +475,7 @@ class MainFrameModel {
|
||||
return destination == other.destination
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean canDownload(InfoHash hash) {
|
||||
!downloadInfoHashes.contains(hash)
|
||||
}
|
||||
|
@@ -9,16 +9,16 @@ import griffon.metadata.ArtifactProviderFor
|
||||
|
||||
@ArtifactProviderFor(GriffonModel)
|
||||
class MuWireStatusModel {
|
||||
|
||||
|
||||
@MVCMember @Nonnull
|
||||
MuWireStatusController controller
|
||||
|
||||
|
||||
@Observable int incomingConnections
|
||||
@Observable int outgoingConnections
|
||||
@Observable int knownHosts
|
||||
@Observable int sharedFiles
|
||||
@Observable int downloads
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
controller.refresh()
|
||||
}
|
||||
|
@@ -9,12 +9,12 @@ import griffon.metadata.ArtifactProviderFor
|
||||
|
||||
@ArtifactProviderFor(GriffonModel)
|
||||
class OptionsModel {
|
||||
@Observable String downloadRetryInterval
|
||||
@Observable String downloadRetryInterval
|
||||
@Observable String updateCheckInterval
|
||||
@Observable boolean autoDownloadUpdate
|
||||
@Observable boolean shareDownloadedFiles
|
||||
@Observable String downloadLocation
|
||||
|
||||
|
||||
// i2p options
|
||||
@Observable String inboundLength
|
||||
@Observable String inboundQuantity
|
||||
@@ -22,7 +22,7 @@ class OptionsModel {
|
||||
@Observable String outboundQuantity
|
||||
@Observable String i2pUDPPort
|
||||
@Observable String i2pNTCPPort
|
||||
|
||||
|
||||
// gui options
|
||||
@Observable boolean showMonitor
|
||||
@Observable String lnf
|
||||
@@ -31,17 +31,17 @@ class OptionsModel {
|
||||
@Observable boolean clearFinishedDownloads
|
||||
@Observable boolean excludeLocalResult
|
||||
@Observable boolean showSearchHashes
|
||||
|
||||
|
||||
// bw options
|
||||
@Observable String inBw
|
||||
@Observable String outBw
|
||||
|
||||
|
||||
// trust options
|
||||
@Observable boolean onlyTrusted
|
||||
@Observable boolean trustLists
|
||||
@Observable String trustListInterval
|
||||
|
||||
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
MuWireSettings settings = application.context.get("muwire-settings")
|
||||
downloadRetryInterval = settings.downloadRetryInterval
|
||||
@@ -49,7 +49,7 @@ class OptionsModel {
|
||||
autoDownloadUpdate = settings.autoDownloadUpdate
|
||||
shareDownloadedFiles = settings.shareDownloadedFiles
|
||||
downloadLocation = settings.downloadLocation.getAbsolutePath()
|
||||
|
||||
|
||||
Core core = application.context.get("core")
|
||||
inboundLength = core.i2pOptions["inbound.length"]
|
||||
inboundQuantity = core.i2pOptions["inbound.quantity"]
|
||||
@@ -57,7 +57,7 @@ class OptionsModel {
|
||||
outboundQuantity = core.i2pOptions["outbound.quantity"]
|
||||
i2pUDPPort = core.i2pOptions["i2np.udp.port"]
|
||||
i2pNTCPPort = core.i2pOptions["i2np.ntcp.port"]
|
||||
|
||||
|
||||
UISettings uiSettings = application.context.get("ui-settings")
|
||||
showMonitor = uiSettings.showMonitor
|
||||
lnf = uiSettings.lnf
|
||||
@@ -66,12 +66,12 @@ class OptionsModel {
|
||||
clearFinishedDownloads = uiSettings.clearFinishedDownloads
|
||||
excludeLocalResult = uiSettings.excludeLocalResult
|
||||
showSearchHashes = uiSettings.showSearchHashes
|
||||
|
||||
|
||||
if (core.router != null) {
|
||||
inBw = String.valueOf(settings.inBw)
|
||||
outBw = String.valueOf(settings.outBw)
|
||||
}
|
||||
|
||||
|
||||
onlyTrusted = !settings.allowUntrusted()
|
||||
trustLists = settings.allowTrustLists
|
||||
trustListInterval = String.valueOf(settings.trustListInterval)
|
||||
|
@@ -17,25 +17,25 @@ import griffon.metadata.ArtifactProviderFor
|
||||
class SearchTabModel {
|
||||
@MVCMember @Nonnull
|
||||
FactoryBuilderSupport builder
|
||||
|
||||
|
||||
Core core
|
||||
UISettings uiSettings
|
||||
String uuid
|
||||
def results = []
|
||||
def hashBucket = [:]
|
||||
def sourcesBucket = [:]
|
||||
|
||||
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
core = mvcGroup.parentGroup.model.core
|
||||
uiSettings = application.context.get("ui-settings")
|
||||
mvcGroup.parentGroup.model.results[UUID.fromString(uuid)] = mvcGroup
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupDestroy() {
|
||||
mvcGroup.parentGroup.model.results.remove(uuid)
|
||||
}
|
||||
|
||||
|
||||
void handleResult(UIResultEvent e) {
|
||||
if (uiSettings.excludeLocalResult &&
|
||||
core.fileManager.rootToFiles.containsKey(e.infohash))
|
||||
@@ -47,24 +47,24 @@ class SearchTabModel {
|
||||
hashBucket[e.infohash] = bucket
|
||||
}
|
||||
bucket << e
|
||||
|
||||
|
||||
Set sourceBucket = sourcesBucket.get(e.infohash)
|
||||
if (sourceBucket == null) {
|
||||
sourceBucket = new HashSet()
|
||||
sourcesBucket.put(e.infohash, sourceBucket)
|
||||
}
|
||||
sourceBucket.addAll(e.sources)
|
||||
|
||||
|
||||
results << e
|
||||
JTable table = builder.getVariable("results-table")
|
||||
table.model.fireTableDataChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void handleResultBatch(UIResultEvent[] batch) {
|
||||
runInsideUIAsync {
|
||||
batch.each {
|
||||
if (uiSettings.excludeLocalResult &&
|
||||
batch.each {
|
||||
if (uiSettings.excludeLocalResult &&
|
||||
core.fileManager.rootToFiles.containsKey(it.infohash))
|
||||
return
|
||||
def bucket = hashBucket.get(it.infohash)
|
||||
@@ -72,14 +72,14 @@ class SearchTabModel {
|
||||
bucket = []
|
||||
hashBucket[it.infohash] = bucket
|
||||
}
|
||||
|
||||
|
||||
Set sourceBucket = sourcesBucket.get(it.infohash)
|
||||
if (sourceBucket == null) {
|
||||
sourceBucket = new HashSet()
|
||||
sourcesBucket.put(it.infohash, sourceBucket)
|
||||
}
|
||||
sourceBucket.addAll(it.sources)
|
||||
|
||||
|
||||
bucket << it
|
||||
results << it
|
||||
}
|
||||
|
@@ -11,10 +11,10 @@ import griffon.metadata.ArtifactProviderFor
|
||||
class TrustListModel {
|
||||
RemoteTrustList trustList
|
||||
TrustService trustService
|
||||
|
||||
|
||||
def trusted
|
||||
def distrusted
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
trusted = new ArrayList<>(trustList.good)
|
||||
distrusted = new ArrayList<>(trustList.bad)
|
||||
|
@@ -25,12 +25,12 @@ class I2PStatusView {
|
||||
def dialog
|
||||
def panel
|
||||
def buttonsPanel
|
||||
|
||||
|
||||
void initUI() {
|
||||
mainFrame = application.windowManager.findWindow("main-frame")
|
||||
|
||||
|
||||
dialog = new JDialog(mainFrame, "I2P Status", true)
|
||||
|
||||
|
||||
panel = builder.panel {
|
||||
gridBagLayout()
|
||||
label(text : "Network status", constraints : gbc(gridx:0, gridy:0))
|
||||
@@ -52,20 +52,20 @@ class I2PStatusView {
|
||||
label(text : "Send Bps (15 seconds)", constraints : gbc(gridx:0, gridy:8))
|
||||
label(text : bind {model.sendBps}, constraints : gbc(gridx: 1, gridy:8))
|
||||
}
|
||||
|
||||
|
||||
buttonsPanel = builder.panel {
|
||||
gridBagLayout()
|
||||
button(text : "Refresh", constraints: gbc(gridx: 0, gridy: 0), refreshAction)
|
||||
button(text : "Close", constraints : gbc(gridx : 1, gridy :0), closeAction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
JPanel statusPanel = new JPanel()
|
||||
statusPanel.setLayout(new BorderLayout())
|
||||
statusPanel.add(panel, BorderLayout.CENTER)
|
||||
statusPanel.add(buttonsPanel, BorderLayout.SOUTH)
|
||||
|
||||
|
||||
dialog.getContentPane().add(statusPanel)
|
||||
dialog.pack()
|
||||
dialog.setLocationRelativeTo(mainFrame)
|
||||
|
@@ -48,21 +48,21 @@ class MainFrameView {
|
||||
FactoryBuilderSupport builder
|
||||
@MVCMember @Nonnull
|
||||
MainFrameModel model
|
||||
|
||||
|
||||
@Inject Metadata metadata
|
||||
|
||||
|
||||
def downloadsTable
|
||||
def lastDownloadSortEvent
|
||||
def lastSharedSortEvent
|
||||
def lastWatchedSortEvent
|
||||
def trustTablesSortEvents = [:]
|
||||
|
||||
|
||||
void initUI() {
|
||||
UISettings settings = application.context.get("ui-settings")
|
||||
builder.with {
|
||||
application(size : [1024,768], id: 'main-frame',
|
||||
locationRelativeTo : null,
|
||||
title: application.configuration['application.title'] + " " +
|
||||
title: application.configuration['application.title'] + " " +
|
||||
metadata["application.version"] + " revision " + metadata["build.revision"],
|
||||
iconImage: imageIcon('/MuWire-48x48.png').image,
|
||||
iconImages: [imageIcon('/MuWire-48x48.png').image,
|
||||
@@ -144,7 +144,7 @@ class MainFrameView {
|
||||
String.format("%02d", percent) + "% of ${totalSize} ($done/$pieces pcs)".toString()
|
||||
})
|
||||
closureColumn(header: "Sources", preferredWidth : 10, type: Integer, read : {row -> row.downloader.activeWorkers()})
|
||||
closureColumn(header: "Speed", preferredWidth: 50, type:String, read :{row ->
|
||||
closureColumn(header: "Speed", preferredWidth: 50, type:String, read :{row ->
|
||||
DataHelper.formatSize2Decimal(row.downloader.speed(), false) + "B/sec"
|
||||
})
|
||||
}
|
||||
@@ -172,7 +172,7 @@ class MainFrameView {
|
||||
})
|
||||
}
|
||||
panel (border : etchedBorder(), constraints : BorderLayout.CENTER) {
|
||||
gridLayout(cols : 2, rows : 1)
|
||||
gridLayout(cols : 2, rows : 1)
|
||||
panel (constraints : BorderLayout.WEST) {
|
||||
borderLayout()
|
||||
scrollPane (constraints : BorderLayout.CENTER) {
|
||||
@@ -220,7 +220,7 @@ class MainFrameView {
|
||||
int percent = row.getProgress()
|
||||
"$percent% of piece".toString()
|
||||
})
|
||||
closureColumn(header : "Downloader", type : String, read : { row ->
|
||||
closureColumn(header : "Downloader", type : String, read : { row ->
|
||||
row.getDownloader()
|
||||
})
|
||||
closureColumn(header : "Remote Pieces", type : String, read : { row ->
|
||||
@@ -256,7 +256,7 @@ class MainFrameView {
|
||||
closureColumn(header : "Direction", preferredWidth: 20, type: String, read : { row ->
|
||||
if (row.incoming)
|
||||
return "In"
|
||||
else
|
||||
else
|
||||
return "Out"
|
||||
})
|
||||
}
|
||||
@@ -271,9 +271,9 @@ class MainFrameView {
|
||||
scrollPane(constraints : BorderLayout.CENTER) {
|
||||
table(id : "searches-table") {
|
||||
tableModel(list : model.searches) {
|
||||
closureColumn(header : "Keywords", type : String, read : {
|
||||
closureColumn(header : "Keywords", type : String, read : {
|
||||
sanitized = it.search.replace('<', ' ')
|
||||
sanitized
|
||||
sanitized
|
||||
})
|
||||
closureColumn(header : "From", type : String, read : {
|
||||
if (it.originator != null) {
|
||||
@@ -372,7 +372,7 @@ class MainFrameView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
def downloadsTable = builder.getVariable("downloads-table")
|
||||
def selectionModel = downloadsTable.getSelectionModel()
|
||||
@@ -414,14 +414,14 @@ class MainFrameView {
|
||||
model.pauseButtonEnabled = false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
def centerRenderer = new DefaultTableCellRenderer()
|
||||
centerRenderer.setHorizontalAlignment(JLabel.CENTER)
|
||||
downloadsTable.setDefaultRenderer(Integer.class, centerRenderer)
|
||||
|
||||
|
||||
downloadsTable.rowSorter.addRowSorterListener({evt -> lastDownloadSortEvent = evt})
|
||||
downloadsTable.rowSorter.setSortsOnUpdates(true)
|
||||
|
||||
|
||||
downloadsTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
@@ -434,14 +434,14 @@ class MainFrameView {
|
||||
showDownloadsMenu(e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// shared files table
|
||||
def sharedFilesTable = builder.getVariable("shared-files-table")
|
||||
sharedFilesTable.columnModel.getColumn(1).setCellRenderer(new SizeRenderer())
|
||||
|
||||
|
||||
sharedFilesTable.rowSorter.addRowSorterListener({evt -> lastSharedSortEvent = evt})
|
||||
sharedFilesTable.rowSorter.setSortsOnUpdates(true)
|
||||
|
||||
|
||||
JPopupMenu sharedFilesMenu = new JPopupMenu()
|
||||
JMenuItem copyHashToClipboard = new JMenuItem("Copy hash to clipboard")
|
||||
copyHashToClipboard.addActionListener({mvcGroup.view.copyHashToClipboard()})
|
||||
@@ -461,7 +461,7 @@ class MainFrameView {
|
||||
showPopupMenu(sharedFilesMenu, e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// searches table
|
||||
def searchesTable = builder.getVariable("searches-table")
|
||||
JPopupMenu searchTableMenu = new JPopupMenu()
|
||||
@@ -480,7 +480,7 @@ class MainFrameView {
|
||||
showPopupMenu(searchTableMenu, e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// watched directories table
|
||||
def watchedTable = builder.getVariable("watched-directories-table")
|
||||
watchedTable.rowSorter.addRowSorterListener({evt -> lastWatchedSortEvent = evt})
|
||||
@@ -501,7 +501,7 @@ class MainFrameView {
|
||||
showPopupMenu(watchedMenu, e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// subscription table
|
||||
def subscriptionTable = builder.getVariable("subscription-table")
|
||||
subscriptionTable.setDefaultRenderer(Integer.class, centerRenderer)
|
||||
@@ -539,7 +539,7 @@ class MainFrameView {
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// trusted table
|
||||
def trustedTable = builder.getVariable("trusted-table")
|
||||
trustedTable.rowSorter.addRowSorterListener({evt -> trustTablesSortEvents["trusted-table"] = evt})
|
||||
@@ -558,7 +558,7 @@ class MainFrameView {
|
||||
model.markNeutralFromTrustedButtonEnabled = true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// distrusted table
|
||||
def distrustedTable = builder.getVariable("distrusted-table")
|
||||
distrustedTable.rowSorter.addRowSorterListener({evt -> trustTablesSortEvents["distrusted-table"] = evt})
|
||||
@@ -576,11 +576,11 @@ class MainFrameView {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
private static void showPopupMenu(JPopupMenu menu, MouseEvent event) {
|
||||
menu.show(event.getComponent(), event.getX(), event.getY())
|
||||
}
|
||||
|
||||
|
||||
def selectedSharedFile() {
|
||||
def sharedFilesTable = builder.getVariable("shared-files-table")
|
||||
int selected = sharedFilesTable.getSelectedRow()
|
||||
@@ -590,7 +590,7 @@ class MainFrameView {
|
||||
selected = sharedFilesTable.rowSorter.convertRowIndexToModel(selected)
|
||||
model.shared[selected]
|
||||
}
|
||||
|
||||
|
||||
def copyHashToClipboard() {
|
||||
def selected = selectedSharedFile()
|
||||
if (selected == null)
|
||||
@@ -600,7 +600,7 @@ class MainFrameView {
|
||||
def clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
clipboard.setContents(selection, null)
|
||||
}
|
||||
|
||||
|
||||
def copySearchToClipboard(JTable searchesTable) {
|
||||
int selected = searchesTable.getSelectedRow()
|
||||
if (selected < 0)
|
||||
@@ -617,7 +617,7 @@ class MainFrameView {
|
||||
selected = lastDownloadSortEvent.convertPreviousRowIndexToModel(selected)
|
||||
selected
|
||||
}
|
||||
|
||||
|
||||
def showDownloadsMenu(MouseEvent e) {
|
||||
int selected = selectedDownloaderRow()
|
||||
if (selected < 0)
|
||||
@@ -651,7 +651,7 @@ class MainFrameView {
|
||||
cancelEnabled = false
|
||||
retryEnabled = false
|
||||
}
|
||||
|
||||
|
||||
JPopupMenu menu = new JPopupMenu()
|
||||
JMenuItem copyHashToClipboard = new JMenuItem("Copy hash to clipboard")
|
||||
copyHashToClipboard.addActionListener({
|
||||
@@ -661,28 +661,28 @@ class MainFrameView {
|
||||
clipboard.setContents(selection, null)
|
||||
})
|
||||
menu.add(copyHashToClipboard)
|
||||
|
||||
|
||||
if (pauseEnabled) {
|
||||
JMenuItem pause = new JMenuItem("Pause")
|
||||
pause.addActionListener({mvcGroup.controller.pause()})
|
||||
menu.add(pause)
|
||||
}
|
||||
|
||||
|
||||
if (cancelEnabled) {
|
||||
JMenuItem cancel = new JMenuItem("Cancel")
|
||||
cancel.addActionListener({mvcGroup.controller.cancel()})
|
||||
menu.add(cancel)
|
||||
}
|
||||
|
||||
|
||||
if (retryEnabled) {
|
||||
JMenuItem retry = new JMenuItem(resumeText)
|
||||
retry.addActionListener({mvcGroup.controller.resume()})
|
||||
menu.add(retry)
|
||||
}
|
||||
|
||||
|
||||
showPopupMenu(menu, e)
|
||||
}
|
||||
|
||||
|
||||
def showSearchWindow = {
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel, "search window")
|
||||
@@ -692,17 +692,17 @@ class MainFrameView {
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel, "uploads window")
|
||||
}
|
||||
|
||||
|
||||
def showMonitorWindow = {
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel,"monitor window")
|
||||
}
|
||||
|
||||
|
||||
def showTrustWindow = {
|
||||
def cardsPanel = builder.getVariable("cards-panel")
|
||||
cardsPanel.getLayout().show(cardsPanel,"trust window")
|
||||
}
|
||||
|
||||
|
||||
def shareFiles = {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
@@ -713,7 +713,7 @@ class MainFrameView {
|
||||
model.core.eventBus.publish(new FileSharedEvent(file : chooser.getSelectedFile()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def watchDirectories = {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
@@ -729,7 +729,7 @@ class MainFrameView {
|
||||
model.core.eventBus.publish(new FileSharedEvent(file : f))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String getSelectedWatchedDirectory() {
|
||||
def watchedTable = builder.getVariable("watched-directories-table")
|
||||
int selectedRow = watchedTable.getSelectedRow()
|
||||
@@ -739,7 +739,7 @@ class MainFrameView {
|
||||
selectedRow = watchedTable.rowSorter.convertRowIndexToModel(selectedRow)
|
||||
model.watched[selectedRow]
|
||||
}
|
||||
|
||||
|
||||
int getSelectedTrustTablesRow(String tableName) {
|
||||
def table = builder.getVariable(tableName)
|
||||
int selectedRow = table.getSelectedRow()
|
||||
|
@@ -27,12 +27,12 @@ class MuWireStatusView {
|
||||
def dialog
|
||||
def panel
|
||||
def buttonsPanel
|
||||
|
||||
|
||||
void initUI() {
|
||||
mainFrame = application.windowManager.findWindow("main-frame")
|
||||
|
||||
|
||||
dialog = new JDialog(mainFrame, "MuWire Status", true)
|
||||
|
||||
|
||||
panel = builder.panel {
|
||||
gridBagLayout()
|
||||
label(text : "Incoming connections", constraints : gbc(gridx:0, gridy:0))
|
||||
@@ -52,13 +52,13 @@ class MuWireStatusView {
|
||||
button(text : "Close", constraints : gbc(gridx : 1, gridy :0), closeAction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
JPanel statusPanel = new JPanel()
|
||||
statusPanel.setLayout(new BorderLayout())
|
||||
statusPanel.add(panel, BorderLayout.CENTER)
|
||||
statusPanel.add(buttonsPanel, BorderLayout.SOUTH)
|
||||
|
||||
|
||||
dialog.getContentPane().add(statusPanel)
|
||||
dialog.pack()
|
||||
dialog.setLocationRelativeTo(mainFrame)
|
||||
|
@@ -30,12 +30,12 @@ class OptionsView {
|
||||
def u
|
||||
def bandwidth
|
||||
def trust
|
||||
|
||||
|
||||
def retryField
|
||||
def updateField
|
||||
def autoDownloadUpdateCheckbox
|
||||
def shareDownloadedCheckbox
|
||||
|
||||
|
||||
def inboundLengthField
|
||||
def inboundQuantityField
|
||||
def outboundLengthField
|
||||
@@ -50,18 +50,18 @@ class OptionsView {
|
||||
def clearFinishedDownloadsCheckbox
|
||||
def excludeLocalResultCheckbox
|
||||
def showSearchHashesCheckbox
|
||||
|
||||
|
||||
def inBwField
|
||||
def outBwField
|
||||
|
||||
|
||||
def allowUntrustedCheckbox
|
||||
def allowTrustListsCheckbox
|
||||
def trustListIntervalField
|
||||
|
||||
def buttonsPanel
|
||||
|
||||
|
||||
def buttonsPanel
|
||||
|
||||
def mainFrame
|
||||
|
||||
|
||||
void initUI() {
|
||||
mainFrame = application.windowManager.findWindow("main-frame")
|
||||
d = new JDialog(mainFrame, "Options", true)
|
||||
@@ -71,21 +71,21 @@ class OptionsView {
|
||||
label(text : "Retry failed downloads every", constraints : gbc(gridx: 0, gridy: 0))
|
||||
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2, constraints : gbc(gridx: 1, gridy: 0))
|
||||
label(text : "minutes", constraints : gbc(gridx : 2, gridy: 0))
|
||||
|
||||
|
||||
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 1))
|
||||
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 1))
|
||||
label(text : "hours", constraints : gbc(gridx: 2, gridy : 1))
|
||||
|
||||
|
||||
label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 2))
|
||||
autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate}, constraints : gbc(gridx:1, gridy : 2))
|
||||
|
||||
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:3))
|
||||
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:3))
|
||||
|
||||
|
||||
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:4))
|
||||
button(text : "Choose", constraints : gbc(gridx : 1, gridy:4), downloadLocationAction)
|
||||
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:5, gridwidth:2))
|
||||
|
||||
|
||||
}
|
||||
i = builder.panel {
|
||||
gridBagLayout()
|
||||
@@ -98,7 +98,7 @@ class OptionsView {
|
||||
outboundLengthField = textField(text : bind {model.outboundLength}, columns : 2, constraints : gbc(gridx:1, gridy:3))
|
||||
label(text : "Outbound Quantity", constraints : gbc(gridx:0, gridy:4))
|
||||
outboundQuantityField = textField(text : bind {model.outboundQuantity}, columns : 2, constraints : gbc(gridx:1, gridy:4))
|
||||
|
||||
|
||||
Core core = application.context.get("core")
|
||||
if (core.router != null) {
|
||||
label(text : "TCP Port", constraints : gbc(gridx :0, gridy: 5))
|
||||
@@ -106,7 +106,7 @@ class OptionsView {
|
||||
label(text : "UDP Port", constraints : gbc(gridx :0, gridy: 6))
|
||||
i2pUDPPortField = textField(text : bind {model.i2pUDPPort}, columns : 4, constraints : gbc(gridx:1, gridy:6))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
u = builder.panel {
|
||||
gridBagLayout()
|
||||
@@ -144,15 +144,15 @@ class OptionsView {
|
||||
trustListIntervalField = textField(text : bind {model.trustListInterval}, constraints:gbc(gridx:1, gridy:2))
|
||||
label(text : "hours", constraints : gbc(gridx: 2, gridy:2))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
buttonsPanel = builder.panel {
|
||||
gridBagLayout()
|
||||
button(text : "Save", constraints : gbc(gridx : 1, gridy: 2), saveAction)
|
||||
button(text : "Cancel", constraints : gbc(gridx : 2, gridy: 2), cancelAction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
def tabbedPane = new JTabbedPane()
|
||||
tabbedPane.addTab("MuWire", p)
|
||||
@@ -163,12 +163,12 @@ class OptionsView {
|
||||
tabbedPane.addTab("Bandwidth", bandwidth)
|
||||
}
|
||||
tabbedPane.addTab("Trust", trust)
|
||||
|
||||
|
||||
JPanel panel = new JPanel()
|
||||
panel.setLayout(new BorderLayout())
|
||||
panel.add(tabbedPane, BorderLayout.CENTER)
|
||||
panel.add(buttonsPanel, BorderLayout.SOUTH)
|
||||
|
||||
|
||||
d.getContentPane().add(panel)
|
||||
d.pack()
|
||||
d.setLocationRelativeTo(mainFrame)
|
||||
|
@@ -34,12 +34,12 @@ class SearchTabView {
|
||||
@MVCMember @Nonnull
|
||||
SearchTabModel model
|
||||
|
||||
def pane
|
||||
def pane
|
||||
def parent
|
||||
def searchTerms
|
||||
def resultsTable
|
||||
def lastSortEvent
|
||||
|
||||
|
||||
void initUI() {
|
||||
builder.with {
|
||||
def resultsTable
|
||||
@@ -57,13 +57,13 @@ class SearchTabView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.pane = pane
|
||||
this.pane.putClientProperty("mvc-group", mvcGroup)
|
||||
this.pane.putClientProperty("results-table",resultsTable)
|
||||
|
||||
this.resultsTable = resultsTable
|
||||
|
||||
|
||||
def selectionModel = resultsTable.getSelectionModel()
|
||||
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
|
||||
selectionModel.addListSelectionListener( {
|
||||
@@ -77,16 +77,16 @@ class SearchTabView {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
searchTerms = args["search-terms"]
|
||||
parent = mvcGroup.parentGroup.view.builder.getVariable("result-tabs")
|
||||
parent.addTab(searchTerms, pane)
|
||||
int index = parent.indexOfComponent(pane)
|
||||
parent.setSelectedIndex(index)
|
||||
|
||||
|
||||
def tabPanel
|
||||
builder.with {
|
||||
builder.with {
|
||||
tabPanel = panel {
|
||||
borderLayout()
|
||||
panel {
|
||||
@@ -96,22 +96,22 @@ class SearchTabView {
|
||||
actionPerformed : closeTab )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parent.setTabComponentAt(index, tabPanel)
|
||||
|
||||
|
||||
def centerRenderer = new DefaultTableCellRenderer()
|
||||
centerRenderer.setHorizontalAlignment(JLabel.CENTER)
|
||||
resultsTable.columnModel.getColumn(1).setCellRenderer(centerRenderer)
|
||||
resultsTable.setDefaultRenderer(Integer.class,centerRenderer)
|
||||
resultsTable.columnModel.getColumn(4).setCellRenderer(centerRenderer)
|
||||
|
||||
|
||||
resultsTable.columnModel.getColumn(1).setCellRenderer(new SizeRenderer())
|
||||
|
||||
|
||||
|
||||
|
||||
resultsTable.rowSorter.addRowSorterListener({ evt -> lastSortEvent = evt})
|
||||
resultsTable.rowSorter.setSortsOnUpdates(true)
|
||||
|
||||
|
||||
|
||||
|
||||
resultsTable.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@@ -127,7 +127,7 @@ class SearchTabView {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
def closeTab = {
|
||||
int index = parent.indexOfTab(searchTerms)
|
||||
parent.removeTabAt(index)
|
||||
@@ -135,7 +135,7 @@ class SearchTabView {
|
||||
mvcGroup.parentGroup.model.downloadActionEnabled = false
|
||||
mvcGroup.destroy()
|
||||
}
|
||||
|
||||
|
||||
def showPopupMenu(MouseEvent e) {
|
||||
JPopupMenu menu = new JPopupMenu()
|
||||
if (mvcGroup.parentGroup.model.downloadActionEnabled) {
|
||||
@@ -148,7 +148,7 @@ class SearchTabView {
|
||||
menu.add(copyHashToClipboard)
|
||||
menu.show(e.getComponent(), e.getX(), e.getY())
|
||||
}
|
||||
|
||||
|
||||
def copyHashToClipboard() {
|
||||
int selected = resultsTable.getSelectedRow()
|
||||
if (selected < 0)
|
||||
|
@@ -25,8 +25,8 @@ class TrustListView {
|
||||
def mainFrame
|
||||
def mainPanel
|
||||
|
||||
def sortEvents = [:]
|
||||
|
||||
def sortEvents = [:]
|
||||
|
||||
void initUI() {
|
||||
mainFrame = application.windowManager.findWindow("main-frame")
|
||||
dialog = new JDialog(mainFrame, model.trustList.persona.getHumanReadableName(), true)
|
||||
@@ -78,19 +78,19 @@ class TrustListView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mvcGroupInit(Map<String,String> args) {
|
||||
|
||||
|
||||
def trustedTable = builder.getVariable("trusted-table")
|
||||
trustedTable.rowSorter.addRowSorterListener({evt -> sortEvents["trusted-table"] = evt})
|
||||
trustedTable.rowSorter.setSortsOnUpdates(true)
|
||||
trustedTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
|
||||
|
||||
|
||||
def distrustedTable = builder.getVariable("distrusted-table")
|
||||
distrustedTable.rowSorter.addRowSorterListener({evt -> sortEvents["distrusted-table"] = evt})
|
||||
distrustedTable.rowSorter.setSortsOnUpdates(true)
|
||||
distrustedTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
|
||||
|
||||
|
||||
dialog.getContentPane().add(mainPanel)
|
||||
dialog.pack()
|
||||
dialog.setLocationRelativeTo(mainFrame)
|
||||
@@ -102,7 +102,7 @@ class TrustListView {
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
|
||||
int getSelectedRow(String tableName) {
|
||||
def table = builder.getVariable(tableName)
|
||||
int selectedRow = table.getSelectedRow()
|
||||
@@ -112,7 +112,7 @@ class TrustListView {
|
||||
selectedRow = table.rowSorter.convertRowIndexToModel(selectedRow)
|
||||
selectedRow
|
||||
}
|
||||
|
||||
|
||||
void fireUpdate(String tableName) {
|
||||
def table = builder.getVariable(tableName)
|
||||
table.model.fireTableDataChanged()
|
||||
|
Reference in New Issue
Block a user