Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 781 → Rev 782

/sun/xmleditor/trunk/src/gui/GUI.java
4,10 → 4,10
* Coded by: Group 5, software practice summer 2003
* University of Bielefeld, Germany
*
* @version $Revision: 1.79 $
* @version $Revision: 1.80 $
*
* Last modification: $Date: 2003/07/23 15:59:17 $
* $Id: GUI.java,v 1.79 2003/07/23 15:59:17 mdonner Exp $
* Last modification: $Date: 2003/07/24 13:55:51 $
* $Id: GUI.java,v 1.80 2003/07/24 13:55:51 smcsporr Exp $
*/
 
package src.gui;
50,7 → 50,7
*
* @author group 5
*
* @version $Revision: 1.79 $ Last modification: $Date: 2003/07/23 15:59:17 $
* @version $Revision: 1.80 $ Last modification: $Date: 2003/07/24 13:55:51 $
*/
public class GUI
extends JFrame implements GuiInterface,WindowListener {
163,7 → 163,7
splitterMain.setRightComponent(splitter);
splitterMain.setDividerLocation(200);
splitterMain.setOneTouchExpandable(true);
//added 14.07.03 Sascha W. for better display
 
splitterMain.setContinuousLayout(true);
getContentPane().add(splitterMain);
 
200,18 → 200,16
 
JMenu file = new JMenu("File");
/* A button for opening XML files, utilizing an accelerator key (strg-v). */
open = new JMenuItem("Open XML file");
/* Shortkey for open function. */
open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK));
/* Help text for open function. */
open.setToolTipText("click to open a file");
open.addActionListener(docManager);
file.add(open);
/* A button for creating new XML files, utilizing an accelerator key (strg-n). */
neweeDoc = new JMenuItem("New document");
/* Help text for new document function. */
neweeDoc.setToolTipText("click to create a new document");
/* Shortkey for open function. */
neweeDoc.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK));
neweeDoc.addActionListener(docManager);
file.add(neweeDoc);
221,7 → 219,7
/* Button for save option. */
save = new JMenuItem("Save document");
/* Help text for save function. */
save.setToolTipText("click to save the actual document");
save.setToolTipText("click to save the active document");
/* Shortkey for save function. */
save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK));
save.addActionListener(docManager);
229,7 → 227,7
saveAs = new JMenuItem("Save document as");
/* Help text for save as ... function. */
saveAs.setToolTipText("click to save the actual document as ...");
saveAs.setToolTipText("click to save the active document as ...");
/* Shortkey for save as ... function. */
saveAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK));
saveAs.addActionListener(docManager);
236,11 → 234,11
file.add(saveAs);
saveAll = new JMenuItem("Save all documents");
/* Help text for Save all.. function*/
saveAll.setToolTipText("click to save all opened Documents");
/*Shortkey for save all .. function*/
/* Help text for Save all ... function*/
saveAll.setToolTipText("click to save all open documents");
/*Shortkey for Save all ... function*/
saveAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK));
/* Register save all Documents button events with docManager. */
/* Register 'Save all documents' button events with docManager. */
saveAll.addActionListener(docManager);
file.add(saveAll);
249,6 → 247,7
exit = new JMenuItem("Exit");
/* Help text for exit function. */
exit.setToolTipText("click to leave the program");
/* Register the exit function with otherGUIListener. */
exit.addActionListener(otherGUIListener);
file.add(exit);
 
257,10 → 256,12
 
/**
* This method creates a dummy menu for plugins. The plugins might set their own menu
* with the method <code>setPluginMenu</code> of <code>GuiInterface</code>.
* This method creates a dummy menu for plugins.
* The plugins might set their own menu with the method <code>setPluginMenu</code>
* of <code>GuiInterface</code>. The dummy menu will display a disabled
* menu item that is not selectable.
*
* @return A dummy menu for plugins.
* @return A disabled <code>JMenu</code> object as default for the plugin menu.
*
* author Sascha Walkenhorst
*
269,7 → 270,8
private JMenu createPluginMenu() {
pluginMenu = new JMenu("plugin");
/* menu doesn't provide any functions, so disable it */
/* Menu is empty and doesn't provide any functions, so disable it. */
pluginMenu.setEnabled(false);
return pluginMenu;
}
287,7 → 289,7
*/
private JMenu createDocumentMenu() {
JMenu document = new JMenu("Document");
JMenu documentMenu = new JMenu("Document");
validate = new JMenuItem("Validate document");
/* Help text for validate function. */
296,32 → 298,32
validate.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK));
/* Register validation button events with docManager. */
validate.addActionListener(docManager);
document.add(validate);
documentMenu.add(validate);
/* Menu item for changing a document's DTD. */
setNewDTD = new JMenuItem("Set DTD");
/* Help text for 'Set DTD' function. */
setNewDTD.setToolTipText("click to change the document's DTD");
setNewDTD.setToolTipText("click to change the active document's DTD");
/* Register 'Set DTD' button with docManager. */
setNewDTD.addActionListener(docManager);
document.add(setNewDTD);
documentMenu.add(setNewDTD);
 
/* Menu item for changing a document's schema. */
setNewSchema = new JMenuItem("Set XML schema");
/* Help text for 'Set XML schema' function. */
setNewSchema.setToolTipText("click to change the document's XML schema");
setNewSchema.setToolTipText("click to change the active document's XML schema");
/* Register 'Set XML schema' button with docManager. */
setNewSchema.addActionListener(docManager);
document.add(setNewSchema);
documentMenu.add(setNewSchema);
document.addSeparator();
documentMenu.addSeparator();
closeAll = new JMenuItem("Close all opened documents");
/* Help text for close document. */
closeAll.setToolTipText("click to close all opened documents");
closeAll.setToolTipText("click to close all open documents");
/* Register close all active documents button events with docManager. */
closeAll.addActionListener(docManager);
document.add(closeAll);
documentMenu.add(closeAll);
closeActDoc = new JMenuItem("Close active document");
/* Help text for close document. */
330,9 → 332,9
closeActDoc.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK));
/* Register close active document button events with docManager. */
closeActDoc.addActionListener(docManager);
document.add(closeActDoc);
documentMenu.add(closeActDoc);
return document;
return documentMenu;
}
/**
343,9 → 345,9
private JMenu createViewMenu() {
JMenu view = new JMenu("View");
setXpath = new JMenuItem("Set XPath");
/* Added 070703 S. McSporran -> Help text for enter Xpath. */
/* Help text for XPath function. */
setXpath.setToolTipText("click to enter an XPath expression");
/* Added 080703 S. McSporran -> Shortkey for set XPath function. */
/* Shortkey for set XPath function. */
setXpath.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK));
/* Register set XPath button events to docManager. */
setXpath.addActionListener(updateViewListener);
369,16 → 371,20
private JMenu createPluginConfigurationMenu() {
pluginConfigurationMenu = new JMenu("Plugin configuration");
 
/* A button for resetting the plugin configuration to default. */
resetConfiguration = new JMenuItem("Reset Configuration");
resetConfiguration.setToolTipText("click to reset the plugin configuration");
resetConfiguration.addActionListener(pluginManager);
pluginConfigurationMenu.add(resetConfiguration);
 
/* A button for changing the default plugin. */
changeDefaultPlugin = new JMenuItem("Change default plugin");
changeDefaultPlugin.setToolTipText("click to choose a other plugin as the default plugin");
changeDefaultPlugin.setToolTipText("click to choose a plugin as default plugin");
changeDefaultPlugin.addActionListener(pluginManager);
pluginConfigurationMenu.add(changeDefaultPlugin);
 
/* A button for changing between the default plugin and the plugin that
* is associated with the current element. */
switchToAndFroDefaultPlugin = new JMenuItem("Switch to and fro default plugin");
switchToAndFroDefaultPlugin.setToolTipText("click to switch between the associated and the default plugin");
switchToAndFroDefaultPlugin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK));;
385,8 → 391,9
switchToAndFroDefaultPlugin.addActionListener(pluginManager);
pluginConfigurationMenu.add(switchToAndFroDefaultPlugin);
 
/* A button to display the current plugin configuration. */
showActualConfiguration = new JMenuItem("Show actual configuration");
showActualConfiguration.setToolTipText("click to show the actual plugin configuration");
showActualConfiguration.setToolTipText("click to show the current plugin configuration");
showActualConfiguration.addActionListener(pluginManager);
pluginConfigurationMenu.add(showActualConfiguration);
667,7 → 674,6
* @see src.gui.LogInterface
*/
public LogInterface getLogInterface() {
return logPanel;
}
680,7 → 686,6
* @see src.gui.StatusInterface
*/
public StatusInterface getStatusInterface() {
return statusPanel;
}
690,7 → 695,6
* @return The current file.
*/
public File getCurrentFile() {
return docMaster.getActualDocumentFile();
}
700,7 → 704,6
* @return An implementation of a plugin panel.
*/
public JPanel getPluginPanel() {
return pluginPanel;
}
710,7 → 713,6
* @return The used frame.
*/
public Frame getMainWindow() {
return this;
}
 
724,7 → 726,6
* @return a reference to the <code> JTabbedPane </code> of the gui
*/
public JTabbedPane getTabbedPane() {
return pluginTabbedPanel;
}
 
736,15 → 737,18
* author S. Walkenhorst
*/
public void setPluginPanel(JPanel newPanel) {
 
pluginTabbedPanel.setComponentAt(pluginTabbedPanel.getSelectedIndex(), newPanel);
}
/**
* Sets the menu object the plugins will need for user interactions. This method
* provides own menus of plugins. The <code>JMenu</code> must be created in the
* plugin, then it must call this method.
* Attaches the menu object the plugins will need for user interactions to the GUI.
*
* This method provides specific plugin menus. The <code>JMenu</code> must be created
* in the plugin, then it must call this method and transfer it's menu object, so that
* it's specific menu can be displayed. At program start and if no menu has been
* specified, an empty and disabled menu item will be displayed. The menu will change
* each time, when another plugin than the current one sends it's menu object.
*
* @param newPluginMenu: The <code>JMenu</code> object with appropriate content.
*
* author S. Walkenhorst
753,17 → 757,19
*/
public void setPluginMenu(JMenu newPluginMenu) {
 
/* Saves the position of the plugin menu item in the menu bar. */
int savePosition = myMenuBar.getComponentIndex(pluginMenu);
/* If no menu has been specified, create an empty one. */
if (newPluginMenu == null) {
pluginMenu = createPluginMenu();
}
 
else {
} else {
/* Set the currently displayed menu to the one transferred as parameter. */
pluginMenu = newPluginMenu;
}
 
/* Replace the old plugin menu with the new one. */
myMenuBar.remove(savePosition);
myMenuBar.add(pluginMenu, savePosition);
setVisible(true);
801,7 → 807,7
*/
public void windowClosing(WindowEvent event) {
/* Leave the program, if the user has confirmed to quit. */
/* Leave the program, if user has confirmed to quit. */
if (quitConfirmed() == true) {
/* Close all documents and leave the program. */