List of usage examples for java.awt.event ActionEvent ActionEvent
public ActionEvent(Object source, int id, String command)
From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java
/** * Bearbeitet meine "Messages" Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui * //from w ww.j a v a 2 s . c o m * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 07.01.2012 * @param ev * Avtion event */ private void processMessageActions(ActionEvent ev) { String cmd = ev.getActionCommand(); int actionId = ev.getID(); // // wenn ich auf eine Nachricht warten soll, um das "WARTE"-Fenster zu schliessen // if (waitForMessage != 0) { // timer ereignis UND das Fenster ist offen if ((actionId == ProjectConst.MESSAGE_TICK) && (wDial != null)) { // ist der Timeout um? if (wDial.isTimeout()) { lg.error("dialog window timeout is over!"); wDial.dispose(); wDial = null; showErrorDialog(LangStrings.getString("MainCommGUI.errorDialog.timeout")); // den Merker auf null setzen! waitForMessage = 0; } } if (waitForMessage == actionId) { // es ist die Nachricht, auf die ich waren soll if (wDial != null) { wDial.dispose(); wDial = null; } // den Merker auf null setzen! waitForMessage = 0; } } switch (actionId) { // ///////////////////////////////////////////////////////////////////////// // Virtuelle Ports verndert case ProjectConst.MESSAGE_PORT_STATE_CHANGE: lg.debug("VIRTUAL PORT CHANGED command!"); if (ev.getSource() instanceof VirtualSerialPortsFinder) { VirtualSerialPortsFinder finder = (VirtualSerialPortsFinder) ev.getSource(); connectionPanel.setNewVirtDeviceList(finder.getComboBoxModel()); connectionPanel.setVirtDevicesBoxEnabled(true); } break; // ///////////////////////////////////////////////////////////////////////// // Info anzeigen... case ProjectConst.MESSAGE_TOAST: lg.debug("TOAST command!"); connectionPanel.setToastMessage(cmd); break; // ///////////////////////////////////////////////////////////////////////// // Hab was gelesen! case ProjectConst.MESSAGE_READ: lg.debug("READ Command!"); // soll den reader Thread und die GUI nicht blockieren // daher nur in die Liste schmeissen (die ist thread-sicher) if ((!cmd.isEmpty()) && (!cmd.equals("\n"))) { messagesList.add(cmd); lg.debug("RECIVED: <" + cmd + ">"); } break; // ///////////////////////////////////////////////////////////////////////// // Gertename ausgelesen case ProjectConst.MESSAGE_MANUFACTURER_READ: lg.info("Device Manufacturer Name from SPX42 <" + cmd + "> recived..."); currentConfig.setDeviceName(cmd); break; // ///////////////////////////////////////////////////////////////////////// // Firmwareversion gelesen! case ProjectConst.MESSAGE_FWVERSION_READ: lg.info("Firmware Version <" + cmd + "> recived..."); currentConfig.setFirmwareVersion(cmd); configPanel.setFirmwareLabel(cmd); break; // ///////////////////////////////////////////////////////////////////////// // Seriennummer vom SPX42 case ProjectConst.MESSAGE_SERIAL_READ: lg.info("Serial Number from SPX42 recived..."); configPanel.setSerialNumber(cmd); currentConfig.setSerial(cmd); // bei Verbindung mit einem virtuellen Device muss ich noch einen Namen eintragen. Das ist dann die Seriennummer if (btComm.getConnectedDevice().equals("virtual")) { btComm.setNameForVirtualDevice(cmd); // jetzt guck mal, ob ein Alias vorhanden ist if (null == databaseUtil.getAliasForNameConn(cmd)) { // dann muss ich den auch noch eintragen databaseUtil.addAliasForNameConn(cmd, cmd, "virtual"); } } break; // ///////////////////////////////////////////////////////////////////////// // Decompressionseinstellungen gelesen case ProjectConst.MESSAGE_DECO_READ: lg.info("DECO propertys from SPX42 recived..."); if (wDial != null) { wDial.incrementProgress(); } if (currentConfig.setDecoGf(cmd)) { lg.info("DECO propertys set to GUI..."); configPanel.setDecoGradient(); lg.info("DECO propertys set to GUI...OK"); } break; // ///////////////////////////////////////////////////////////////////////// // Einheiten Einstellungen vom SPX42 gelesen case ProjectConst.MESSAGE_UNITS_READ: lg.info("UNITS propertys from SPX42 recived..."); if (wDial != null) { wDial.incrementProgress(); } if (currentConfig.setUnits(cmd)) { lg.info("UNITS propertys set to GUI..."); configPanel.setUnits(); } break; // ///////////////////////////////////////////////////////////////////////// // Displayeinstellungen gelesen case ProjectConst.MESSAGE_DISPLAY_READ: lg.info("DISPLAY propertys from SPX42 recived..."); if (wDial != null) { wDial.incrementProgress(); } if (currentConfig.setDisplay(cmd)) { lg.info("DISPLAY propertys set to GUI..."); configPanel.setDisplayPropertys(); } break; // ///////////////////////////////////////////////////////////////////////// // Einstellungen zum O2 Setpint gelesen case ProjectConst.MESSAGE_SETPOINT_READ: lg.info("SETPOINT propertys from SPX42 recived..."); if (wDial != null) { wDial.incrementProgress(); } if (currentConfig.setSetpoint(cmd)) { lg.info("SETPOINT propertys set to GUI..."); configPanel.setSetpoint(); } break; // ///////////////////////////////////////////////////////////////////////// // Einstellungen fr Individuell gelesen (Extra-Lizenz erforderlich ) case ProjectConst.MESSAGE_INDIVID_READ: lg.info("INDIVIDUAL propertys from SPX42 recived..."); if (wDial != null) { wDial.incrementProgress(); } if (currentConfig.setIndividuals(cmd)) { lg.info("INDIVIDUAL propertys set to GUI..."); configPanel.setIndividuals(true); } else { configPanel.setIndividuals(false); } break; // ///////////////////////////////////////////////////////////////////////// // Der Lizenzstatus case ProjectConst.MESSAGE_LICENSE_STATE_READ: lg.info("lizense state from SPX42 recived..."); currentConfig.setLicenseStatus(cmd); licenseState = currentConfig.getLicenseState(); customConfig = currentConfig.getCustomEnabled(); gasConfigPanel.setLicenseState(licenseState, customConfig); gasConfigPanel.setLicenseLabel(); break; // ///////////////////////////////////////////////////////////////////////// // Versuche Verbindung mit Bluetooht Gert case ProjectConst.MESSAGE_CONNECTING: lg.info("CONNECTING..."); setElementsInactive(true); break; // ///////////////////////////////////////////////////////////////////////// // Device wurde verbunden case ProjectConst.MESSAGE_CONNECTED: lg.info("CONNECT"); setElementsConnected(true); // Gleich mal Fragen, wer da dran ist! btComm.askForDeviceName(); btComm.askForSerialNumber(); btComm.askForLicenseFromSPX(); btComm.writeDateTimeToDevice(new DateTime()); btComm.askForFirmwareVersion(); connectionPanel.setAliasesEditable(false); connectionPanel.refreshAliasTable(); gasConfigPanel.setPanelOnlineMode(true); // warte, bis die Nachricht FWVERSION_READ kommt, um das wartefenster zu schliessen waitForMessage = ProjectConst.MESSAGE_FWVERSION_READ; break; // ///////////////////////////////////////////////////////////////////////// // Device wurde getrennt case ProjectConst.MESSAGE_DISCONNECTED: lg.info("DISCONNECT"); if (wDial != null) { wDial.dispose(); wDial = null; } setElementsConnected(false); configPanel.setAllConfigPanlelsEnabled(false); gasConfigPanel.setPanelOnlineMode(false); connectionPanel.refreshAliasTable(); connectionPanel.setAliasesEditable(true); if (tabbedPane.getSelectedIndex() != programTabs.TAB_CONNECT.ordinal()) { showWarnBox(LangStrings.getString("MainCommGUI.warnDialog.connectionClosed")); } if (tabbedPane.getSelectedIndex() != programTabs.TAB_LOGGRAPH.ordinal()) { // wen nicht grad loggrafik angezeigt wird, auf den Connecttab wechseln tabbedPane.setSelectedIndex(programTabs.TAB_CONNECT.ordinal()); } break; // ///////////////////////////////////////////////////////////////////////// // Kein Gert zum Verbinden gefunden! case ProjectConst.MESSAGE_BTNODEVCONN: lg.error("no device found..."); showWarnBox(LangStrings.getString("MainCommGUI.warnDialog.notDeviceSelected.text")); setElementsConnected(false); break; // ///////////////////////////////////////////////////////////////////////// // Lebenszeichen mit Ackuspannugn empfangen case ProjectConst.MESSAGE_SPXALIVE: lg.info("acku value from spx42 recived..."); setAckuValue(cmd); if (savedConfig == null) { currentConfig.setWasInit(true); } savedConfig = new SPX42Config(currentConfig); configPanel.setAllConfigPanlelsEnabled(true); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht, da da etwas passiert, also Hinweisbox weiterzhlen lassen case ProjectConst.MESSAGE_PROCESS_NEXT: if (wDial != null) { if (cmd == null) { wDial.incrementProgress(); } else { wDial.setProgress(cmd); } } break; // ///////////////////////////////////////////////////////////////////////// // Nachricht, da die Hinweisbox geschlossen werden kann case ProjectConst.MESSAGE_PROCESS_END: if (wDial != null) { wDial.dispose(); wDial = null; } if (cmd != null) { if (cmd.equals("config_write")) { savedConfig = new SPX42Config(currentConfig); } } break; // ///////////////////////////////////////////////////////////////////////// // Nachricht ber den Empfang einer Gaseinstellung case ProjectConst.MESSAGE_GAS_READ: // Gibts schon ein GasListObjekt SPX42GasList currGasList = gasConfigPanel.getCurrGasList(); if (currGasList == null) { lg.warn("not alloacated gaslist in gasEditPanel yet!"); return; } // lt sich das Teil parsen? if (currGasList.setGas(cmd)) { // ist alle initialisiert? if (currGasList.isInitialized()) { // wenn die Gaskiste initialisiert ist gasConfigPanel.initGasesFromCurrent(); // dann kann das fenster ja wech! if (wDial != null) { wDial.dispose(); wDial = null; } } } break; // ///////////////////////////////////////////////////////////////////////// // Nachricht Syncronisation wird beendet case ProjectConst.MESSAGE_SYCSTAT_OFF: lg.warn("SPX42 switched SYNC OFF! Connetion will failure...."); // disconnect! btComm.disconnectDevice(); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht Gase wurden erfolgreich geschrieben case ProjectConst.MESSAGE_GAS_WRITTEN: lg.debug("gas written to SPX..."); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht ein Logbuch Verzeichniseintrag wurde gelesen case ProjectConst.MESSAGE_DIRENTRY_READ: lg.debug("logdir entry recived..."); String decodet = decodeLogDirEntry(cmd); if (decodet != null) { logListPanel.addLogdirEntry(decodet); } if (!logListPanel.isReadingComplete()) { // hab noch zu tun... if (wDial != null) { wDial.incrementProgress(); } } else { // dann kann das fenster ja wech! if (wDial != null) { wDial.dispose(); wDial = null; } } break; // ///////////////////////////////////////////////////////////////////////// // Nachricht: Start einer Logdatenbermittling case ProjectConst.MESSAGE_LOGENTRY_START: lg.debug("start transfer logentry <" + cmd + ">..."); logListPanel.startTransfer(cmd, currentConfig.getUnitSystem()); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht: Logzeile bertragen case ProjectConst.MESSAGE_LOGENTRY_LINE: lg.debug("recive one log line from SPX..."); logListPanel.addLogLineFromSPX(cmd); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht: Logzeile bertragen case ProjectConst.MESSAGE_LOGENTRY_STOP: lg.debug("logfile transfer done..."); // Ab auf die Platte ind die DB damit! logListPanel.writeCacheToDatabase(); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht: Logdirectory aus Cache neu aufbauen case ProjectConst.MESSAGE_LOGDIRFROMCACHE: lg.debug("log directory from cache rebuilding..."); logListPanel.addLogDirFromCache(); break; // ///////////////////////////////////////////////////////////////////////// // Nachricht: Daten gesichert.... case ProjectConst.MESSAGE_DB_SUCCESS: lg.debug("loglist transfer success..."); // dann kann das fenster ja wech! if (wDial != null) { wDial.dispose(); wDial = null; } if (btComm != null) { if (btComm.isConnected()) { Integer[] logListEntry = logListPanel.getNextEntryToRead(); if (logListEntry != null) { // unterscheide Update oder Neu computeLogRequest(logListEntry); } else { // Da sind keine Eintrge mehr zu lesen. Mach ein Update der Logverzeichnisliste if (btComm != null) { if (btComm.isConnected()) { // Kann ich vom Cache lesen? if (logListPanel.canReadFromCache()) { // Baue die Liste mit dem Cache wieder auf ev = new ActionEvent(this, ProjectConst.MESSAGE_LOGDIRFROMCACHE, "from_ache"); actionPerformed(ev); } else { // lese die Liste der Logeintrge neu ein if (logListPanel.prepareReadLogdir(btComm.getConnectedDevice())) { // Sag dem SPX er soll alles schicken wDial = new PleaseWaitDialog( LangStrings.getString("PleaseWaitDialog.title"), LangStrings.getString("PleaseWaitDialog.readLogDir")); wDial.setVisible(true); wDial.setTimeout(120 * 1000); btComm.readLogDirectoryFromSPX(); } } } else { showWarnBox(LangStrings.getString("MainCommGUI.warnDialog.notConnected.text")); } } } } else { showWarnBox(LangStrings.getString("MainCommGUI.warnDialog.notConnected.text")); } } break; // ///////////////////////////////////////////////////////////////////////// // Nachricht: Datenbankfehler.... case ProjectConst.MESSAGE_DB_FAIL: lg.debug("loglist transfer failed..."); // dann kann das fenster ja wech! if (wDial != null) { wDial.dispose(); wDial = null; } if (cmd != null) { showErrorDialog(LangStrings.getString("spx42LoglistPanel.logListLabel.text") + "\n" + cmd); } else { showErrorDialog(LangStrings.getString("spx42LoglistPanel.logListLabel.text")); } logListPanel.removeFailedDataset(); break; // ///////////////////////////////////////////////////////////////////////// // Der 10-Sekunden Ticker case ProjectConst.MESSAGE_TICK: if (SpxPcloggerProgramConfig.developDebug) lg.debug("TICK!"); break; // ///////////////////////////////////////////////////////////////////////// // Ich soll mit BT Device direkt verbinden case ProjectConst.MESSAGE_CONNECTBTDEVICE: if (btComm != null) { waitForMessage = 0; // auf erst mal nix warten... connectSPX(cmd); } break; // ///////////////////////////////////////////////////////////////////////// // Ich soll mit BT Device direkt verbinden case ProjectConst.MESSAGE_CONNECTVIRTDEVICE: if (btComm != null) { waitForMessage = 0; // auf erst mal nix warten... connectVirtSPX(cmd); } break; // ///////////////////////////////////////////////////////////////////////// // Trenne Verbindung case ProjectConst.MESSAGE_DISCONNECTBTDEVICE: if (btComm != null) { disconnectSPX(); } break; // ///////////////////////////////////////////////////////////////////////// // Timeout bei Schreiben auf Gert case ProjectConst.MESSAGE_COMMTIMEOUT: lg.error("TIMEOUT (write to comm) recived! Disconnect!"); System.exit(-1); break; // ///////////////////////////////////////////////////////////////////////// // Firmware nicht untersttzt beim schreiben case ProjectConst.MESSAGE_FWNOTSUPPORTED: if (wDial != null) { wDial.dispose(); wDial = null; } showErrorDialog("Firmware not supported"); break; // ///////////////////////////////////////////////////////////////////////// // Nichts traf zu.... default: lg.warn("unknown message recived!"); break; } return; }
From source file:com.openbravo.pos.sales.JRetailPanelTicket.java
protected void fireSelectedProduct(ProductInfoExt prod) { kotaction = 1;/*from w w w.ja va2s.co m*/ EventListener[] l = listeners.getListeners(ActionListener.class); ActionEvent e = null; for (int i = 0; i < l.length; i++) { if (e == null) { e = new ActionEvent(prod, ActionEvent.ACTION_PERFORMED, prod.getID()); } ((ActionListener) l[i]).actionPerformed(e); } incProduct(prod); }
From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
/** * *///from ww w . ja v a2 s . c o m @Action public void saveAction() { lockedToggleButton.setSelected(true); lockTheFields(!lockedToggleButton.isSelected()); buildPDSfromTable(); try { if (pds.getPopulationDatasetID() < 0) { CanRegClientApp.getApplication().saveNewPopulationDataset(pds); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_SAVED_PDS:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); } else { try { CanRegClientApp.getApplication().deletePopulationDataset(pds.getPopulationDatasetID()); } catch (SQLException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } CanRegClientApp.getApplication().saveNewPopulationDataset(pds); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_UPDATED_PDS:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); } } catch (SecurityException | RemoteException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } if (listener != null) { listener.actionPerformed(new ActionEvent(this, 1, "refresh")); } updateSaveAsNewAndDeleteButtons(); lockTheFields(true); }
From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
@Action public void deletePopulationDataSetAction() { int result = JOptionPane.showInternalConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("REALLY_DELETE:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle.getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("REALLY_DELETE?"), JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { try {//from w w w. j a v a2 s.c om CanRegClientApp.getApplication().deletePopulationDataset(pds.getPopulationDatasetID()); JOptionPane.showInternalMessageDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("SUCCESSFULLY_DELETED_PDS:_") + pds.getPopulationDatasetName() + ".", java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame") .getString("PDS_SAVED."), JOptionPane.INFORMATION_MESSAGE); if (listener != null) { listener.actionPerformed(new ActionEvent(this, 1, "refresh")); } } catch (SQLException | RemoteException | SecurityException ex) { Logger.getLogger(PDSEditorInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.nikonhacker.gui.EmulatorUI.java
private void openChipOptionsDialog(final int chip) { // ------------------------ Disassembly options JPanel disassemblyOptionsPanel = new JPanel(new MigLayout("", "[left,grow][left,grow]")); // Prepare sample code area final RSyntaxTextArea listingArea = new RSyntaxTextArea(20, 90); SourceCodeFrame.prepareAreaFormat(chip, listingArea); final List<JCheckBox> outputOptionsCheckBoxes = new ArrayList<JCheckBox>(); ActionListener areaRefresherListener = new ActionListener() { public void actionPerformed(ActionEvent e) { try { Set<OutputOption> sampleOptions = EnumSet.noneOf(OutputOption.class); dumpOptionCheckboxes(outputOptionsCheckBoxes, sampleOptions); int baseAddress = framework.getPlatform(chip).getCpuState().getResetAddress(); int lastAddress = baseAddress; Memory sampleMemory = new DebuggableMemory(false); sampleMemory.map(baseAddress, 0x100, true, true, true); StringWriter writer = new StringWriter(); Disassembler disassembler; if (chip == Constants.CHIP_FR) { sampleMemory.store16(lastAddress, 0x1781); // PUSH RP lastAddress += 2;//from w w w . j a v a 2 s .co m sampleMemory.store16(lastAddress, 0x8FFE); // PUSH (FP,AC,R12,R11,R10,R9,R8) lastAddress += 2; sampleMemory.store16(lastAddress, 0x83EF); // ANDCCR #0xEF lastAddress += 2; sampleMemory.store16(lastAddress, 0x9F80); // LDI:32 #0x68000000,R0 lastAddress += 2; sampleMemory.store16(lastAddress, 0x6800); lastAddress += 2; sampleMemory.store16(lastAddress, 0x0000); lastAddress += 2; sampleMemory.store16(lastAddress, 0x2031); // LD @(FP,0x00C),R1 lastAddress += 2; sampleMemory.store16(lastAddress, 0xB581); // LSL #24,R1 lastAddress += 2; sampleMemory.store16(lastAddress, 0x1A40); // DMOVB R13,@0x40 lastAddress += 2; sampleMemory.store16(lastAddress, 0x9310); // ORCCR #0x10 lastAddress += 2; sampleMemory.store16(lastAddress, 0x8D7F); // POP (R8,R9,R10,R11,R12,AC,FP) lastAddress += 2; sampleMemory.store16(lastAddress, 0x0781); // POP RP lastAddress += 2; disassembler = new Dfr(); disassembler.setDebugPrintWriter(new PrintWriter(new StringWriter())); // Ignore disassembler.setOutputFileName(null); disassembler.processOptions(new String[] { "-m", "0x" + Format.asHex(baseAddress, 8) + "-0x" + Format.asHex(lastAddress, 8) + "=CODE" }); } else { sampleMemory.store32(lastAddress, 0x340B0001); // li $t3, 0x0001 lastAddress += 4; sampleMemory.store32(lastAddress, 0x17600006); // bnez $k1, 0xBFC00020 lastAddress += 4; sampleMemory.store32(lastAddress, 0x00000000); // nop lastAddress += 4; sampleMemory.store32(lastAddress, 0x54400006); // bnezl $t4, 0xBFC00028 lastAddress += 4; sampleMemory.store32(lastAddress, 0x3C0C0000); // ?lui $t4, 0x0000 lastAddress += 4; int baseAddress16 = lastAddress; int lastAddress16 = baseAddress16; sampleMemory.store32(lastAddress16, 0xF70064F6); // save $ra,$s0,$s1,$s2-$s7,$fp, 0x30 lastAddress16 += 4; sampleMemory.store16(lastAddress16, 0x6500); // nop lastAddress16 += 2; sampleMemory.store32(lastAddress16, 0xF7006476); // restore $ra,$s0,$s1,$s2-$s7,$fp, 0x30 lastAddress16 += 4; sampleMemory.store16(lastAddress16, 0xE8A0); // ret lastAddress16 += 2; disassembler = new Dtx(); disassembler.setDebugPrintWriter(new PrintWriter(new StringWriter())); // Ignore disassembler.setOutputFileName(null); disassembler.processOptions(new String[] { "-m", "0x" + Format.asHex(baseAddress, 8) + "-0x" + Format.asHex(lastAddress, 8) + "=CODE:32", "-m", "0x" + Format.asHex(baseAddress16, 8) + "-0x" + Format.asHex(lastAddress16, 8) + "=CODE:16" }); } disassembler.setOutputOptions(sampleOptions); disassembler.setMemory(sampleMemory); disassembler.initialize(); disassembler.setOutWriter(writer); disassembler.disassembleMemRanges(); disassembler.cleanup(); listingArea.setText(""); listingArea.append(writer.toString()); listingArea.setCaretPosition(0); } catch (Exception ex) { ex.printStackTrace(); } } }; int i = 1; for (OutputOption outputOption : OutputOption.allFormatOptions) { JCheckBox checkBox = makeOutputOptionCheckBox(chip, outputOption, prefs.getOutputOptions(chip), false); if (checkBox != null) { outputOptionsCheckBoxes.add(checkBox); disassemblyOptionsPanel.add(checkBox, (i % 2 == 0) ? "wrap" : ""); checkBox.addActionListener(areaRefresherListener); i++; } } if (i % 2 == 0) { disassemblyOptionsPanel.add(new JLabel(), "wrap"); } // Force a refresh areaRefresherListener.actionPerformed(new ActionEvent(outputOptionsCheckBoxes.get(0), 0, "")); // disassemblyOptionsPanel.add(new JLabel("Sample output:", SwingConstants.LEADING), "gapbottom 1, span, split 2, aligny center"); // disassemblyOptionsPanel.add(new JSeparator(), "span 2,wrap"); disassemblyOptionsPanel.add(new JSeparator(), "span 2, gapleft rel, growx, wrap"); disassemblyOptionsPanel.add(new JLabel("Sample output:"), "span 2,wrap"); disassemblyOptionsPanel.add(new JScrollPane(listingArea), "span 2,wrap"); disassemblyOptionsPanel.add(new JLabel("Tip: hover over the option checkboxes for help"), "span 2, center, wrap"); // ------------------------ Emulation options JPanel emulationOptionsPanel = new JPanel(new VerticalLayout(5, VerticalLayout.LEFT)); emulationOptionsPanel.add(new JLabel()); JLabel warningLabel = new JLabel( "NOTE: these options only take effect after reloading the firmware (or performing a 'Stop and reset')"); warningLabel.setBackground(Color.RED); warningLabel.setOpaque(true); warningLabel.setForeground(Color.WHITE); warningLabel.setHorizontalAlignment(SwingConstants.CENTER); emulationOptionsPanel.add(warningLabel); emulationOptionsPanel.add(new JLabel()); final JCheckBox writeProtectFirmwareCheckBox = new JCheckBox("Write-protect firmware"); writeProtectFirmwareCheckBox.setSelected(prefs.isFirmwareWriteProtected(chip)); emulationOptionsPanel.add(writeProtectFirmwareCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, any attempt to write to the loaded firmware area will result in an Emulator error. This can help trap spurious writes")); final JCheckBox dmaSynchronousCheckBox = new JCheckBox("Make DMA synchronous"); dmaSynchronousCheckBox.setSelected(prefs.isDmaSynchronous(chip)); emulationOptionsPanel.add(dmaSynchronousCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, DMA operations will be performed immediately, pausing the CPU. Otherwise they are performed in a separate thread.")); final JCheckBox autoEnableTimersCheckBox = new JCheckBox("Auto enable timers"); autoEnableTimersCheckBox.setSelected(prefs.isAutoEnableTimers(chip)); emulationOptionsPanel.add(autoEnableTimersCheckBox); emulationOptionsPanel .add(new JLabel("If checked, timers will be automatically enabled upon reset or firmware load.")); // Log memory messages final JCheckBox logMemoryMessagesCheckBox = new JCheckBox("Log memory messages"); logMemoryMessagesCheckBox.setSelected(prefs.isLogMemoryMessages(chip)); emulationOptionsPanel.add(logMemoryMessagesCheckBox); emulationOptionsPanel .add(new JLabel("If checked, messages related to memory will be logged to the console.")); // Log serial messages final JCheckBox logSerialMessagesCheckBox = new JCheckBox("Log serial messages"); logSerialMessagesCheckBox.setSelected(prefs.isLogSerialMessages(chip)); emulationOptionsPanel.add(logSerialMessagesCheckBox); emulationOptionsPanel.add( new JLabel("If checked, messages related to serial interfaces will be logged to the console.")); // Log register messages final JCheckBox logRegisterMessagesCheckBox = new JCheckBox("Log register messages"); logRegisterMessagesCheckBox.setSelected(prefs.isLogRegisterMessages(chip)); emulationOptionsPanel.add(logRegisterMessagesCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, warnings related to unimplemented register addresses will be logged to the console.")); // Log pin messages final JCheckBox logPinMessagesCheckBox = new JCheckBox("Log pin messages"); logPinMessagesCheckBox.setSelected(prefs.isLogPinMessages(chip)); emulationOptionsPanel.add(logPinMessagesCheckBox); emulationOptionsPanel.add(new JLabel( "If checked, warnings related to unimplemented I/O pins will be logged to the console.")); emulationOptionsPanel.add(new JSeparator(JSeparator.HORIZONTAL)); // Alt mode upon Debug JPanel altDebugPanel = new JPanel(new FlowLayout()); Object[] altDebugMode = EnumSet.allOf(EmulationFramework.ExecutionMode.class).toArray(); final JComboBox altModeForDebugCombo = new JComboBox(new DefaultComboBoxModel(altDebugMode)); for (int j = 0; j < altDebugMode.length; j++) { if (altDebugMode[j].equals(prefs.getAltExecutionModeForSyncedCpuUponDebug(chip))) { altModeForDebugCombo.setSelectedIndex(j); } } altDebugPanel.add(new JLabel(Constants.CHIP_LABEL[1 - chip] + " mode when " + Constants.CHIP_LABEL[chip] + " runs in sync Debug: ")); altDebugPanel.add(altModeForDebugCombo); emulationOptionsPanel.add(altDebugPanel); emulationOptionsPanel .add(new JLabel("If 'sync mode' is selected, this is the mode the " + Constants.CHIP_LABEL[1 - chip] + " chip will run in when running the " + Constants.CHIP_LABEL[chip] + " in Debug mode")); // Alt mode upon Step JPanel altStepPanel = new JPanel(new FlowLayout()); Object[] altStepMode = EnumSet.allOf(EmulationFramework.ExecutionMode.class).toArray(); final JComboBox altModeForStepCombo = new JComboBox(new DefaultComboBoxModel(altStepMode)); for (int j = 0; j < altStepMode.length; j++) { if (altStepMode[j].equals(prefs.getAltExecutionModeForSyncedCpuUponStep(chip))) { altModeForStepCombo.setSelectedIndex(j); } } altStepPanel.add(new JLabel(Constants.CHIP_LABEL[1 - chip] + " mode when " + Constants.CHIP_LABEL[chip] + " runs in sync Step: ")); altStepPanel.add(altModeForStepCombo); emulationOptionsPanel.add(altStepPanel); emulationOptionsPanel .add(new JLabel("If 'sync mode' is selected, this is the mode the " + Constants.CHIP_LABEL[1 - chip] + " chip will run in when running the " + Constants.CHIP_LABEL[chip] + " in Step mode")); // ------------------------ Prepare tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(Constants.CHIP_LABEL[chip] + " Disassembly Options", null, disassemblyOptionsPanel); tabbedPane.addTab(Constants.CHIP_LABEL[chip] + " Emulation Options", null, emulationOptionsPanel); if (chip == Constants.CHIP_TX) { JPanel chipSpecificOptionsPanel = new JPanel(new VerticalLayout(5, VerticalLayout.LEFT)); chipSpecificOptionsPanel.add(new JLabel("Eeprom status upon startup:")); ActionListener eepromInitializationRadioActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { prefs.setEepromInitMode(Prefs.EepromInitMode.valueOf(e.getActionCommand())); } }; JRadioButton blank = new JRadioButton("Blank"); blank.setActionCommand(Prefs.EepromInitMode.BLANK.name()); blank.addActionListener(eepromInitializationRadioActionListener); if (Prefs.EepromInitMode.BLANK.equals(prefs.getEepromInitMode())) blank.setSelected(true); JRadioButton persistent = new JRadioButton("Persistent across sessions"); persistent.setActionCommand(Prefs.EepromInitMode.PERSISTENT.name()); persistent.addActionListener(eepromInitializationRadioActionListener); if (Prefs.EepromInitMode.PERSISTENT.equals(prefs.getEepromInitMode())) persistent.setSelected(true); JRadioButton lastLoaded = new JRadioButton("Last Loaded"); lastLoaded.setActionCommand(Prefs.EepromInitMode.LAST_LOADED.name()); lastLoaded.addActionListener(eepromInitializationRadioActionListener); if (Prefs.EepromInitMode.LAST_LOADED.equals(prefs.getEepromInitMode())) lastLoaded.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(blank); group.add(persistent); group.add(lastLoaded); chipSpecificOptionsPanel.add(blank); chipSpecificOptionsPanel.add(persistent); chipSpecificOptionsPanel.add(lastLoaded); chipSpecificOptionsPanel.add(new JLabel("Front panel type:")); final JComboBox frontPanelNameCombo = new JComboBox(new String[] { "D5100_small", "D5100_large" }); if (prefs.getFrontPanelName() != null) { frontPanelNameCombo.setSelectedItem(prefs.getFrontPanelName()); } frontPanelNameCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { prefs.setFrontPanelName((String) frontPanelNameCombo.getSelectedItem()); } }); chipSpecificOptionsPanel.add(frontPanelNameCombo); emulationOptionsPanel.add(new JSeparator(JSeparator.HORIZONTAL)); tabbedPane.addTab(Constants.CHIP_LABEL[chip] + " specific options", null, chipSpecificOptionsPanel); } // ------------------------ Show it if (JOptionPane.OK_OPTION == JOptionPane.showOptionDialog(this, tabbedPane, Constants.CHIP_LABEL[chip] + " options", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, JOptionPane.DEFAULT_OPTION)) { // save output options dumpOptionCheckboxes(outputOptionsCheckBoxes, prefs.getOutputOptions(chip)); // apply TxCPUState.initRegisterLabels(prefs.getOutputOptions(chip)); // save other prefs prefs.setFirmwareWriteProtected(chip, writeProtectFirmwareCheckBox.isSelected()); prefs.setDmaSynchronous(chip, dmaSynchronousCheckBox.isSelected()); prefs.setAutoEnableTimers(chip, autoEnableTimersCheckBox.isSelected()); prefs.setLogRegisterMessages(chip, logRegisterMessagesCheckBox.isSelected()); prefs.setLogSerialMessages(chip, logSerialMessagesCheckBox.isSelected()); prefs.setLogPinMessages(chip, logPinMessagesCheckBox.isSelected()); prefs.setLogMemoryMessages(chip, logMemoryMessagesCheckBox.isSelected()); prefs.setAltExecutionModeForSyncedCpuUponDebug(chip, (EmulationFramework.ExecutionMode) altModeForDebugCombo.getSelectedItem()); prefs.setAltExecutionModeForSyncedCpuUponStep(chip, (EmulationFramework.ExecutionMode) altModeForStepCombo.getSelectedItem()); } }
From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
@Action public void copyTableAction() { myAd.actionPerformed(new ActionEvent(this, 0, java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame").getString("COPY"))); }
From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java
@Action public void pasteTableAction() { myAd.actionPerformed(new ActionEvent(this, 0, java.util.ResourceBundle .getBundle("canreg/client/gui/dataentry/resources/PDSEditorInternalFrame").getString("PASTE"))); updateTotals();//from www. j a v a 2 s.c o m }
From source file:com.openbravo.pos.sales.JRetailPanelTakeAway.java
protected void fireSelectedProduct(ProductInfoExt prod) { System.out.println(" fireSelectedProduct for popular item"); kotaction = 1;// ww w. j a v a 2 s . com EventListener[] l = listeners.getListeners(ActionListener.class); ActionEvent e = null; for (int i = 0; i < l.length; i++) { if (e == null) { e = new ActionEvent(prod, ActionEvent.ACTION_PERFORMED, prod.getID()); } ((ActionListener) l[i]).actionPerformed(e); } incProduct(prod); }
From source file:com.hexidec.ekit.EkitCore.java
/** * Method for inserting list elements//from w w w .j a v a 2s.co m */ public void insertListStyle(Element element) throws BadLocationException, IOException { if (element.getParentElement().getName() == "ol") { actionListOrdered.actionPerformed(new ActionEvent(new Object(), 0, "newListPoint")); } else { actionListUnordered.actionPerformed(new ActionEvent(new Object(), 0, "newListPoint")); } }