From: Kevin D. <kev...@us...> - 2009-12-21 17:37:20
|
Update of /cvsroot/jmri/jmri/jmrit/display In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv31608 Modified Files: LayoutEditor.java LayoutEditorBundle.properties Log Message: Message added when closing the layout window, asking the user if they are simply hiding the window, or wishing to delete it. Done in the same way that the panel editor does. Updated so that the Memory is now referenced using the namedBeanHandle. Index: LayoutEditor.java =================================================================== RCS file: /cvsroot/jmri/jmri/jmrit/display/LayoutEditor.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** LayoutEditor.java 11 Dec 2009 21:47:28 -0000 1.62 --- LayoutEditor.java 21 Dec 2009 17:37:10 -0000 1.63 *************** *** 630,640 **** (savedAnimatingLayout!=animatingLayout) || (savedShowHelpBar!=showHelpBar) ) { // remind to save panel ! javax.swing.JOptionPane.showMessageDialog(null, rb.getString("Reminder1")+" "+rb.getString("Reminder2")+ "\n"+rb.getString("Reminder3"), rb.getString("ReminderTitle"), ! javax.swing.JOptionPane.INFORMATION_MESSAGE); ! } setAllPositionable(false); jmri.jmrit.display.PanelMenu.instance().updateLayoutEditorPanel(thisPanel); --- 630,642 ---- (savedAnimatingLayout!=animatingLayout) || (savedShowHelpBar!=showHelpBar) ) { + + targetWindowClosing(true); // remind to save panel ! /*javax.swing.JOptionPane.showMessageDialog(null, rb.getString("Reminder1")+" "+rb.getString("Reminder2")+ "\n"+rb.getString("Reminder3"), rb.getString("ReminderTitle"), ! javax.swing.JOptionPane.INFORMATION_MESSAGE);*/ ! } else targetWindowClosing(false); setAllPositionable(false); jmri.jmrit.display.PanelMenu.instance().updateLayoutEditorPanel(thisPanel); *************** *** 4164,4168 **** MemoryIcon l = new MemoryIcon(this); l.setMemory(textMemory.getText().trim()); ! Memory xMemory = l.getMemory(); if (xMemory != null) { if ( (xMemory.getUserName() == null) || --- 4166,4170 ---- MemoryIcon l = new MemoryIcon(this); l.setMemory(textMemory.getText().trim()); ! Memory xMemory = l.getMemory().getBean(); if (xMemory != null) { if ( (xMemory.getUserName() == null) || *************** *** 5902,5905 **** --- 5904,5939 ---- return (new Point2D.Double(0.0,0.0)); } + static boolean showCloseInfoMessage = true; + + /** + * The target window has been requested to close, don't delete it at this + * time. Deletion must be accomplished via the Delete this panel menu item. + */ + void targetWindowClosing(boolean save) { + //this.setVisible(false); // doesn't remove the editor! + // display info message on panel close + if (showCloseInfoMessage) { + String name = "Panel"; + String message = rb.getString("PanelCloseQuestion") +"\n" + + rb.getString("PanelCloseHelp"); + if(save){ + message = rb.getString("Reminder1")+" "+rb.getString("Reminder2")+ + "\n"+rb.getString("Reminder3") + "\n\n"+message; + } + if (targetPanel.getTopLevelAncestor() != null) + name = ((JFrame) targetPanel.getTopLevelAncestor()).getTitle(); + int selectedValue = JOptionPane.showOptionDialog(targetPanel, + java.text.MessageFormat.format(message, + new Object[] { name }), null, + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, + null, new Object[] { rb.getString("ButtonHide"), rb.getString("ButtonDelete"), + rb.getString("ButtonDontShow") }, rb.getString("ButtonHide")); + if (selectedValue == 1) + deletePanel(); + if (selectedValue == 2) + showCloseInfoMessage = false; + } + } + // initialize logging Index: LayoutEditorBundle.properties =================================================================== RCS file: /cvsroot/jmri/jmri/jmrit/display/LayoutEditorBundle.properties,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** LayoutEditorBundle.properties 27 Oct 2009 16:57:25 -0000 1.29 --- LayoutEditorBundle.properties 21 Dec 2009 17:37:10 -0000 1.30 *************** *** 447,448 **** --- 447,455 ---- CanNotRename = Can not rename panel with the same name as an existing panel PanelExist = Panel name already exists! + + # close panel warning messages and buttons + ButtonDontShow = Don't show this again + PanelCloseQuestion = Do you want to hide or delete "{0}"? + PanelCloseHelp = Use Panels->Show Panel to display hidden panels. + ButtonHide = Hide Panel + ButtonDelete = Delete Panel |