final String ROOT_DEVICE = "upnp:rootdevice";
searchMenu.setMnemonic(KeyEvent.VK_L);
searchMenu.setEnabled(false);
AbstractAction searchAction = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
DriverProxy controller = Mediator.getDriverProxy();
if (e.getActionCommand().equals(ALL_DEVICE))
controller.doSearch(ALL_DEVICE);
else if (e.getActionCommand().equals(ROOT_DEVICE))
controller.doSearch(ROOT_DEVICE);
}
};
JMenuItem rootDeviceItem = new JMenuItem("Root Devices");
rootDeviceItem.setMnemonic(KeyEvent.VK_R);
rootDeviceItem.addActionListener(searchAction);
rootDeviceItem.setActionCommand(ROOT_DEVICE);
searchMenu.add(rootDeviceItem);
JMenuItem allDeviceItem = new JMenuItem("All Devices");
allDeviceItem .setMnemonic(KeyEvent.VK_A);
allDeviceItem .addActionListener(searchAction);
allDeviceItem .setActionCommand(ALL_DEVICE);
searchMenu.add(allDeviceItem);
JMenuItem checkIncompleteItem = new JMenuItem("Print Pending Devices");
checkIncompleteItem.setMnemonic(KeyEvent.VK_I);
checkIncompleteItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Mediator.getRootDeviceListener().checkIncompleteDevice();
}
});
JMenuItem checkErrataItem = new JMenuItem("Check Errata UPnPDevices");
checkErrataItem.setMnemonic(KeyEvent.VK_E);
checkErrataItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RootDeviceListener.checkErrataDevice();}
});
loggerMenu = new JMenu("Felix Logger");
final String NO_LOGGING ="No Logging";
final String ERROR ="Error";
final String WARNING ="Warning";
final String INFO ="Info";
final String DEBUG ="Debug";
loggerMenu.getPopupMenu().addPopupMenuListener(this);
loggerMenu.setMnemonic(KeyEvent.VK_L);
loggerMenu.setEnabled(false);
AbstractAction loggerAction = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
DriverProxy controller = Mediator.getDriverProxy();
if (e.getActionCommand().equals(NO_LOGGING))
controller.setLogLevel(0);
else if (e.getActionCommand().equals(ERROR))
controller.setLogLevel(1);
else if (e.getActionCommand().equals(WARNING))
controller.setLogLevel(2);
else if (e.getActionCommand().equals(INFO))
controller.setLogLevel(3);
else if (e.getActionCommand().equals(DEBUG))
controller.setLogLevel(4);
}
};
ButtonGroup group = new ButtonGroup();
JRadioButtonMenuItem rbMenuItem = new JRadioButtonMenuItem(NO_LOGGING);
rbMenuItem.setSelected(true);
rbMenuItem.setMnemonic(KeyEvent.VK_N);
rbMenuItem.setActionCommand(NO_LOGGING);
rbMenuItem.addActionListener(loggerAction);
group.add(rbMenuItem);
loggerMenu.add(rbMenuItem);
loggerMenu.addSeparator();
rbMenuItem = new JRadioButtonMenuItem(ERROR);
rbMenuItem.setMnemonic(KeyEvent.VK_E);
rbMenuItem.setActionCommand(ERROR);
rbMenuItem.addActionListener(loggerAction);
group.add(rbMenuItem);
loggerMenu.add(rbMenuItem);
rbMenuItem = new JRadioButtonMenuItem(WARNING);
rbMenuItem.setMnemonic(KeyEvent.VK_W);
rbMenuItem.setActionCommand(WARNING);
rbMenuItem.addActionListener(loggerAction);
group.add(rbMenuItem);
loggerMenu.add(rbMenuItem);
rbMenuItem = new JRadioButtonMenuItem(INFO);
rbMenuItem.setMnemonic(KeyEvent.VK_I);
rbMenuItem.setActionCommand(INFO);
rbMenuItem.addActionListener(loggerAction);
group.add(rbMenuItem);
loggerMenu.add(rbMenuItem);
rbMenuItem = new JRadioButtonMenuItem(DEBUG);
rbMenuItem.setMnemonic(KeyEvent.VK_D);
rbMenuItem.setActionCommand(DEBUG);
rbMenuItem.addActionListener(loggerAction);
group.add(rbMenuItem);
loggerMenu.add(rbMenuItem);
final String ON ="On";
final String OFF ="Off";
cyberMenu = new JMenu("Cyber Debugger");
cyberMenu.getPopupMenu().addPopupMenuListener(this);
cyberMenu.setMnemonic(KeyEvent.VK_C);
cyberMenu.setEnabled(false);
AbstractAction cyberAction = new AbstractAction(){
public void actionPerformed(ActionEvent e) {
DriverProxy controller = Mediator.getDriverProxy();
if (e.getActionCommand().equals(ON))
controller.setCyberDebug(true);
else if (e.getActionCommand().equals(OFF))
controller.setCyberDebug(false);
}
};
ButtonGroup cyberGroup = new ButtonGroup();