1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 06:21:42 +01:00

Added a label parameter to buildCopyContext

This commit is contained in:
dpad85 2017-01-27 19:03:18 +01:00
parent d5dae98c2e
commit ba8cff0b26
3 changed files with 6 additions and 5 deletions

View file

@ -26,13 +26,13 @@ class ChannelPaneController(theirNodeIdValue: String) extends Logging {
@FXML def handleChannelIdContext(event: ContextMenuEvent): Unit = {
if (contextMenu != null) contextMenu.hide()
contextMenu = ContextMenuUtils.buildCopyContext(channelIdValue)
contextMenu = ContextMenuUtils.buildCopyContext(channelIdValue, "Copy Channel Id")
contextMenu.show(channelId, event.getScreenX, event.getScreenY)
}
@FXML def handleTheirNodeIdContext(event: ContextMenuEvent): Unit = {
if (contextMenu != null) contextMenu.hide()
contextMenu = ContextMenuUtils.buildCopyContext(theirNodeIdValue)
contextMenu = ContextMenuUtils.buildCopyContext(theirNodeIdValue, "Copy Node Pubkey")
contextMenu.show(nodeId, event.getScreenX, event.getScreenY)
}
}

View file

@ -49,7 +49,7 @@ class MainController(val handlers: Handlers, val stage: Stage, val setup: Setup)
bitcoinChain.getStyleClass.add(setup.chain)
graphTab.setContent(swingNode)
contextMenu = ContextMenuUtils.buildCopyContext(Globals.Node.id)
contextMenu = ContextMenuUtils.buildCopyContext(Globals.Node.id, "Copy Pubkey")
if (channelBox.getChildren.size() > 0) {
channelInfo.setScaleY(0)

View file

@ -14,11 +14,12 @@ object ContextMenuUtils {
* Builds a Context Menu with a single Copy action.
*
* @param valueToCopy the value to copy to clipboard
* @param labelOfContextAction the label of the action in the context menu
* @return javafx context menu
*/
def buildCopyContext(valueToCopy: String): ContextMenu = {
def buildCopyContext(valueToCopy: String, labelOfContextAction: String = "Copy Value"): ContextMenu = {
val context = new ContextMenu()
val copyItem = new MenuItem("Copy Value")
val copyItem = new MenuItem(labelOfContextAction)
copyItem.setOnAction(new EventHandler[ActionEvent] {
override def handle(event: ActionEvent): Unit = {
val clipContent = new ClipboardContent