1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-20 10:39:19 +01:00

Merged channel pane context in one

This commit is contained in:
dpad85 2017-01-30 16:22:33 +01:00
parent dda0c0c4f2
commit 521a0ed117
3 changed files with 12 additions and 9 deletions

View File

@ -85,6 +85,7 @@
.context-menu {
-fx-padding: 4px;
-fx-font-weight: normal;
}
.context-menu .menu-item:focused {
-fx-background-color: rgb(63,179,234);

View File

@ -3,7 +3,8 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import java.net.URL?>
<VBox styleClass="channel" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<VBox styleClass="channel" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
onContextMenuRequested="#openChannelContext" onMouseClicked="#closeChannelContext">
<children>
<GridPane maxWidth="1.7976931348623157E308" styleClass="grid">
<columnConstraints>
@ -27,13 +28,13 @@
<Label styleClass="text-muted" text="State" GridPane.columnIndex="2" GridPane.rowIndex="4"/>
<Button fx:id="close" mnemonicParsing="false" styleClass="close-channel" text="Close"
GridPane.columnIndex="4" GridPane.halignment="RIGHT"/>
<Label fx:id="nodeId" onContextMenuRequested="#handleTheirNodeIdContext" text="N/A"
<Label fx:id="nodeId" text="N/A"
GridPane.columnIndex="1" GridPane.columnSpan="4" GridPane.rowIndex="2"/>
<Label fx:id="capacity" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label fx:id="funder" text="N/A" GridPane.columnIndex="3" GridPane.columnSpan="2"
GridPane.rowIndex="3"/>
<Label fx:id="state" text="N/A" GridPane.columnIndex="3" GridPane.columnSpan="2" GridPane.rowIndex="4"/>
<Label fx:id="channelId" onContextMenuRequested="#handleChannelIdContext" styleClass="text-strong"
<Label fx:id="channelId" styleClass="text-strong"
text="N/A" GridPane.columnSpan="4"/>
<Label fx:id="amountUs" prefWidth="100.0" text="N/A" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<ProgressBar fx:id="balanceBar" maxWidth="1.7976931348623157E308" minHeight="5.0" prefHeight="8.0"

View File

@ -2,7 +2,7 @@ package fr.acinq.eclair.gui.controllers
import javafx.fxml.FXML
import javafx.scene.control.{Button, ContextMenu, Label, ProgressBar}
import javafx.scene.input.ContextMenuEvent
import javafx.scene.input.{ContextMenuEvent, MouseEvent}
import fr.acinq.eclair.gui.utils.{ContextMenuUtils, CopyAction}
import grizzled.slf4j.Logging
@ -24,15 +24,16 @@ class ChannelPaneController(theirNodeIdValue: String) extends Logging {
var contextMenu: ContextMenu = _
@FXML def handleChannelIdContext(event: ContextMenuEvent): Unit = {
@FXML def openChannelContext(event: ContextMenuEvent): Unit = {
if (contextMenu != null) contextMenu.hide()
contextMenu = ContextMenuUtils.buildCopyContext(List(new CopyAction("Copy Channel Id", channelIdValue)))
contextMenu = ContextMenuUtils.buildCopyContext(List(
new CopyAction("Copy Channel Id", channelIdValue),
new CopyAction("Copy Node Pubkey", theirNodeIdValue)
))
contextMenu.show(channelId, event.getScreenX, event.getScreenY)
}
@FXML def handleTheirNodeIdContext(event: ContextMenuEvent): Unit = {
@FXML def closeChannelContext(event: MouseEvent): Unit = {
if (contextMenu != null) contextMenu.hide()
contextMenu = ContextMenuUtils.buildCopyContext(List(new CopyAction("Copy Node Pubkey", theirNodeIdValue)))
contextMenu.show(nodeId, event.getScreenX, event.getScreenY)
}
}