001package jmri.jmrit.symbolicprog; 002 003import java.util.ResourceBundle; 004 005import javax.swing.JLabel; 006 007import jmri.Programmer; 008import jmri.util.swing.JmriJOptionPane; 009 010/** 011 * Holds a table of the available factory resets available for a particular 012 * decoder. 013 * 014 * @author Howard G. Penny Copyright (C) 2005 015 */ 016public class ResetTableModel extends ExtraMenuTableModel { 017 018 public ResetTableModel(JLabel status, Programmer pProgrammer) { 019 super(status, pProgrammer); 020 name = Bundle.getMessage("MenuReset"); 021 } 022 023 /** {@inheritDoc} */ 024 @Override 025 public String getTopLevelElementName() { 026 return "resets"; 027 } 028 029 /** {@inheritDoc} */ 030 @Override 031 public String getIndividualElementName() { 032 return "factReset"; 033 } 034 035 /** 036 * Can provide some mechanism to prompt for user for one last chance to 037 * change his/her mind 038 * @param currentMode current programming mode 039 * @param resetModes representation of reset modes available 040 * @param availableModes representation of available modes 041 * @return true if user says to continue 042 */ 043 @Override 044 boolean badModeOk(String currentMode, String resetModes, String availableModes) { 045 String resetWarning 046 = ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetModeWarn1") 047 + "\n\n" 048 + java.text.MessageFormat.format(ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetModeWarn2"), resetModes) 049 + "\n" 050 + java.text.MessageFormat.format(ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetModeWarn3"), availableModes) 051 + "\n" 052 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetModeWarn4") 053 + "\n\n" 054 + java.text.MessageFormat.format(ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetModeWarn5"), currentMode); 055 return (JmriJOptionPane.YES_OPTION 056 == JmriJOptionPane.showConfirmDialog(null, 057 resetWarning, 058 ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetTitle"), 059 JmriJOptionPane.YES_NO_OPTION, JmriJOptionPane.WARNING_MESSAGE)); 060 } 061 062 /** 063 * Can provide some mechanism to prompt for user for one last chance to 064 * change his/her mind 065 * 066 * @return true if user says to continue 067 */ 068 @Override 069 boolean opsResetOk() { 070 String resetWarning 071 = ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn1") 072 + "\n\n" 073 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn2") 074 + "\n" 075 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn3") 076 + "\n" 077 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn4") 078 + "\n\n" 079 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn5") 080 + "\n" 081 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn6") 082 + "\n\n" 083 + ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsWarn7"); 084 return (JmriJOptionPane.YES_OPTION 085 == JmriJOptionPane.showConfirmDialog(null, 086 resetWarning, 087 ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle").getString("FactoryResetOpsTitle"), 088 JmriJOptionPane.YES_NO_OPTION, JmriJOptionPane.WARNING_MESSAGE)); 089 } 090 091 092}