Class MDIFrame

All Implemented Interfaces:
ActionListener, ComponentListener, ContainerListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, MainFrame, ThreadSafeDialogs, org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager

public class MDIFrame extends JFrame implements ComponentListener, ContainerListener, ActionListener, MainFrame
Main application window. Use Launcher.getMDIFrame to get the instance of this class.
Version:
$Revision: 39484 $
See Also:
  • Method Details

    • isInitialized

      public static boolean isInitialized()
    • getInstance

      public static MDIFrame getInstance()
    • init

      public void init()
      Makes some initialization tasks.
      Throws:
      RuntimeException
    • setTitle

      public void setTitle(String title)
      Description copied from interface: MainFrame
      Sets the main window title. This method is thread safe.
      Specified by:
      setTitle in interface MainFrame
      Overrides:
      setTitle in class Frame
      Parameters:
      title - The title to be set in the main window
    • addToolBar

      public SelectableToolBar addToolBar(String toolBarName, String description, int position)
    • addTool

      public void addTool(PluginClassLoader loader, SkinExtensionType ext, ToolBar toolBar, SelectableTool selectableTool) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • addTool

      public void addTool(PluginClassLoader loader, SkinExtensionType ext, ToolBar toolBar, ActionTool actionTool) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • addTool

      public void addTool(ActionInfo action, String toolBarName, String dropDownName)
      Specified by:
      addTool in interface MainFrame
    • addTool

      public void addTool(ActionInfo action, String toolBarName)
      Specified by:
      addTool in interface MainFrame
    • addTool

      public void addTool(ActionInfo action, String toolBarName, boolean useText)
      Specified by:
      addTool in interface MainFrame
    • addSelectableTool

      public void addSelectableTool(ActionInfo action, String toolBarName, String groupName, boolean useText)
      Specified by:
      addSelectableTool in interface MainFrame
    • addMenu

      public void addMenu(PluginClassLoader loader, SkinExtensionType ext, Menu menu) throws ClassNotFoundException
      Añade la informacion del menu al framework. Debido a que los men�es se pueden introducir en un orden determinado por el usuario, pero los plugins se instalan en un orden arbitrario, primero se almacena la informacion de todos los menus para luego ordenarlos y posteriormente añadirlos al interfaz
      Parameters:
      loader - Posicion del menu. Se ordena por este campo
      ext - Array con los nombres de los padres del menu
      menu - Texto del menu
      Throws:
      ClassNotFoundException
      RuntimeException
    • addMenu

      public void addMenu(ActionInfo action, String text)
      Specified by:
      addMenu in interface MainFrame
    • setClassesExtensions

      public void setClassesExtensions(Map<Class<? extends IExtension>,ExtensionDecorator> classesExtensions)
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Metodo de callback invocado cuando se selecciona un menu o un boton de la barra de herramientas. Se busca la extensi�n asociada y se ejecuta
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - Evento producido
    • addPopupMenu

      public void addPopupMenu(PluginClassLoader loader, PopupMenu menu)
    • removePopupMenuListener

      public void removePopupMenuListener(String name, ActionListener listener)
    • addPopupMenuListener

      public void addPopupMenuListener(String popupName, Component c, ActionListener listener, PluginClassLoader loader)
    • enableControls

      public void enableControls()
      Loop on the controls to enable/disable and show/hide them, according to its associated action (ActionInfo)
      Specified by:
      enableControls in interface MainFrame
      Throws:
      RuntimeException
    • refreshControls

      public void refreshControls()
      Description copied from interface: MainFrame
      This method is thread safe.
      Specified by:
      refreshControls in interface MainFrame
    • message

      public void message(String msg, int messageTyoe)
      Description copied from interface: MainFrame
      Show the message in the status bar of the application. The types of messages are: JOptionPane.INFORMATION_MESSAGE JOptionPane.WARNING_MESSAGE JOptionPane.ERROR_MESSAGE This method is thread safe to use.
      Specified by:
      message in interface MainFrame
      Specified by:
      message in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
      Parameters:
      msg - to show
      messageTyoe - type of message.
    • getMDIManager

      public MDIManager getMDIManager()
    • getStatusBar

      public NewStatusBar getStatusBar()
      Description copied from interface: MainFrame
      Gets the status bar, the bar located in the bottom part of the main window. It can be used to show messages, show progress bars, or change the status.
      Specified by:
      getStatusBar in interface MainFrame
      Returns:
      The main application's status bar.
    • setSelectedTool

      public void setSelectedTool(String actionCommand)
      You can use this function to select the appropiate tool inside the toolbars
      Specified by:
      setSelectedTool in interface MainFrame
    • setSelectedTool

      public void setSelectedTool(String groupName, String actionCommand)
      You can use this function to select the appropiate tool inside the toolbars
    • setSelectedTools

      public void setSelectedTools(Map selectedTools)
      You can use this function to select the appropiate tool inside the toolbars
    • setStatusBarLabels

      public void setStatusBarLabels(Class<?> clase, Label[] label)
      DOCUMENT ME!
      Specified by:
      setStatusBarLabels in interface MainFrame
      Parameters:
      clase -
      label -
    • removeStatusBarLabels

      public void removeStatusBarLabels(Class<?> clase)
      Description copied from interface: MainFrame
      Removes the labels associated with the provided class.
      Specified by:
      removeStatusBarLabels in interface MainFrame
      Parameters:
      clase - The class whose associated labels are to be removed.
    • addStatusBarControl

      public void addStatusBarControl(Class<?> extensionClass, org.gvsig.gui.beans.controls.IControl control)
      Description copied from interface: MainFrame
      Adds a control to the status bar and associate it with the provided extension. The control will be enabled and visible when the extension is enabled and visible.
      Specified by:
      addStatusBarControl in interface MainFrame
      Parameters:
      extensionClass - Extension which will determine whether the control is enabled and visible.
      control - The control to add.
    • addToolBarControl

      public void addToolBarControl(Class<?> extensionClass, JToolBar control, String name)
      Specified by:
      addToolBarControl in interface MainFrame
    • removeStatusBarControl

      public void removeStatusBarControl(String name)
      Description copied from interface: MainFrame
      Removes the providedcontrol from the status bar.
      Specified by:
      removeStatusBarControl in interface MainFrame
      Parameters:
      name - The name of the control to remove
    • removeMenu

      public void removeMenu(Menu menu)
      Description copied from interface: MainFrame
      Deletes the provided menu, if found.
      Specified by:
      removeMenu in interface MainFrame
      Parameters:
      menu - The menu to delete from the menu bar
    • addMenu

      public void addMenu(Menu menu, ActionListener listener, PluginClassLoader loader)
      Description copied from interface: MainFrame
      Adds the provided menu to the menu bar.
      Specified by:
      addMenu in interface MainFrame
      Parameters:
      menu - A Menu object containing the menu definition
      listener - Object which receives the menu events
      loader - ClassLoader of the plug-in that installs this menu
    • changeMenuName

      public void changeMenuName(String[] menu, String newName, PluginClassLoader loader)
      Description copied from interface: MainFrame
      Changes the menu name, and thus also its location, as the name determines the location of the menu.
      Specified by:
      changeMenuName in interface MainFrame
      Parameters:
      menu - An array of Strings which represents the full menu path, for example, {"Vista", "export", "imagen"} is a reference to the menu "Vista/export/imagen" (that is, the menu Image within the submenu View-Export). Menu names are translation keys, "Vista", "export", etc will be translated to the suitable language when they are displayed.
      newName - New menu's name, in the syntax "Vista/export/symbols". Each part of the name is a translation key.
      loader - ClassLoader of the plug-in that added the menu
    • componentHidden

      public void componentHidden(ComponentEvent arg0)
      Specified by:
      componentHidden in interface ComponentListener
    • componentMoved

      public void componentMoved(ComponentEvent arg0)
      Specified by:
      componentMoved in interface ComponentListener
    • componentResized

      public void componentResized(ComponentEvent arg0)
      Specified by:
      componentResized in interface ComponentListener
    • componentShown

      public void componentShown(ComponentEvent arg0)
      Specified by:
      componentShown in interface ComponentListener
    • componentAdded

      public void componentAdded(ContainerEvent arg0)
      Specified by:
      componentAdded in interface ContainerListener
    • componentRemoved

      public void componentRemoved(ContainerEvent arg0)
      Specified by:
      componentRemoved in interface ContainerListener
    • getTitlePrefix

      public String getTitlePrefix()
    • setTitlePrefix

      public void setTitlePrefix(String titlePrefix)
    • getSelectedTools

      public Map getSelectedTools()
    • getInitialSelectedTools

      public HashMap getInitialSelectedTools()
    • getComponentByName

      public JComponent getComponentByName(String name)
      Get a previously added JComponent by name. For example you can use it if you need to obtain a JToolBar to add some customized component.
      Specified by:
      getComponentByName in interface MainFrame
      Parameters:
      name -
      Returns:
      the JComponent or null if none has been found
    • getToolbars

      public SelectableToolBar[] getToolbars()
      Description copied from interface: MainFrame
      Gets an array containing all the toolbars.
      Specified by:
      getToolbars in interface MainFrame
      Returns:
      An array containing all the toolbars.
    • getToolbarVisibility

      public boolean getToolbarVisibility(String name)
      Description copied from interface: MainFrame
      Gets wheter or not this toolbar should be shown by Andami. Note that this does not reflect the actual visibility of the toolbar, because it also depends on other conditions (the toolbar should contain at lest a currently visible button).
      Specified by:
      getToolbarVisibility in interface MainFrame
      Parameters:
      name - The toolbar's name
      Returns:
    • setToolbarVisibility

      public boolean setToolbarVisibility(String name, boolean visibility)
      Description copied from interface: MainFrame
      Sets wheter or not this toolbar should be shown by Andami. This is useful if to hide some toolbars when they are not going to be used. If it's false, the toolbar will be hidden even if its associated extensions are visible. Note that setting visibility to true does not automatically show the toolbar, because it also depends on other conditions (the toolbar should contain at lest a currently visible button). However, it allows the toolbar to be visible when necessary conditions are fulfilled.
      Specified by:
      setToolbarVisibility in interface MainFrame
      Parameters:
      name - The toolbar's name.
      visibility -
      Returns:
    • getMenuEntry

      public JMenuItem getMenuEntry(String[] menuPath)
      Description copied from interface: MainFrame
      Gets the menu entry corresponding the provided menu path.
      Specified by:
      getMenuEntry in interface MainFrame
      Parameters:
      menuPath - The menu path to the menu entry that we want to retrieve. For example, if we want to retrieve the menu entry corresponding to the XML menu "Layer/Export/Export_to_PDF" we will provide an array containing ["Layer", "Export", "Export_to_PDF"].
      Returns:
      The menu entry corresponding the provided menu path. Note that the menu entry may be an instance of javax.swing.JMenuItem, javax.swing.JMenu or com.iver.andami.ui.mdiFrame.JMenuItem.
    • messageDialog

      public void messageDialog(String message, String title, int messageType)
      Specified by:
      messageDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • messageDialog

      public void messageDialog(String message, String[] messageArgs, String title, int messageType)
      Specified by:
      messageDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • messageDialog

      public void messageDialog(String message, String[] messageArgs, String title, int messageType, String msgid)
      Specified by:
      messageDialog in interface ThreadSafeDialogs
      Specified by:
      messageDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • confirmDialog

      public int confirmDialog(String message, String title, int optionType, int messageType)
      Specified by:
      confirmDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • confirmDialog

      public int confirmDialog(String message, String title, int optionType, int messageType, String msgid)
      Specified by:
      confirmDialog in interface ThreadSafeDialogs
      Specified by:
      confirmDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • inputDialog

      public String inputDialog(String message, String title, int messageType, String initialValue)
      Specified by:
      inputDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • inputDialog

      public String inputDialog(String message, String title)
      Specified by:
      inputDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showDialog

      public void showDialog(Component contents, String title)
      Description copied from interface: ThreadSafeDialogs
      Create a window with the contents and title specified as parameters and show as a dialog windows of gvSIG. if this method is invoked out of the event dispatch thread of swing, the dialog is presented in the thread of swing and the calling thread wait to close to continue. in this case the dialog is not presented as modal to other components of the gui.
      Specified by:
      showDialog in interface ThreadSafeDialogs
      Parameters:
      contents -
      title -
    • createComponent

      public Component createComponent(Class<? extends Component> theClass, Object... parameters)
      Specified by:
      createComponent in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • createComponentWithParams

      public Component createComponentWithParams(Class<? extends Component> theClass, Object[] parameters)
      Specified by:
      createComponentWithParams in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showChooserDialog

      public File[] showChooserDialog(String title, int type, int selectionMode, boolean multiselection, File initialPath, FileFilter filter, boolean fileHidingEnabled)
      Specified by:
      showChooserDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showChooserDialog

      public org.apache.commons.lang3.tuple.ImmutablePair<File[],Charset> showChooserDialog(String title, int type, int selectionMode, boolean multiselection, File initialPath, FileFilter filter, boolean fileHidingEnabled, boolean askCharset)
      Specified by:
      showChooserDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showChooserDialog

      public File[] showChooserDialog(String title, int type, int selectionMode, boolean multiselection, File initialPath, FileFilter filter, boolean fileHidingEnabled, JComponent accesory)
      Specified by:
      showChooserDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showOpenDirectoryDialog

      public File[] showOpenDirectoryDialog(String title, File initialPath)
      Specified by:
      showOpenDirectoryDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showOpenFileDialog

      public File[] showOpenFileDialog(String title, File initialPath)
      Specified by:
      showOpenFileDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • showSaveFileDialog

      public File[] showSaveFileDialog(String title, File initialPath)
      Specified by:
      showSaveFileDialog in interface org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager
    • setLocale

      public void setLocale(Locale locale)
      Specified by:
      setLocale in interface MainFrame
      Overrides:
      setLocale in class Component