Class WindowInfo

java.lang.Object
org.gvsig.andami.ui.mdiManager.WindowInfo
All Implemented Interfaces:
org.gvsig.tools.persistence.Persistent

public class WindowInfo extends Object implements org.gvsig.tools.persistence.Persistent
This class represents the state of the associated window. The set methods (setX, setY, setHeight, etc) are immediately reflected on the window. The update methods doesn't update the window, because they are used to update the WindowInfo object when the associated window was modified by user interaction.
Author:
Fernando González Cortés
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Integer
    Specifies that this window has an editor profile
    static final Integer
    Specifies that this window has an editor profile
    static final int
    Specifies that the window is iconifiable
    static final int
    Specifies that the window is maximizable
    static final int
    Specifies that the window is modal
    static final int
    Specifies that the window is modeless (it's on the top but doesn't block any other window)
    static final int
    Specifies that the window may be closed
    static final int
    Specifies that the window may be docked inside another window
    static final String
     
    static final Integer
    Specifies that this window has an editor profile
    static final Integer
    Specifies that this window has an editor profile
    static final int
    Specifies that the window is resizable
    static final Integer
    Specifies that this window has an editor profile
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new WindowInfo object with the default properties: not resizable not maximizable not iconifiable not modal not modeless not palette
    WindowInfo(int code)
    Creates a new WindowInfo object with the provided properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a PropertyChangeListener to the listener list.
    boolean
    Checks if the geometry of this window should be persisted in the project file.
    static WindowInfo
    createFromXMLEntity(org.gvsig.utils.XMLEntity xml)
    Creates a WindowInfo object from an XMLEntity containing the window properties.
    Obtiene información adicional de la ventana.
    Gets the bounds of the associated window.
    int
    Gets the window height.
    int
    Gets the window ID.
    Gets the minimum allowed size for the associated window.
    Gets the normal bounds of the associated window.
    int
    Gets the height of the window's origin when the window is not maximized.
    int
    Gets the width of the window's origin when the window is not maximized.
    int
     
    int
    Gets the x coordinate of the window's origin when the window is not maximized.
    void
    getPropertiesFromXMLEntity(org.gvsig.utils.XMLEntity xml)
    Updates this WindowInfo object according to the properties provided by the XMLEntity parameter.
    Gets the list of selected tools for this window.
    Gets the title property
    int
    Gets the window width.
    int
    Returns the current x coordinate of the window's origin (left-upper corner of the window).
    org.gvsig.utils.XMLEntity
    Gets the window properties in an XMLEntity object, suitable for persistence.
    int
    Gets the value of the y coordinate for the origin (left-upper corner of the window) of the associated window.
    boolean
    Finds out whether a view is open (showing) or closed
    boolean
    Determines whether the associated window is iconifiable or not
    boolean
    Determines whether the associated window is maximizable or not
    boolean
    Determines whether the window is maximized or not
    boolean
    Determines whether the associated window is modal or not
    boolean
    Determines whether the associated window is modeless (it is on the top but does not block any other window)
    boolean
    Determines whether the associated window is closable or not
    boolean
    Determines whether the associated dockable window is currently in palette status or docked.
    boolean
    Determines whether the associated window is resizable or not
    boolean
    Determines whether the associated window is visible
    void
    loadFromState(org.gvsig.tools.persistence.PersistentState state)
     
    boolean
     
    void
    Remove a PropertyChangeListener from the listener list.
    void
    saveToState(org.gvsig.tools.persistence.PersistentState state)
     
    void
    setAdditionalInfo(String additionalInfo)
    Asigna información adicional de la ventana.
    void
    Sets the bounds of the associated window.
    void
    setClosed(boolean closed)
    Specifies whether a view is open (showing) or closed
    void
    setHeight(int height)
    Sets the window height.
    void
    setId(int id)
    Sets the window's ID.
    void
    setMaximizable(boolean maximizable)
     
    void
    setMaximized(boolean maximized)
    Maximize the associated window
    void
    Sets the minimum allowed size for the associated window.
    void
    setNeedPack(boolean needPack)
     
    void
    setNormalBounds(int x, int y, int width, int height)
    Sets the normal bounds of the associated window.
    void
    setNormalBounds(Rectangle normalBounds)
    Sets the normal bounds of the associated window.
    void
    setNormalHeight(int normalHeight)
    Sets the normalHeight property for this WindowInfo object.
    void
    setNormalWidth(int normalWidth)
    Sets the normalWidth property for this WindowInfo object.
    void
    setNormalX(int normalX)
    Sets the normalX property for this WindowInfo object.
    void
    setNormalY(int normalY)
    Sets the normalY property for this WindowInfo object.
    void
    setNotClosable(boolean b)
    Sets notclosable property
    void
    setPersistence(boolean persist)
    Set whether the geometry of this window should be persisted in the project files.
    void
    setSelectedTool(String selectedTool)
    void
    setSelectedTools(Map selectedTools)
    Sets the list of selected tools for this window.
    void
    Sets the title property.
    void
    setWidth(int w)
    Sets the width property for the associated Window.
    void
    Updates all the properties in this object so that they match the properties of the provided wi object.
    void
    setX(int x)
    Sets the x coordinate of the window's origin (left-upper corner of the window).
    void
    setY(int y)
    Sets the value of the y coordinate for the origin (left-upper corner of the window) of the associated window.
    void
    toPalette(boolean b)
    Sets whether the window is in palette mode or is in docked mode.
    void
    updateBounds(int x, int y, int width, int height)
    Updates the bounds for this WindowInfo object.
    void
    Updates the bounds for this WindowInfo object.
    void
    updateClosed(boolean closed)
    Updates the closed property for this WindowInfo object.
    void
    updateHeight(int height)
    Updates the height property for this WindowInfo object.
    void
    updateMaximized(boolean maximized)
    Updates the maximized property for this WindowInfo object.
    void
    Updates the minimum allowed size for the associated window.
    void
    updateNormalBounds(int x, int y, int width, int height)
    Updates the normal bounds for this WindowInfo object.
    void
    Updates the normal bounds for this WindowInfo object.
    void
    updateNormalHeight(int normalHeight)
    Updates the normalHeight property for this WindowInfo object.
    void
    updateNormalWidth(int normalWidth)
    Updates the normalWidth property for this WindowInfo object.
    void
    updateNormalX(int normalX)
    Updates the normalX property for this WindowInfo object.
    void
    updateNormalY(int normalY)
    Updates the normalY property for this WindowInfo object.
    void
    Updates the title property for for this WindowInfo object.
    void
    updateWidth(int width)
    Updates the width property for for this WindowInfo object.
    void
    updateX(int x)
    Updates the value of the x coordinate for this WindowInfo object.
    void
    updateY(int y)
    Updates the value of the y coordinate for this WindowInfo object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PERSISTENCE_DEFINITION_NAME

      public static final String PERSISTENCE_DEFINITION_NAME
      See Also:
    • RESIZABLE

      public static final int RESIZABLE
      Specifies that the window is resizable
      See Also:
    • MAXIMIZABLE

      public static final int MAXIMIZABLE
      Specifies that the window is maximizable
      See Also:
    • ICONIFIABLE

      public static final int ICONIFIABLE
      Specifies that the window is iconifiable
      See Also:
    • MODALDIALOG

      public static final int MODALDIALOG
      Specifies that the window is modal
      See Also:
    • MODELESSDIALOG

      public static final int MODELESSDIALOG
      Specifies that the window is modeless (it's on the top but doesn't block any other window)
      See Also:
    • PALETTE

      public static final int PALETTE
      Specifies that the window may be docked inside another window
      See Also:
    • NOTCLOSABLE

      public static final int NOTCLOSABLE
      Specifies that the window may be closed
      See Also:
    • EDITOR_PROFILE

      public static final Integer EDITOR_PROFILE
      Specifies that this window has an editor profile
    • TOOL_PROFILE

      public static final Integer TOOL_PROFILE
      Specifies that this window has an editor profile
    • PROJECT_PROFILE

      public static final Integer PROJECT_PROFILE
      Specifies that this window has an editor profile
    • PROPERTIES_PROFILE

      public static final Integer PROPERTIES_PROFILE
      Specifies that this window has an editor profile
    • DIALOG_PROFILE

      public static final Integer DIALOG_PROFILE
      Specifies that this window has an editor profile
  • Constructor Details

    • WindowInfo

      public WindowInfo(int code)
      Creates a new WindowInfo object with the provided properties. Valid properties include:
      • WindowInfo.MODALDIALOG
      • WindowInfo.MODELESSDIALOG
      • WindowInfo.PALETTE
      • WindowInfo.ICONIFIABLE
      • WindowInfo.RESIZABLE
      • WindowInfo.MAXIMIZABLE
      • Properties can be set together by using the binary OR operator "|". For example:

        WindowInfo wi = new WindowInfo(WindowInfo.MODELESSDIALOG |WindowInfo.ICONIFIABLE|WindowInfo.RESIZABLE).

        The WindowInfo.MODELESSDIALOG and WindowInfo.MODALDIALOG properties cannot be set at the same time

      Parameters:
      code - Bit-or of the window properties.
      Throws:
      IllegalStateException - If incompatible properties are set together, for example, if MODALDIALOG and MODELESSDIALGO are set together.
    • WindowInfo

      public WindowInfo()
      Creates a new WindowInfo object with the default properties:
      • not resizable
      • not maximizable
      • not iconifiable
      • not modal
      • not modeless
      • not palette
  • Method Details

    • needPack

      public boolean needPack()
    • setNeedPack

      public void setNeedPack(boolean needPack)
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a PropertyChangeListener to the listener list. The listener will be notified about changes in this object.
      Parameters:
      listener -
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Remove a PropertyChangeListener from the listener list. The listener will not be notified anymore about changes in this object.
      Parameters:
      listener -
    • getX

      public int getX()
      Returns the current x coordinate of the window's origin (left-upper corner of the window).
      Returns:
      Returns the value (in pixels) of the x coordinate of the window's origin.
    • setX

      public void setX(int x)
      Sets the x coordinate of the window's origin (left-upper corner of the window).
      Parameters:
      x - The value (in pixels) of the x coordinate to set.
    • updateX

      public void updateX(int x)
      Updates the value of the x coordinate for this WindowInfo object. It doesn't get reflected on the window (use setX for that).
      Parameters:
      x - The value (in pixels) of the x coordinate
    • getY

      public int getY()
      Gets the value of the y coordinate for the origin (left-upper corner of the window) of the associated window.
      Returns:
      Returns the y coordinate (in pixels).
    • setY

      public void setY(int y)
      Sets the value of the y coordinate for the origin (left-upper corner of the window) of the associated window.
      Parameters:
      y - The value (in pixels) of the y coordinate
    • updateY

      public void updateY(int y)
      Updates the value of the y coordinate for this WindowInfo object. It doesn't get reflected on the window (use setY for that).
      Parameters:
      y - The value (in pixels) of the y coordinate
    • isIconifiable

      public boolean isIconifiable()
      Determines whether the associated window is iconifiable or not
      Returns:
    • isMaximizable

      public boolean isMaximizable()
      Determines whether the associated window is maximizable or not
      Returns:
    • isResizable

      public boolean isResizable()
      Determines whether the associated window is resizable or not
      Returns:
    • isModal

      public boolean isModal()
      Determines whether the associated window is modal or not
      Returns:
    • getHeight

      public int getHeight()
      Gets the window height.
      Returns:
      The window height (in pixels).
    • getWidth

      public int getWidth()
      Gets the window width.
      Returns:
      The window width (in pixels).
    • setHeight

      public void setHeight(int height)
      Sets the window height.
      Parameters:
      The - window height (in pixels)
    • updateHeight

      public void updateHeight(int height)
      Updates the height property for this WindowInfo object. It doesn't get reflected on the window (use setHeight for that).
      Parameters:
      height - The height value for this WindowInfo object
    • setWidth

      public void setWidth(int w)
      Sets the width property for the associated Window.
      Parameters:
      w - The new width.
    • updateWidth

      public void updateWidth(int width)
      Updates the width property for for this WindowInfo object. It doesn't get reflected on the window (use setWidth for that).
      Parameters:
      height - The height value for this WindowInfo object
    • getTitle

      public String getTitle()
      Gets the title property
      Returns:
    • setTitle

      public void setTitle(String title)
      Sets the title property.
      Parameters:
      title - The new title.
    • updateTitle

      public void updateTitle(String title)
      Updates the title property for for this WindowInfo object. It doesn't get reflected on the window (use setTitle for that).
      Parameters:
      title - The title value for this WindowInfo object
    • isModeless

      public boolean isModeless()
      Determines whether the associated window is modeless (it is on the top but does not block any other window)
      Returns:
    • isNotClosable

      public boolean isNotClosable()
      Determines whether the associated window is closable or not
      Returns:
    • setNotClosable

      public void setNotClosable(boolean b)
      Sets notclosable property
    • isVisible

      public boolean isVisible()
      Determines whether the associated window is visible
      Returns:
      true if the associated window is visible, false if it is hidden
    • isPalette

      public boolean isPalette()
      Determines whether the associated dockable window is currently in palette status or docked.
      Returns:
      true if the window is currently in palette status, false if it is docked in another window
    • setId

      public void setId(int id)
      Sets the window's ID.
      Parameters:
      id - An integer to identify the window. Different windows must have different IDs.
    • getId

      public int getId()
      Gets the window ID.
      Returns:
      id An integer to identify the window. Different windows must have different IDs.
    • setWindowInfo

      public void setWindowInfo(WindowInfo vi)
      Updates all the properties in this object so that they match the properties of the provided wi object. The changes are not reflected on the window, just the WindowInfo object is updated.
      Parameters:
      vi - A WindowInfo object containing the new properties of the window.
    • toPalette

      public void toPalette(boolean b)
      Sets whether the window is in palette mode or is in docked mode. This method does not update the window status, it just updates the WindowInfo object. Use the IWindowTransform interface to actually change the window status.
      Parameters:
      b -
    • getSelectedTools

      public Map getSelectedTools()
      Gets the list of selected tools for this window.
      Returns:
      A HashMap containing pairs (group, actionCommand), which are the selected tools for this window.
    • setSelectedTool

      public void setSelectedTool(String selectedTool)
      Parameters:
      selectedTool -
    • setSelectedTools

      public void setSelectedTools(Map selectedTools)
      Sets the list of selected tools for this window.
      Parameters:
      selectedTools - A HashMap containing pairs (group, actionCommand), which will be set as the selected tools for this window.
    • isClosed

      public boolean isClosed()
      Finds out whether a view is open (showing) or closed
    • setClosed

      public void setClosed(boolean closed)
      Specifies whether a view is open (showing) or closed
    • updateClosed

      public void updateClosed(boolean closed)
      Updates the closed property for this WindowInfo object. It doesn't get reflected on the window (use setClosed for that).
      Parameters:
      closed - The new closed property for this WindowInfo object
    • setNormalX

      public void setNormalX(int normalX)
      Sets the normalX property for this WindowInfo object. This sets the X position that the window would have when it gets restored from the maximized state.
      Parameters:
      normalX - The new normalX property for this WindowInfo object
    • updateNormalX

      public void updateNormalX(int normalX)
      Updates the normalX property for this WindowInfo object. It doesn't get reflected on the window (use setNormalX for that).
      Parameters:
      normalX - The new normalX property for this WindowInfo object
    • setNormalY

      public void setNormalY(int normalY)
      Sets the normalY property for this WindowInfo object. This sets the Y position that the window would have when it gets restored from the maximized state.
      Parameters:
      normalY - The new normalY property for this WindowInfo object
    • updateNormalY

      public void updateNormalY(int normalY)
      Updates the normalY property for this WindowInfo object. It doesn't get reflected on the window (use setNormalY for that).
      Parameters:
      normalY - The new normalY property for this WindowInfo object
    • setNormalHeight

      public void setNormalHeight(int normalHeight)
      Sets the normalHeight property for this WindowInfo object. This sets the height position that the window would have when it gets restored from the maximized state.
      Parameters:
      normalY - The new normalHeight property for this WindowInfo object
    • updateNormalHeight

      public void updateNormalHeight(int normalHeight)
      Updates the normalHeight property for this WindowInfo object. It doesn't get reflected on the window (use setNormalHeight for that).
      Parameters:
      normalHeight - The new normalHeight property for this WindowInfo object
    • setNormalWidth

      public void setNormalWidth(int normalWidth)
      Sets the normalWidth property for this WindowInfo object. This sets the width position that the window would have when it gets restored from the maximized state.
      Parameters:
      normalY - The new normalWidth property for this WindowInfo object
    • setMinimumSize

      public void setMinimumSize(Dimension minSize)
      Sets the minimum allowed size for the associated window. If null is provided, the minimum size is disabled (and thus the window can be resized to any size).
      Parameters:
      minSize - The minimum allowed size for the associated window.
    • updateMinimumSize

      public void updateMinimumSize(Dimension minSize)
      Updates the minimum allowed size for the associated window. It doesn't get reflected on the window (use setMinimumSize for that).
      Parameters:
      minSize - The minimum allowed size for the associated window.
    • getMinimumSize

      public Dimension getMinimumSize()
      Gets the minimum allowed size for the associated window.
      Returns:
      minSize The minimum allowed size for the associated window.
    • updateNormalWidth

      public void updateNormalWidth(int normalWidth)
      Updates the normalWidth property for this WindowInfo object. It doesn't get reflected on the window (use setNormalWidth for that).
      Parameters:
      normalWidth - The new normalHeight property for this WindowInfo object
    • setMaximized

      public void setMaximized(boolean maximized)
      Maximize the associated window
      Parameters:
      maximized -
    • updateMaximized

      public void updateMaximized(boolean maximized)
      Updates the maximized property for this WindowInfo object. It doesn't get reflected on the window (use setMaximized for that).
      Parameters:
      maximized - The new maximized property for this WindowInfo object
    • setMaximizable

      public void setMaximizable(boolean maximizable)
    • updateBounds

      public void updateBounds(int x, int y, int width, int height)
      Updates the bounds for this WindowInfo object. It doesn't get reflected on the window (use setBounds for that).
      Parameters:
      x -
      y -
      width -
      height -
    • setNormalBounds

      public void setNormalBounds(int x, int y, int width, int height)
      Sets the normal bounds of the associated window. This sets the bounds that the window would have when it gets restored from the maximized state.
      Parameters:
      x -
      y -
      width -
      height -
    • updateNormalBounds

      public void updateNormalBounds(int x, int y, int width, int height)
      Updates the normal bounds for this WindowInfo object. It doesn't get reflected on the window (use setNormalBounds for that).
      Parameters:
      x -
      y -
      width -
      height -
    • getNormalBounds

      public Rectangle getNormalBounds()
      Gets the normal bounds of the associated window. This gets the bounds that the window would have when it gets restored from the maximized state.
      Returns:
      The normal bounds of the associated window.
    • setNormalBounds

      public void setNormalBounds(Rectangle normalBounds)
      Sets the normal bounds of the associated window. This sets the bounds that the window would have when it gets restored from the maximized state.
      Parameters:
      normalBounds -
    • updateNormalBounds

      public void updateNormalBounds(Rectangle normalBounds)
      Updates the normal bounds for this WindowInfo object. It doesn't get reflected on the window (use setNormalBounds for that).
      Parameters:
      normalBounds -
    • setBounds

      public void setBounds(Rectangle bounds)
      Sets the bounds of the associated window.
      Parameters:
      bounds -
    • updateBounds

      public void updateBounds(Rectangle bounds)
      Updates the bounds for this WindowInfo object. It doesn't get reflected on the window (use setBounds for that).
      Parameters:
      bounds -
    • getBounds

      public Rectangle getBounds()
      Gets the bounds of the associated window.
      Returns:
      The bounds of the associated window.
    • getNormalX

      public int getNormalX()
    • getNormalY

      public int getNormalY()
      Gets the x coordinate of the window's origin when the window is not maximized. When the window is maximized, gets the y coordinate that it will have when it gets restored
      Returns:
      the normal y coordinate of the window's origin
    • getNormalHeight

      public int getNormalHeight()
      Gets the height of the window's origin when the window is not maximized. When the window is maximized, gets the height that it will have when it gets restored
      Returns:
      the normal height of the window
    • getNormalWidth

      public int getNormalWidth()
      Gets the width of the window's origin when the window is not maximized. When the window is maximized, gets the width that it will have when it gets restored
      Returns:
      the normal width of the window
    • isMaximized

      public boolean isMaximized()
      Determines whether the window is maximized or not
      Returns:
      true if the window is maximized, false otherwise
    • checkPersistence

      public boolean checkPersistence()
      Checks if the geometry of this window should be persisted in the project file. This is set by the persistWindow(boolean) method, and the default value is true.
      Returns:
      True if the geometry of this window should be persisted in the project files, false otherwise.
    • setPersistence

      public void setPersistence(boolean persist)
      Set whether the geometry of this window should be persisted in the project files.
      Parameters:
      persist -
    • getXMLEntity

      public org.gvsig.utils.XMLEntity getXMLEntity()
      Gets the window properties in an XMLEntity object, suitable for persistence.
      Returns:
      An XMLEntity object containing the window properties, or null if the window was set as not persistent
    • createFromXMLEntity

      public static WindowInfo createFromXMLEntity(org.gvsig.utils.XMLEntity xml)
      Creates a WindowInfo object from an XMLEntity containing the window properties.
      Parameters:
      xml - An XMLEntity object containing the window properties
      Returns:
      A new WindowInfo object, containing the properties specified in the XMLEntity parameters
    • getPropertiesFromXMLEntity

      public void getPropertiesFromXMLEntity(org.gvsig.utils.XMLEntity xml)
      Updates this WindowInfo object according to the properties provided by the XMLEntity parameter.
      Parameters:
      xml - An XMLEntity object containing the window properties
    • getAdditionalInfo

      public String getAdditionalInfo()
      Obtiene información adicional de la ventana. Esta etiqueta podrá llevar cualquier tipo de información que queramos almacenar.
      Returns:
      Información adicional
    • setAdditionalInfo

      public void setAdditionalInfo(String additionalInfo)
      Asigna información adicional de la ventana. Esta etiqueta podrá llevar cualquier tipo de información que queramos almacenar.
    • saveToState

      public void saveToState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      saveToState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • loadFromState

      public void loadFromState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      loadFromState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException