001package jmri.jmrix.grapevine.nodetable; 002 003import java.awt.event.ActionEvent; 004import javax.swing.Action; 005import jmri.InstanceManager; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008import jmri.jmrix.grapevine.GrapevineSystemConnectionMemo; 009import jmri.jmrix.grapevine.swing.GrapevineSystemConnectionAction; 010 011/** 012 * Swing action to create and register a NodeTableFrame object. 013 * 014 * @author Bob Jacobsen Copyright (C) 2006, 2008 015 */ 016public class NodeTableAction extends GrapevineSystemConnectionAction { 017 018 public NodeTableAction(String s, GrapevineSystemConnectionMemo memo) { 019 super(s, memo); 020 } 021 022 public NodeTableAction(GrapevineSystemConnectionMemo memo) { 023 this(Bundle.getMessage("WindowTitle"), memo); 024 } 025 026 public NodeTableAction() { 027 this(InstanceManager.getNullableDefault(GrapevineSystemConnectionMemo.class)); 028 } 029 030 @Override 031 public void actionPerformed(ActionEvent e) { 032 GrapevineSystemConnectionMemo memo = getSystemConnectionMemo(); 033 if (memo != null) { 034 NodeTableFrame f = new NodeTableFrame(memo); 035 try { 036 f.initComponents(); 037 } catch (Exception ex) { 038 log.error("Exception: {}", ex.toString()); 039 } 040 f.setLocation(100, 30); 041 f.setVisible(true); 042 } else { 043 log.error("No connection to run {} with", getValue(Action.NAME)); 044 } 045 } 046 047 private final static Logger log = LoggerFactory.getLogger(NodeTableAction.class); 048 049}